-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
109 lines (92 loc) · 2.84 KB
/
App.js
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import {
StyleSheet,
StatusBar,
} from 'react-native';
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import { createDrawerNavigator } from '@react-navigation/drawer'
import { DrawerContent } from './src/screens/drawerContent'
import SignInScreen from './src/screens/signInScreen'
import FlashScreen from './src/screens/flashScreen'
import HomeScreen from './src/screens/homeScreen'
import { AuthContext } from './src/shared/AuthContext';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
const Stack = createStackNavigator()
const Drawer = createDrawerNavigator()
const App: () => React$Node = () => {
createHomeStack = ({navigation}) => {
return (
<Stack.Navigator
screenOptions={{
headerStyle: {
backgroundColor: "#009387"
},
headerTintColor: "#fff",
headerTitleAlign: "center",
headerTitleStyle: {
fontWeight: 'bold'
}
}}
>
<Stack.Screen
name='Home'
component={HomeScreen}
options={{
title: 'Overview',
headerLeft: () => (
<Icon.Button name="menu" size={25} backgroundColor="#009387"
onPress={() => navigation.openDrawer()}></Icon.Button>
)
}}
/>
</Stack.Navigator>
)
}
const [isLoading, setIsLoading] = React.useState(true)
const [userToken, setUserToken] = React.useState(null)
const authContext = React.useMemo(() => ({
signIn: () => {
setUserToken('pradep')
setIsLoading(false)
},
signUp: () => {
setUserToken('pradep')
setIsLoading(false)
},
signOut: () => {
setUserToken('pradep')
setIsLoading(false)
}
}))
return (
<>
<AuthContext.Provider value={authContext}>
<NavigationContainer>
<Drawer.Navigator drawerContent={props => <DrawerContent {...props} />}>
<Drawer.Screen name='Home' children={createHomeStack} />
</Drawer.Navigator>
{/* <HomeStack.Screen name="Home" component={HomeScreen} options={{
title:'Overview',
headerLeft: () => (
<Icon.Button name="ios-menu" size={25} backgroundColor="#009387"
onPress={() => navigation.openDrawer()}></Icon.Button>
)
}} /> */}
{/* <Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name='Flash' component={FlashScreen} />
<Stack.Screen name='signInScreen' component={SignInScreen} />
</Stack.Navigator> */}
</NavigationContainer>
</AuthContext.Provider>
</>
);
};
export default App;