This repository was archived by the owner on Mar 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathApp.js
More file actions
72 lines (68 loc) · 2.37 KB
/
App.js
File metadata and controls
72 lines (68 loc) · 2.37 KB
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
/**
* Kuka React Native App
* https://github.com/facebook/react-native
*
* Generated with the UI Kitten template
* https://github.com/akveo/react-native-ui-kitten
*
* Documentation: https://akveo.github.io/react-native-ui-kitten/docs
*
* @format
*/
import 'react-native-gesture-handler';
import React, { useEffect, useState } from 'react';
import { ApplicationProvider, IconRegistry } from '@ui-kitten/components';
import { EvaIconsPack } from '@ui-kitten/eva-icons';
import * as eva from '@eva-design/eva';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import auth from '@react-native-firebase/auth';
import { GoogleSignin } from '@react-native-google-signin/google-signin';
import { LoginScreen } from './screens/LoginScreen';
import { SignupScreen } from './screens/SignupScreen';
import { ForgotPasswordScreen } from './screens/ForgotPasswordScreen';
import { AuthNavigator } from './navigation/AuthNavigator';
import { default as theme } from './app-theme.json';
import { default as mapping } from './app-mapping.json';
GoogleSignin.configure({
webClientId:
'921635578637-ma0i915tikp1q0v9q9gmfuefvd8grom6.apps.googleusercontent.com',
});
export default () => {
const { Navigator, Screen } = createStackNavigator();
// const theme = useTheme();
const [authUser, setAuthUser] = useState(null);
useEffect(() => {
return auth().onAuthStateChanged(authUser => {
return authUser ? setAuthUser(authUser) : setAuthUser(null);
});
});
return (
<>
<IconRegistry icons={EvaIconsPack} />
<ApplicationProvider
{...eva}
theme={{ ...eva.light, ...theme }}
customMapping={mapping}
>
<SafeAreaProvider>
<NavigationContainer>
{authUser ? (
<AuthNavigator />
) : (
<Navigator screenOptions={{ headerShown: false }}>
<Screen name="Login" component={LoginScreen} />
<Screen name="Signup" component={SignupScreen} />
<Screen
name="Forgot Password"
component={ForgotPasswordScreen}
/>
</Navigator>
)}
</NavigationContainer>
</SafeAreaProvider>
</ApplicationProvider>
</>
);
};