|
@@ -7,6 +7,7 @@ import android.view.View;
|
7
|
7
|
|
8
|
8
|
import com.facebook.react.ReactInstanceManager;
|
9
|
9
|
import com.facebook.react.ReactRootView;
|
|
10
|
+import com.reactnativenavigation.react.NavigationEvent;
|
10
|
11
|
import com.reactnativenavigation.viewcontrollers.ViewController;
|
11
|
12
|
|
12
|
13
|
public class ReactRootViewController extends ViewController {
|
|
@@ -26,33 +27,22 @@ public class ReactRootViewController extends ViewController {
|
26
|
27
|
// reactRootView.unmountReactApplication();
|
27
|
28
|
// }
|
28
|
29
|
|
29
|
|
-// @Override
|
30
|
|
-// public void onViewAttachedToWindow(final View v) {
|
31
|
|
-// //
|
32
|
|
-// }
|
33
|
|
-//
|
34
|
|
-// @Override
|
35
|
|
-// public void onViewDetachedFromWindow(final View v) {
|
36
|
|
-// onStop();
|
37
|
|
-// }
|
38
|
|
-//
|
39
|
|
-// private void onStart() {
|
40
|
|
-// new NavigationEvent(reactInstanceManager.getCurrentReactContext()).containerStart(id);
|
41
|
|
-// }
|
42
|
|
-//
|
43
|
|
-// private void onStop() {
|
44
|
|
-// new NavigationEvent(reactInstanceManager.getCurrentReactContext()).containerStop(id);
|
45
|
|
-// }
|
|
30
|
+ @Override
|
|
31
|
+ public void onAppear() {
|
|
32
|
+ super.onAppear();
|
|
33
|
+ new NavigationEvent(reactInstanceManager.getCurrentReactContext()).containerStart(getId());
|
|
34
|
+ }
|
46
|
35
|
|
47
|
|
-// @Override
|
48
|
|
-// public void onStart() {
|
49
|
|
-// super.onStart();
|
50
|
|
-// if (attachedToReactInstance) {
|
51
|
|
-// new NavigationEvent(reactInstanceManager.getCurrentReactContext()).containerStart(id);
|
52
|
|
-// } else {
|
53
|
|
-// throw new RuntimeException("Not yet attached to react");
|
54
|
|
-// }
|
55
|
|
-// }
|
|
36
|
+ @Override
|
|
37
|
+ public void onDisappear() {
|
|
38
|
+ super.onDisappear();
|
|
39
|
+ new NavigationEvent(reactInstanceManager.getCurrentReactContext()).containerStop(getId());
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ @Override
|
|
43
|
+ protected boolean isViewShown() {
|
|
44
|
+ return super.isViewShown() && attachedToReactInstance;
|
|
45
|
+ }
|
56
|
46
|
|
57
|
47
|
@NonNull
|
58
|
48
|
@Override
|