Daniel Zlotin 7 лет назад
Родитель
Сommit
9af8b141b2

+ 1
- 1
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ScreenLifecycleTest.java Просмотреть файл

@@ -5,7 +5,6 @@ import android.support.test.uiautomator.By;
5 5
 import org.junit.Ignore;
6 6
 import org.junit.Test;
7 7
 
8
-@Ignore
9 8
 public class ScreenLifecycleTest extends BaseTest {
10 9
 
11 10
 	@Test
@@ -19,6 +18,7 @@ public class ScreenLifecycleTest extends BaseTest {
19 18
 	}
20 19
 
21 20
 	@Test
21
+	@Ignore
22 22
 	public void unmountIsCalledWhenPopped() throws Exception {
23 23
 		launchTheApp();
24 24
 		assertMainShown();

+ 16
- 26
lib/android/app/src/main/java/com/reactnativenavigation/layout/ReactRootViewController.java Просмотреть файл

@@ -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