react-native-navigation
react-native-navigation copied to clipboard
Navigation.push in sideMenu doesn't respect bottomTabs visibility options
🐛 Bug Report
Cannot hide bottomTabs when pushing to a new Bottom Tabs Screen from Side Menu.
Using Navigation.push() from any other Bottom Tabs screens passes bottomTabs: { visible: false }
but when calling from a Side Menu screen it does not.
This used to work in v4, but started migrating to v7 this week and blocked by this issue.
Any help or pointing to the right direction is appreciated.
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
Navigation.setRoot({
root: {
sideMenu: {
left: {
component: {
id: 'SideMenu',
name: 'Menu'
}
},
center: {
bottomTabs: {
children: [{
stack: {
children: [{
component: {
id: 'HOME_SCREEN',
name: 'Home'
}
}],
options: {
bottomTab: {
text: 'Home',
icon: require('./home.png')
}
}
}
}]
}
}
}
}
});
// calling this code from Side Menu won't apply visible: false
Navigation.push('HOME_SCREEN', {
component: {
name: 'Settings',
options: {
bottomTabs: {
visible: false
}
}
}
});
Tried to debug the native code and I believe the issue is related to topMostViewController
,
which got called in ReactNativeNavigation/RNNBasePresenter.m
hidesBottomBarWhenPushed
.
In that function, changing self.boundViewController.topMostViewController.resolveOptions
to self.boundViewController.resolveOptions
fixes the issue, but I'm afraid that it will have side effects.
When pushing inside Bottom Tabs from Bottom Tabs:
- topMostViewController.resolveOptions has a value of
bottomTabs.visible: NO
and - boundViewController.resolveOptions has a value of
bottomTabs.visible: NO
When pushing inside Bottom Tabs from Side Menu:
- topMostViewController.resolveOptions has a value of
bottomTabs.visible: nil
while - boundViewController.resolveOptions has a value of
bottomTabs.visible: NO
Because bottomTabs.visible: nil
, the code relies on self.defaultOptions
and during merge it sets bottomTabs.visible: YES
.
Expected behavior
When using Navigation.push method should respect options
property.
Actual Behavior
Passing options
property to Navigation.push doesn't get applied when push happens from Side Menu screen.
Your Environment
- React Native Navigation version: 7.11.0
- React Native version: 0.63.3
- Platform(s) (iOS, Android, or both?): iOS
- Device info (Simulator/Device? OS version? Debug/Release?): 14.4 Simulator and Device