-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (37 loc) · 1.06 KB
/
index.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
import {Navigation} from 'react-native-navigation';
import {registerScreens} from './src/navigation/register_screens';
import {initializePushNotifications} from './src/notifications';
import {
goToAuth,
startInitialisation,
} from './src/navigation/navigation_settings';
import {getData} from './src/storage';
import {colors} from './src/colors';
const setDefaultOptions = () =>
Navigation.setDefaultOptions({
topBar: {
visible: false,
height: 0,
},
layout: {
backgroundColor: colors.lightBlue,
orientation: ['portrait'],
},
});
registerScreens();
Navigation.events().registerAppLaunchedListener(async () => {
await initializePushNotifications();
setDefaultOptions();
const userToken = JSON.parse(await getData('token'));
const userType = JSON.parse(await getData('userType'));
const userVehicle = JSON.parse(await getData('userVehicle'));
if (userToken && userType) {
if (userType === 'carrier' && !userVehicle) {
goToAuth();
} else {
startInitialisation();
}
} else {
goToAuth();
}
});