Browse Source

Explicitly clear bottom tabs options after mergeOptions (#5107)

When mergeOptions was called on a root view, it’s one time options weren’t cleared properly.
The entire one time options logic is terrible and has to be refactored out.

Fixes #5010
Guy Carmeli 5 years ago
parent
commit
cd182f4693
No account linked to committer's email address

+ 2
- 0
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java View File

@@ -97,6 +97,8 @@ public class BottomTabsController extends ParentController implements AHBottomNa
97 97
     public void mergeOptions(Options options) {
98 98
         presenter.mergeOptions(options);
99 99
         super.mergeOptions(options);
100
+        this.options.bottomTabsOptions.clearOneTimeOptions();
101
+        this.initialOptions.bottomTabsOptions.clearOneTimeOptions();
100 102
     }
101 103
 
102 104
     @Override

+ 0
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.java View File

@@ -25,7 +25,6 @@ import com.reactnativenavigation.utils.ImageLoader;
25 25
 import com.reactnativenavigation.utils.OptionHelper;
26 26
 import com.reactnativenavigation.utils.ViewUtils;
27 27
 import com.reactnativenavigation.viewcontrollers.ChildControllersRegistry;
28
-import com.reactnativenavigation.viewcontrollers.ParentController;
29 28
 import com.reactnativenavigation.viewcontrollers.ViewController;
30 29
 import com.reactnativenavigation.viewcontrollers.stack.StackController;
31 30
 import com.reactnativenavigation.views.BottomTabs;
@@ -93,7 +92,6 @@ public class BottomTabsControllerTest extends BaseTest {
93 92
         presenter = spy(new BottomTabsPresenter(tabs, new Options()));
94 93
         tabsAttacher = spy(new BottomTabsAttacher(tabs, presenter));
95 94
         uut = createBottomTabs();
96
-        uut.setParentController(Mockito.mock(ParentController.class));
97 95
         activity.setContentView(uut.getView());
98 96
     }
99 97
 

+ 1
- 1
playground/src/services/Navigation.js View File

@@ -25,7 +25,7 @@ const dismissOverlay = (name) => Navigation.dismissOverlay(name);
25 25
 
26 26
 const popToRoot = (self) => Navigation.popToRoot(self.props.componentId);
27 27
 
28
-const mergeOptions = (self, options) => Navigation.mergeOptions(self.props.componentId, options);
28
+const mergeOptions = (selfOrCompId, options) => Navigation.mergeOptions(compId(selfOrCompId), options);
29 29
 
30 30
 const setStackRoot = (self, root) => Navigation.setStackRoot(self.props.componentId, root)
31 31