Currently startApp is called from global context which results in the app being launched when headlessJs tasks run in the background. In order to support this use case, while not breaking existing users, this commit adds two mechanisms which should help users detrmine if the native Activity is running and startApp can be called safely. 1. RNN.appLaunched event is emitted is SplashActivity starts and react context has already been created. This is the use case of openeing the app while headless js task was started or has just finished and react context is in a "pasued" state. 2. Navigation.isAppLaunched() convenience method has been added. It returns a promise which when resolved, indicates if the app is launched and we should show the ui or not. Usage import {Navigation, NativeEventsReceiver} from 'react-native-navigation'; Promise.resolve(Navigation.isAppLaunched()) .then(appLaunched => { if (appLaunched) { startApp(); } else { new NativeEventsReceiver().appLaunched(startApp); } }); function startApp() { Navigation.startTabBasedApp({ ... }); }
|
||
52 | 52 |
|
53 | 53 |
|
54 | 54 |
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
55 | 62 |
|
|
||
258 | 258 |
|
259 | 259 |
|
260 | 260 |
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
261 | 266 |
|
|
||
535 | 535 |
|
536 | 536 |
|
537 | 537 |
|
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
542 |
|
|
538 | 543 |
|
|
||
11 | 11 |
|
12 | 12 |
|
13 | 13 |
|
14 |
|
|
14 | 15 |
|
15 | 16 |
|
16 | 17 |
|
|
||
22 | 23 |
|
23 | 24 |
|
24 | 25 |
|
26 |
|
|
25 | 27 |
|
26 | 28 |
|
29 |
|
|
30 |
|
|
27 | 31 |
|
28 | 32 |
|
29 | 33 |
|
|
||
42 | 46 |
|
43 | 47 |
|
44 | 48 |
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
45 | 55 |
|
46 | 56 |
|
47 | 57 |
|
|
||
1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
||
162 | 162 |
|
163 | 163 |
|
164 | 164 |
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
165 | 169 |
|
166 | 170 |
|
167 | 171 |
|
|
||
177 | 181 |
|
178 | 182 |
|
179 | 183 |
|
180 |
|
|
184 |
|
|
185 |
|
|
181 | 186 |
|
|
||
1 | 1 |
|
2 | 2 |
|
3 |
|
|
3 | 4 |
|
4 | 5 |
|
5 | 6 |
|
6 |
|
|
7 |
|
|
8 |
|
|
7 | 9 |
|
8 |
|
|
||
1 | 1 |
|
2 | 2 |
|
3 | 3 |
|
4 |
|
|
4 | 5 |
|
5 | 6 |
|
6 | 7 |
|
7 | 8 |
|
8 |
|
|
9 |
|
|
10 |
|
|
9 | 11 |
|
|
||
675 | 675 |
|
676 | 676 |
|
677 | 677 |
|
678 |
|
|
679 |
|
|
680 |
|
|
681 |
|
|
678 | 682 |
|
679 | 683 |
|
680 | 684 |
|
|
||
704 | 708 |
|
705 | 709 |
|
706 | 710 |
|
707 |
|
|
711 |
|
|
712 |
|
|
708 | 713 |
|
|
||
177 | 177 |
|
178 | 178 |
|
179 | 179 |
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
180 | 184 |
|
181 | 185 |
|
182 | 186 |
|
|
||
210 | 214 |
|
211 | 215 |
|
212 | 216 |
|
213 |
|
|
217 |
|
|
218 |
|
|
214 | 219 |
|