Hi is that possible to pass certain parameter when pressing the TabBar?
Currently I have an administrator who could view lists of data in ProfileScreenPrimary, and then when he click the list he will go to profilescreen secondary that show details of the data from parameter
it works fine
and then i made a route for customer that will skip the profilescreenprimary and will go to profilescreensecondary. but it got error which is the route.params is undefined, is there any way to pass the parameter / replace the parameters with context that i provide?
function BottomTabNavigator() {
return (
<Tab.Navigator>
<Tab.Screen
name="Profile"
component={ProfileStackScreen}
options={{
tabBarLabel: 'PROFILE',
tabBarIcon: ({color, size}) => (
<Icon name="git-branch" color={color} size={25} />
),
}}
/>
<another tab....>
</Tab.Navigator>
);
}
this is my profileStackScreen
function ProfileStackScreen({navigation, route}) {
const {myContext}=useContext(MYCONTEXT)
return (
{
myContext.role = 'admin' && (
<Stack.Screen
name="ProfileScreenPrimary"
component={ProfileScreenPrimary}
options={({route}) => ({
title: 'List'
headerTitleStyle: headerTitleStyle,
})}
/>
)
}
<Stack.Screen
name="ProfileScreenSecondary"
component={ProfileScreenSecondary}
options={({route}) => ({
title: `${!route.params.ProfileName ? myContext.profileName : route.params.ProfileName}`, -> this return route.params.ProfileName is undefined
headerTitleStyle: headerTitleStyle,
})}
/>
<otherstack>
)