-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
81 lines (66 loc) · 2.47 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React, { default as ReactFromImport } from "react";
import { default as ReactReduxFromImport, Provider } from "react-redux";
import { NativeStackNavigationProp, NativeStackScreenProps } from "@react-navigation/native-stack";
import { StackNavigationOptions } from "@react-navigation/stack/lib/typescript/src/types";
import { CardStyleInterpolators, createStackNavigator, HeaderStyleInterpolators } from '@react-navigation/stack';
import { TimerView } from "./src/TimerView";
import { NewTimerForm } from "./src/NewTimerForm";
import { createStore } from "redux";
import { NavigationContainer, RouteProp } from "@react-navigation/native";
import { store } from "./store";
export let AppNavigator: any = null;
type Props = NativeStackScreenProps<any, any>
const TimerTab = ({route, navigation}: Props) => {
AppNavigator = navigation
return (
<TimerView/>
)
}
type RouteParams = RouteProp<any, any> & { id: string };
type TimerModalTabProps = {
route: RouteParams,
navigation: Props,
}
const TimerModalTab = ({route, navigation}: TimerModalTabProps) => {
AppNavigator = navigation
return (
<NewTimerForm {...route.params}/>
)
}
const cardStyle: StackNavigationOptions = {
presentation: 'card' ,
animationEnabled: true,
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS
}
const modalStyle: StackNavigationOptions = {
presentation: 'modal' ,
animationEnabled: true,
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
cardStyleInterpolator: CardStyleInterpolators.forModalPresentationIOS,
headerShown: false,
animationTypeForReplace: 'pop',
}
const App = () => {
let TimerStack = () => {
let TimerNavigator = createStackNavigator();
return (
<NavigationContainer>
<TimerNavigator.Navigator screenOptions={{
headerShown: true
}}>
<TimerNavigator.Screen name="Timers" component={TimerTab} options={cardStyle}/>
<TimerNavigator.Screen name="TimerModal" component={TimerModalTab} options={modalStyle} />
</TimerNavigator.Navigator >
</NavigationContainer>
);
}
return (
// TODO: wrap TimerStack with relevant providers for React Genie
// <div>HELLO</div>?
<Provider store={store}>
<TimerStack/>
</Provider>
);
};
export default App;