导航到嵌套屏幕反应本机

Navigate to nested screen react native

我有一个像这样的底部标签导航器:

const Tab = BottomTabNavigator()

const BottomTab = () => (

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

提要组件是一个 Stack 导航器,如下所示:

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

我如何从个人资料屏幕导航到 FeedNavigator 中的 Food 组件并将道具传递给它

navigation.navigate('Feed', { 屏幕: 'Food', 参数: { 用户: 'jane'}, });

您可以使用以下代码在嵌套导航器中导航。

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