瀏覽代碼

Add is ReactInstanceManager initialised

Guy Carmeli 8 年之前
父節點
當前提交
f62e09ab5e

+ 5
- 1
android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java 查看文件

@@ -25,6 +25,7 @@ public abstract class NavigationApplication extends Application {
25 25
         super.onCreate();
26 26
         instance = this;
27 27
         handler = new Handler(getMainLooper());
28
+        navigationReactInstance = new NavigationReactInstance();
28 29
     }
29 30
 
30 31
     public void runOnMainThread(Runnable runnable) {
@@ -72,6 +73,10 @@ public abstract class NavigationApplication extends Application {
72 73
         return navigationReactInstance.getReactInstanceManager().getCurrentReactContext();
73 74
     }
74 75
 
76
+    public boolean isReactInstanceManagerInitialized() {
77
+        return navigationReactInstance.getReactInstanceManager() != null;
78
+    }
79
+
75 80
     public abstract boolean isDebug();
76 81
 
77 82
     @NonNull
@@ -90,7 +95,6 @@ public abstract class NavigationApplication extends Application {
90 95
     }
91 96
 
92 97
     public void startReactContext() {
93
-        navigationReactInstance = new NavigationReactInstance();
94 98
         navigationReactInstance.startReactContextOnceInBackgroundAndExecuteJS();
95 99
     }
96 100
 }

+ 1
- 3
android/app/src/main/java/com/reactnativenavigation/controllers/SplashActivity.java 查看文件

@@ -5,7 +5,6 @@ import android.os.Bundle;
5 5
 import android.support.annotation.Nullable;
6 6
 import android.support.v7.app.AppCompatActivity;
7 7
 import android.view.View;
8
-import android.widget.Toast;
9 8
 
10 9
 import com.reactnativenavigation.NavigationApplication;
11 10
 
@@ -17,8 +16,7 @@ public abstract class SplashActivity extends AppCompatActivity {
17 16
         NavigationApplication.instance.startReactContext();
18 17
         //TODO show fancy splash
19 18
         View view = new View(this);
20
-        view.setBackgroundColor(Color.RED);
19
+        view.setBackgroundColor(Color.WHITE);
21 20
         setContentView(view);
22
-        Toast.makeText(this, "Loading navigation...", Toast.LENGTH_LONG).show();
23 21
     }
24 22
 }