-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
53 lines (48 loc) · 1.81 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
import { matrix } from '@rn-matrix/expo';
import '@rn-matrix/expo/shim';
import { StatusBar } from 'expo-status-bar';
import React, { useEffect } from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { useObservableState } from 'observable-hooks';
import * as eva from '@eva-design/eva';
import { ApplicationProvider, IconRegistry } from '@ui-kitten/components';
import { EvaIconsPack } from '@ui-kitten/eva-icons';
import { default as theme } from './theme.json';
import useColorScheme from './hooks/useColorScheme';
import Navigation from './navigation';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import LoginScreen from './screens/LoginScreen';
import SignupScreen from './screens/SignupScreen';
export default function App() {
const Stack = createStackNavigator();
const colorScheme = useColorScheme();
const authLoggedIn = useObservableState(matrix.isLoggedIn$());
if (authLoggedIn) {
return (
<>
<IconRegistry icons={EvaIconsPack} />
<ApplicationProvider {...eva} theme={{ ...eva.light, ...theme }}>
<SafeAreaProvider>
<Navigation colorScheme={colorScheme} />
<StatusBar />
</SafeAreaProvider>
</ApplicationProvider>
</>
);
} else {
return (
<>
<IconRegistry icons={EvaIconsPack} />
<ApplicationProvider {...eva} theme={{ ...eva.light, ...theme }}>
<NavigationContainer>
<Stack.Navigator initialRouteName="LogIn">
<Stack.Screen name="LogIn" component={LoginScreen} />
<Stack.Screen name="SignUp" component={SignupScreen} />
</Stack.Navigator>
</NavigationContainer>
</ApplicationProvider>
</>
);
}
}