Search code examples
reactjsreact-nativereact-navigationreact-navigation-stackreact-navigation-bottom-tab

Navigate to nested screen react native


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


Solution

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