On iOS when you dismiss a Modal, the textColor on bottomstabs is reset to the default blue color.
You can repro this issue on the Playground App
1 - The textColor on Bottomtab is Purple.
2 - Go to the "Navigation" tab, openl and dimiss a Modal
3 - The textColor on Bottomtab is now Blue on the "Layouts" and "Options" tab.
No problem on V2.
This also happens on v2.27.9 - RN version 0.61.1 - iOS 13
I can confirm this is happening on both v2.27.9 and v3.2.0 using RN 0.59.10
Any chance of this getting higher priority? This is quite a fundamental feature...
I fixed using the didAppear listener. First I created a hook to manage:
export const useDidAppear = (handler, componentId) => {
useEffect(() => {
const listener = Navigation.events().registerComponentDidAppearListener(event => {
const equalComponentId = event.componentId === componentId;
if (equalComponentId) {
handler(event);
}
})
return () => listener.remove()
})
}
Then in the component inside the tab:
useDidAppear(() => {
Navigation.mergeOptions(componentId, {
bottomTab: {
iconColor: iconColor,
textColor: textColor,
selectedIconColor: selectedIconColor,
selectedTextColor:selectedTextColor,
}
})
}, componentId);
Hope it helps.
Pushing a modal probably overwrites the layoutOptions
which isn't reverted when it's dismissed. You can work around this by setting default colors:
Navigation.setDefaultOptions({
bottomTab: {
fontSize: 10,
selectedFontSize: 10,
selectedIconColor: COLORS.white,
selectedTextColor: COLORS.white,
iconColor: COLORS.greyMid,
textColor: COLORS.greyMid,
}
})
Yes I'm already using Navigation.setDefaultOptions for bottomTab but even with that the textColor is overwrited.
This also happens on v2.26.5 - RN version 0.55 - iOS 13.2
I found that this will not happen if you set:
Navigation.setDefaultOptions({
...
bottomTabs: {
...
backgroundColor: BACKGROUND_COLOR,
},
});
Omitting the backgroundColor
causes the problem.
It's fixed on 4.0.4 :)
@manuhook Are you sure its working for you without the backgroundColor
workaround?
I updated to 4.0.5 and cleaned the project but still having the same issue when not setting backgroundColor
I am still seeing this issue on 4.0.4
.
The only solution that reliably works for me is using componentDidAppear
(similar to jjfrutos) to reset the bottom tab color. Unfortunately that requires a lot of capy-paste code and there is also a momentary flicker in the tab color when the component first appears.
Yes my bad the problem is still there :(
However its seems now that I have only this bug when a non react-native-navigation modal is dismissed. For example when an AdMob interstitial is closed.
It also appears to still be an issue when you dismiss a fullScreen
react-native-navigation modal on iOS 13. I've noticed that on RN v0.61.5 and RNN v4.0.6
I'm unable to reproduce this in v5. @manuhook if this issue still reproduced with AdMob, can you please open a new issue and mention me? Thanks.
Most helpful comment
It also appears to still be an issue when you dismiss a
fullScreen
react-native-navigation modal on iOS 13. I've noticed that on RN v0.61.5 and RNN v4.0.6