Browse Source

fix killed in background bug && update package.json

Daniel Zlotin 8 years ago
parent
commit
39ca5c807f

+ 2
- 6
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java View File

17
 import com.reactnativenavigation.react.JsDevReloadHandler;
17
 import com.reactnativenavigation.react.JsDevReloadHandler;
18
 import com.reactnativenavigation.react.ReactGateway;
18
 import com.reactnativenavigation.react.ReactGateway;
19
 import com.reactnativenavigation.react.RedboxPermission;
19
 import com.reactnativenavigation.react.RedboxPermission;
20
-import com.reactnativenavigation.utils.IntentUtils;
21
 
20
 
22
 import java.util.List;
21
 import java.util.List;
23
 
22
 
36
     private ActivityParams activityParams;
35
     private ActivityParams activityParams;
37
     private ModalController modalController;
36
     private ModalController modalController;
38
     private Layout layout;
37
     private Layout layout;
39
-    private boolean waitingForNewJsContext = false;
40
 
38
 
41
     @Override
39
     @Override
42
     protected void onCreate(Bundle savedInstanceState) {
40
     protected void onCreate(Bundle savedInstanceState) {
43
         super.onCreate(savedInstanceState);
41
         super.onCreate(savedInstanceState);
44
 
42
 
45
         if (!NavigationApplication.instance.isReactContextInitialized()) {
43
         if (!NavigationApplication.instance.isReactContextInitialized()) {
46
-            waitingForNewJsContext = true;
47
-            finish();
48
-            startActivity(IntentUtils.getLauncherIntent());
44
+            NavigationApplication.instance.startReactContext();
49
             return;
45
             return;
50
         }
46
         }
51
 
47
 
108
     }
104
     }
109
 
105
 
110
     private void destroyJsIfNeeded() {
106
     private void destroyJsIfNeeded() {
111
-        if (!waitingForNewJsContext && (currentActivity == null || currentActivity.isFinishing())) {
107
+        if (currentActivity == null || currentActivity.isFinishing()) {
112
             NavigationApplication.instance.getReactGateway().onDestroyApp();
108
             NavigationApplication.instance.getReactGateway().onDestroyApp();
113
         }
109
         }
114
     }
110
     }

+ 1
- 6
android/app/src/main/java/com/reactnativenavigation/controllers/SplashActivity.java View File

15
     protected void onCreate(@Nullable Bundle savedInstanceState) {
15
     protected void onCreate(@Nullable Bundle savedInstanceState) {
16
         super.onCreate(savedInstanceState);
16
         super.onCreate(savedInstanceState);
17
         setSplashLayout();
17
         setSplashLayout();
18
-
19
-        if (NavigationApplication.instance.isReactContextInitialized()) {
20
-            finish();
21
-        } else {
22
-            NavigationApplication.instance.startReactContext();
23
-        }
18
+        NavigationApplication.instance.startReactContext();
24
     }
19
     }
25
 
20
 
26
     @Override
21
     @Override

+ 2
- 1
example-redux/package.json View File

3
   "version": "0.0.1",
3
   "version": "0.0.1",
4
   "private": true,
4
   "private": true,
5
   "scripts": {
5
   "scripts": {
6
-    "start": "watchman watch-del-all && node node_modules/react-native/local-cli/cli.js start"
6
+    "start": "watchman watch-del-all && adb reverse tcp:8081 tcp:8081 && node node_modules/react-native/local-cli/cli.js start",
7
+    "install:android": "pushd android && ./gradlew installDebug && popd"
7
   },
8
   },
8
   "dependencies": {
9
   "dependencies": {
9
     "react-native": "0.25.1",
10
     "react-native": "0.25.1",