-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp2.js
80 lines (71 loc) · 2.01 KB
/
App2.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
import * as React from "react";
import { Button, View, Text } from "react-native";
import {
createDrawerNavigator,
DrawerContentScrollView,
DrawerItemList,
DrawerItem,
} from "@react-navigation/drawer";
import { NavigationContainer,DefaultTheme } from "@react-navigation/native";
const MyTheme = {
...DefaultTheme,
colors:{
...DefaultTheme.colors,
primary:'rgb(255,45,85)',
background: 'rgb(242,242,242)',
card: 'rgb(255,255,255)',
text: 'rgb(28,28,30)',
border: 'rgb(199,199,204)',
notification: 'rgb(255,69,58)',
},
};
function Feed({ navigation }) {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>Feed Screen</Text>
<Button title = 'Open drawer' onPress = {()=>navigation.openDrawer}/>
<Button title = 'Toggle drawer' onPress = {()=>navigation.toggleDrawer}/>
</View>
);
}
function Notification({ navigation }) {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>Notification Screen</Text>
</View>
);
}
function CustomDrawerContent(props) {
return (
<DrawerContentScrollView {...props}>
<DrawerItemList {...props} />
<DrawerItem label="Close drawer" onPress={() => props.navigation.closeDrawer()} />
<DrawerItem label="Toggle drawer" onPress={() => props.navigation.closeToggle()} />
</DrawerContentScrollView>
);
}
const Drawer = createDrawerNavigator();
function MyDrawer() {
return (
<Drawer.Navigator
useLegacyImplementation
drawerContent={(props) => <CustomDrawerContent {...props} />}
screenOptions={{
drawerStyle:{
backgroundColor:'lightblue',
Width:240,
}
}}
>
<Drawer.Screen name="Feed" component={Feed} />
<Drawer.Screen name="Notification" component={Notification} />
</Drawer.Navigator>
);
}
export default function App() {
return (
<NavigationContainer theme={MyTheme}>
<MyDrawer />
</NavigationContainer>
);
}