I'm trying to create something like Instagram. When tab is active and you press on it's icon, it refreshes.
<Scene key = "tabBar" tabs>
<Scene key = "news" onPress = { () => {
if (this.state.active[0]) { //if this tab is active
refreshNews(); //fetching to get new data
} else {
this.setState({active: [true, false, false, false]});
Actions.news(); // just open this tab
}
}}>
...
</Scene>
....
</Scene>
In previous version (3.37.0 for example) everithing worked fine.
In current version onPress function is not performed.
So do I need to downgrade the version or are there any other solutions?
Unfortunately v4 tabbar is breaking change (because it is based on react-navigation TabNavigator now). It looks like duplicate of https://github.com/react-community/react-navigation/issues/314, please check maxmcd's workaround from there. I think we could integrate it somehow into RNRF, need to think about it. PR is welcome.
Btw, you may use onEnter handler for each tab scene if you need to do some actions when tab is selected.
Closing this ticket because onEnter should be enough.