timomeh / react-native-material-bottom-navigation

💅🔧👌 a beautiful, customizable and easy-to-use material design bottom navigation for react-native
MIT License
710 stars 127 forks source link

Call onTabChange with react-navigation #69

Closed aravindhkumar23 closed 6 years ago

aravindhkumar23 commented 6 years ago

Maybe it's not a bug,

I want to know the below 2 things, whether it's possible or not,

  1. is it possible to reload a view with data from API on clicking icons at the bottom? and how to call onTabChange with react-navigation.
  2. when I redirect to a page that contains the bottom navigation all tab bars are mounted is it possible to load view only when the tab bar is clicked?

i am using
"react-native-material-bottom-navigation": "^0.7.0", "react-navigation": "^1.0.0-beta.21",

timomeh commented 6 years ago

If you're using react-navigation, those questions are related to react-navigation and not to the Bottom Navigation, so searching for a solution in the BottomNavigation won't get you far. 🙃 But let me answer those questions nonetheless:

is it possible to reload a view with data from API on clicking icons at the bottom?

The logic behind views/screens and "what happens when a tab is clicked" is implemented in react-navigation. To solve this problem you need to check if react-navigation has some sort of checking if a Tab is re-clicked. Your last question is a bit related to that.

and how to call onTabChange with react-navigation.

You can't. When using react-navigation, onTabChange is connected with react-navigation and not accessible to you.

when I redirect to a page that contains the bottom navigation all tab bars are mounted is it possible to load view only when the tab bar is clicked?

I stumbled across this some time ago, too, and found this PR: https://github.com/react-navigation/react-navigation/pull/3345 It's merged, but there's no release yet.

Hope this helps you and points you to the right direction.