-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.js
83 lines (73 loc) · 2.13 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import 'react-native-gesture-handler';
import React from 'react';
import {StyleSheet, View, Text} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {drawerItemsMain} from './drawerItemsMain';
import CustomDrawerContent from './CustomDrawerContent.js';
import CustomHeader from './CustomHeader';
const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();
function HomeScreen() {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Home Screen</Text>
</View>
);
}
function Settings1Screen() {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Settings 1 Screen</Text>
</View>
);
}
function Settings2Screen() {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Settings 2 Screen</Text>
</View>
);
}
function MainDrawerNavigation() {
return (
<Drawer.Navigator
initialRouteName="Home"
drawerContent={(props) => (
<CustomDrawerContent drawerItems={drawerItemsMain} {...props} />
)}>
<Drawer.Screen name="Home" component={HomeScreen} />
<Drawer.Screen name="Settings1" component={Settings1Screen} />
<Drawer.Screen name="Settings2" component={Settings2Screen} />
</Drawer.Navigator>
);
}
const App: () => React$Node = () => {
return (
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerMode: 'screen',
headerTintColor: '#404554',
headerTitleStyle: {
fontWeight: 'bold',
},
header: (props) => {
return <CustomHeader {...props} />;
},
}}>
<Stack.Screen name="MainDrawer" component={MainDrawerNavigation} />
</Stack.Navigator>
</NavigationContainer>
);
};
const styles = StyleSheet.create({});
export default App;