-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
105 lines (90 loc) · 1.97 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import 'mobx-react-lite/batchingForReactNative';
import { AppRegistry, BackHandler, Alert } from "react-native";
import { Navigation } from 'react-native-navigation';
import RegisterScreens from 'app/screens';
import { setListners } from './app/helpers/PushController';
RegisterScreens();
Navigation.events().registerAppLaunchedListener(async () => {
Navigation.setDefaultOptions({
statusBar: {
style: 'light'
},
animations: {
setRoot: {
enter: {
waitForRender: true,
enabled: false,
alpha: {
from: 0,
to: 1,
duration: 100
}
},
exit: {
waitForRender: true,
enabled: false,
alpha: {
from: 1,
to: 0,
duration: 100
}
},
},
push: {
content: {
alpha: {
from: 0,
to: 1,
duration: 100
}
}
},
pop: {
content: {
alpha: {
from: 1,
to: 0,
duration: 100
}
}
}
}
});
Navigation.setRoot({
root: {
stack: {
id: 'appStack',
children: [
{ component: { name: 'Login' } }
]
}
}
});
const backAction = () => {
const components = Navigation.concreteNavigation.store.componentsInstancesById
// console.log(components);
if (Object.keys(components).length > 1) {
return;
}
Alert.alert("", "Are you sure you want to exit?", [
{
text: "Cancel",
onPress: () => null,
style: "cancel"
},
{ text: "YES", onPress: () => BackHandler.exitApp() }
]);
return true;
};
BackHandler.addEventListener(
"hardwareBackPress",
backAction
);
});
setListners();
function HeadlessCheck({ isHeadless }) {
if (isHeadless) {
return null;
}
}
AppRegistry.registerComponent('app', () => HeadlessCheck);