[V2] topBar passProps lost after navigating back for custom component
It looks like this was originally reported in https://github.com/wix/react-native-navigation/issues/3803 but the issue was closed as it was reported in 2.0 and commenters saying it might be fixed in later versions but I'm on 2.15.0 and it is still happening.
Steps to Reproduce / Code Snippets / Screenshots
Basically the first time the passProps of 'Goals' below works correctly. Then if you navigate away and then via the bottomTabs tap it again, the passProps are missing.
const homeRoot = {
bottomTabs: {
id: 'BottomTabsId',
options: {
bottomTabs: {
currentTabIndex: 0
}
},
children: [
{
stack: {
children: [{
component: {
name: screens.GOALS_CONTAINER,
options: {
topBar: {
title: {
component: {
name: screens.HEADER_TITLE_WITH_WEEK,
passProps: {
label: 'Goals'
},
}
},
leftButtons: [],
rightButtons: [commonNavigation.agentButtonConfig],
},
bottomTab: {
icon: NavIconGoals,
selectedIconColor: blue2,
iconInsets: { top: 0, left: 0, bottom: -8, right: 0 },
titleDisplayMode: 'alwaysHide',
},
},
},
}]
}
},
...
]
}
Navigation.setRoot({ root: homeRoot })
Environment
- React Native Navigation version: 2.15.0
- React Native version: 0.57.0
- Platform(s) (iOS, Android, or both?): IOS (haven't checked Android)
- Device info (Simulator/Device? OS version? Debug/Release?): Simulator
Seeing the same issue in IOS as well with our custom topbar. First rendering works and sets the text than when I navigate to the next page and come back the text shows for a moment and then disappears.
"react-native": "0.59.2", "react-native-navigation": "2.15.0", IOS Iphone X 12.2 emulation.
Could be related to this: https://github.com/wix/react-native-navigation/pull/4929
Should be resolved by #4942, published in 2.17.0
@guyca I was having this issue as well, until I upgraded to 2.17.0 and it worked!... in the simulator only 😞 When I try this on my iPhone, I'm seeing the error again (works on Android).
Simulator:

Physical device:

Any thoughts here?
Actually custom components are completely not working for me in 2.17.0 (via mergeOptions). Perhaps it makes sense to roll back to the earlier code (before the two breaking changes) and only commit once it's properly tested?
@jfrolich What isn't working? @andresfcamacho can you please try v2.17.0-snapshot.281 ?
cc @yogevbd
For whatever reason, my post from before is no longer an issue. The title in my topBar stays as it should.
A quick note - as I was testing out v2.17.0-snapshot.281, my bottom tabs currentTabIndex wasn't working as expected. The following code no longer selected the right index.
Navigation.mergeOptions('BottomTabsId', {
bottomTabs: {
currentTabIndex: 2
}
})
This is not related to the original thread, so no need to respond to this, but in case this was an unexpected side effect of the snapshot, I wanted to share. I reverted the upgrade and the issue went away.
@adamgrossman Can you please try with 2.17.0-snapshot.283? I believe that was fixed yesterday.
@jfrolich What isn't working? @andresfcamacho can you please try v2.17.0-snapshot.281 ?
cc @yogevbd
Sorry about my reaction, thank you for maintaining the project, I was just a bit frustrated about stuff breaking.
It doesn't show the custom component for me anymore in 2.17.0 (props changed, and topbar visibility set using mergeOptions). I'll try to reproduce it.
@jfrolich Can you please try version 2.17.0-snapshot.283? The issue should be fixed there.
No worries, I understand the frustration