Browse Source

Fix react-native-youtube support (#6220)

Support for the react-native-youtube package was added in #5999 but due to a faulty merge it wasn't complete.

Fixes #6214
Guy Carmeli 4 years ago
parent
commit
4d8d2ae40a
No account linked to committer's email address

+ 3
- 2
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java View File

@@ -1,6 +1,7 @@
1 1
 package com.reactnativenavigation.viewcontrollers.navigator;
2 2
 
3 3
 import android.app.Activity;
4
+import android.view.View;
4 5
 import android.view.ViewGroup;
5 6
 
6 7
 import com.facebook.react.ReactInstanceManager;
@@ -63,8 +64,8 @@ public class Navigator extends ParentController {
63 64
     public void setContentLayout(ViewGroup contentLayout) {
64 65
         this.contentLayout = contentLayout;
65 66
         contentLayout.addView(rootLayout);
66
-        contentLayout.addView(modalsLayout);
67
-        contentLayout.addView(overlaysLayout);
67
+        modalsLayout.setVisibility(View.GONE); contentLayout.addView(modalsLayout);
68
+        overlaysLayout.setVisibility(View.GONE); contentLayout.addView(overlaysLayout);
68 69
     }
69 70
 
70 71
     public Navigator(final Activity activity, ChildControllersRegistry childRegistry, ModalStack modalStack, OverlayManager overlayManager, RootPresenter rootPresenter) {

+ 8
- 0
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java View File

@@ -124,6 +124,14 @@ public class NavigatorTest extends BaseTest {
124 124
         uut.setContentLayout(contentLayout);
125 125
     }
126 126
 
127
+    @Test
128
+    public void setContentLayout_modalAndOverlayLayoutsAreGONE() {
129
+        ViewGroup contentLayout = Mockito.mock(ViewGroup.class);
130
+        uut.setContentLayout(contentLayout);
131
+        assertThat(uut.getModalsLayout().getVisibility()).isEqualTo(View.GONE);
132
+        assertThat(uut.getOverlaysLayout().getVisibility()).isEqualTo(View.GONE);
133
+    }
134
+
127 135
     @Test
128 136
     public void bindViews() {
129 137
         verify(rootPresenter).setRootContainer(uut.getRootLayout());