-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.tsx
57 lines (54 loc) · 1.71 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
55
56
57
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { Button } from 'components';
import { LogBox } from 'react-native';
import { useAuthSelector } from 'stores/auth';
import * as SCREEN_NAMES from 'utils/constants';
import * as SCREENS from './screens';
const Stack = createNativeStackNavigator();
export default function App() {
const { isAuthenticated, handleLogout } = useAuthSelector();
LogBox.ignoreLogs(['timer']);
return (
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerShown: true,
statusBarAnimation: 'slide',
animation: 'slide_from_right',
headerRight: () => <Button text="Log out" onPress={handleLogout} />,
}}
>
{isAuthenticated ?? (
<Stack.Screen
name={SCREEN_NAMES.HOME}
component={SCREENS.Home}
options={{ animation: 'none' }}
/>
)}
{isAuthenticated ? (
<>
<Stack.Screen name="Home" component={SCREENS.Home} />
<Stack.Screen
name={SCREEN_NAMES.MOOD_CHOOSE}
component={SCREENS.ChooseMood}
/>
</>
) : (
<>
<Stack.Screen
name={SCREEN_NAMES.LOGIN}
component={SCREENS.Login}
options={{ headerShown: false, animation: 'fade_from_bottom' }}
/>
<Stack.Screen
name={SCREEN_NAMES.REGISTER}
component={SCREENS.Register}
options={{ headerShown: false }}
/>
</>
)}
</Stack.Navigator>
</NavigationContainer>
);
}