-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
74 lines (70 loc) · 2.39 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
import DrawerNavigator from '@navigation/DrawerNavigator';
import { AuthStackNavigator, CheckoutStackNavigator } from '@navigation/StackNavigator';
import { GoogleSignin } from '@react-native-community/google-signin';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { AuthNavigationContext, AuthNavState } from '@utils/helpers/AuthNavigationContext';
import { AuthContext, useAuthContext } from '@utils/helpers/withAuthContext';
import * as React from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-view';
const configureGoogleSign = () =>
GoogleSignin.configure({
webClientId: '777161788745-q45gphtgoldvv34cu891c43hfv4cv2ik.apps.googleusercontent.com',
offlineAccess: false,
});
const screenOptions = {
headerShown: false,
headerTintColor: 'black',
};
const modalScreenOptions = {
cardStyle: { backgroundColor: 'rgba(0,0,0,0.6)' },
cardStyleInterpolator: ({ current: { progress } }) => ({
cardStyle: {
opacity: progress.interpolate({
inputRange: [0, 0.5, 0.9, 1],
outputRange: [0, 0.25, 0.7, 1],
}),
},
overlayStyle: {
opacity: progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.5],
extrapolate: 'clamp',
}),
},
}),
cardOverlayEnabled: false,
};
const RootStack = createStackNavigator();
const RootStackScreen = () => {
const { authNavState } = AuthNavState();
return (
<AuthNavigationContext.Provider value={authNavState}>
<RootStack.Navigator
headerMode="false"
initialRouteName="DrawerContent"
screenOptions={screenOptions}
// mode="modal"
>
<RootStack.Screen name="DrawerContent" component={DrawerNavigator} />
<RootStack.Screen name="Auth" component={AuthStackNavigator} options={modalScreenOptions} mode="modal" />
<RootStack.Screen name="Checkout" component={CheckoutStackNavigator} />
</RootStack.Navigator>
</AuthNavigationContext.Provider>
);
};
export default function App() {
const { authContext } = useAuthContext();
React.useEffect(() => {
configureGoogleSign();
}, []);
return (
<AuthContext.Provider value={authContext}>
<SafeAreaProvider>
<NavigationContainer>
<RootStackScreen />
</NavigationContainer>
</SafeAreaProvider>
</AuthContext.Provider>
);
}