-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
53 lines (39 loc) · 1.54 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
import React from 'react';
// Main App file which uses Drawer
// Module imports
import { NavigationContainer } from '@react-navigation/native';
// import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import SideBar from './screens/SideBar';
import HomeScreen from './screens/HomeScreen';
import 'react-native-gesture-handler';
import { createDrawerNavigator } from '@react-navigation/drawer';
// const Stack = createNativeStackNavigator();
// Define the Drawer constant
const Drawer = createDrawerNavigator();
// Main App function
const App = () => {
return(
// It returns a SafeAreaProvider which I had to include because of errors when building it with expo
// Then a NavigationContainer which has the Drawers
// Then Two Drawer Screens which are the SideBar and the HomeScreen
<SafeAreaProvider>
<NavigationContainer>
<Drawer.Navigator>
<Drawer.Screen
name="SideBar"
component={SideBar}
options={{title: 'Welcome to SideBar'}}
/>
<Drawer.Screen
name="Home"
component={HomeScreen}
options={{title: 'Welcome'}}
/>
</Drawer.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
};
// Exporting the App component
export default App;