-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
54 lines (48 loc) · 1.64 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
// In App.js in a new project
//Navigators
import "react-native-gesture-handler";
import { NavigationContainer } from "@react-navigation/native";
import { createDrawerNavigator } from "@react-navigation/drawer";
import { registerForPushNotificationsAsync } from "@utils";
//UI Provider
import { NativeBaseProvider } from "native-base";
import { NativeBaseConfig } from "@config";
//Screens
import { SCREENS } from "@config";
import { Home, Auth, Settings, Support } from "@screens";
//Helpers
import { useAuthentication } from "@hooks";
import { IconButton } from "@components";
const Drawer = createDrawerNavigator();
registerForPushNotificationsAsync()
function App() {
const authentication = useAuthentication();
const { isAuthenticated } = authentication;
return (
<NativeBaseProvider config={NativeBaseConfig}>
{!isAuthenticated ? (
<Auth authentication={authentication} />
) : (
<NavigationContainer>
<Drawer.Navigator
initialRouteName={SCREENS.HOME}
screenOptions={{
headerRight: () => (
<IconButton
type="log-out-outline"
onPress={() => authentication.signOut()}
touchableProps={{ style: { marginRight: 16 } }}
/>
),
}}
>
<Drawer.Screen name={SCREENS.HOME} component={Home} />
<Drawer.Screen name={SCREENS.SETTINGS} component={Settings} />
<Drawer.Screen name={SCREENS.SUPPORT} component={Support} />
</Drawer.Navigator>
</NavigationContainer>
)}
</NativeBaseProvider>
);
}
export default App;