Browse Source

Parent options are cleared when child appears

Guy Carmeli 6 years ago
parent
commit
2908d3bc1d

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ParentController.java View File

@@ -75,7 +75,7 @@ public abstract class ParentController<T extends ViewGroup> extends ViewControll
75 75
 	}
76 76
 
77 77
     void clearOptions() {
78
-
78
+        options = initialOptions.copy();
79 79
     }
80 80
 
81 81
     public void setupTopTabsWithViewPager(ViewPager viewPager) {

+ 1
- 0
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ParentControllerTest.java View File

@@ -124,6 +124,7 @@ public class ParentControllerTest extends BaseTest {
124 124
         child1.onViewAppeared();
125 125
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
126 126
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
127
+        verify(uut, times(1)).clearOptions();
127 128
         verify(uut, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
128 129
         assertThat(optionsCaptor.getValue().topBarOptions.title.get()).isEqualTo("new title");
129 130
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());