I am using createMaterialBottomTabNavigator
and I want to pass parameters to the routes:
return (
<Tab.Navigator initialRouteName="Home">
<Tab.Screen name="Home" component={home_customers} />
<Tab.Screen name="Favorites" component={favorite_vendors} />
<Tab.Screen name="More" component={settings_screen} />
</Tab.Navigator>
);
I could only find an attribute called initialParams
which I am not sure if it is the right thing to use in this case. So, what I want to do is to GET parameters from the previous screen and PASS that parameter to each of these three screens!
UPDATE
ok, I found out how to GET the parameters but I still don't know how to pass those parameters to route screens!
export default function home_customers_bar({ route, navigation }) {
const current_city_ = route.params.current_user_city_; //here I get the parameter from the previous screen
return (
<Tab.Navigator initialRouteName="Home">
<Tab.Screen name="Home" component={home_customers} />
<Tab.Screen name="Favorites" component={favorite_vendors} />
<Tab.Screen name="More" component={settings_screen} />
</Tab.Navigator>
);
}
initialParams
for each screen, but this is of course not a good way to do it if all screens need to accesscurrent_city_
– Dropsy