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

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

@@ -15,12 +15,7 @@ public abstract class SplashActivity extends AppCompatActivity {
15 15
     protected void onCreate(@Nullable Bundle savedInstanceState) {
16 16
         super.onCreate(savedInstanceState);
17 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 21
     @Override

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

@@ -3,7 +3,8 @@
3 3
   "version": "0.0.1",
4 4
   "private": true,
5 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 9
   "dependencies": {
9 10
     "react-native": "0.25.1",