Closed akhilesh08061 closed 6 years ago
If you use onPress
, you have to handle activeTab
by yourself. See this working example: https://snack.expo.io/rJzZgos7f
The docs are very explicit about this behavior:
Function to be called when the Tab was pressed. When you use this, the pressed tab won't be active automatically. You need to set it to active by updating
BottomNavigation.activeTab
.
I would advise against using onPress
and recommend using onTabChange
. The onPress
prop exists mainly to support react-navigation.
Thank you very much.i will try your solution.
onTabChange is perfectly working in react native material bottom navigation.but as given in a documentation that you can even use onPress on individual tabs.but it is not working for my case. example:-
<BottomNavigation> <Tab onPress={(newTabIndex)=>console.log(newTabIndex)} label="movie" icon={<Image src={require("image address")}/> } /> </BottomNavigation>