Explorar el Código

Check if react has already been instantiated

When returning to foreground after `onRestart` react context should
not be initialised since activity was not destroyed when going to background.
Guy Carmeli hace 8 años
padre
commit
974a8ea697

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/activities/RootActivity.java Ver fichero

@@ -18,8 +18,10 @@ public class RootActivity extends BaseReactActivity {
18 18
     @Override
19 19
     protected void handleOnCreate() {
20 20
         super.handleOnCreate();
21
-        // Trigger react context initialization, global javascript code will now execute
22
-        getReactInstanceManager().createReactContextInBackground();
21
+        if (!getReactInstanceManager().hasStartedCreatingInitialContext()) {
22
+            // Trigger react context initialization, global javascript code will now execute
23
+            getReactInstanceManager().createReactContextInBackground();
24
+        }
23 25
     }
24 26
 
25 27
     @Override