0

I have a bottom tab navigator like so:

const Tab = BottomTabNavigator()

const BottomTab = () => (

  <Tab.Navigator>
    <Tab.Screen name = "Feed" component = {FeedNavigator}/>
    <Tab.Screen name = "Profile" component = {Profile}/>
  <Tab.Navigator>
)

The feed component is a Stack navigator like so:

const FeedNavigator = () => {
  return (
    <Stack.Navigator> 
      <Stack.Screen name = "Food" component = {Food}/>
      <Stack.Screen name = "MainFeed" component = {MainFeed}/>
    </Stack.Navigator>
  )
}

how do i navigate from my Profile screen to the Food component inside the FeedNavigator and pass props to it

Harold Obasi
  • 13
  • 1
  • 4

2 Answers2

0

navigation.navigate('Feed', { screen: 'Food', params: { user: 'jane'}, });

  • the problem with this is that now everytime you try to access Feed from anywhere in the app it will automatically redirect you to Food – OneTuskedMario Oct 23 '22 at 20:02
0

You can navigate in a nested navigator using below code.

navigation.navigate('Feed',{ screen: 'Food',params : {}})
Muhammad Ashfaq
  • 2,359
  • 5
  • 20
  • 46