【问题标题】:go to home screen in react navigation tabNavigator在反应导航 tabNavigator 中转到主屏幕
【发布时间】:2021-10-05 12:12:45
【问题描述】:

我正在实现 Tab navigator,如您所见,我在其中调用 stack navigator。

预期结果:当我从 Schedule Ride 转到 Pending 时,屏幕应该会转到 Ride 的初始屏幕,但它仍然存在安排行程。 Tabroute.js

<BottomTab.Navigator>
      <BottomTab.Screen
        name={navigationStrings.REQUEST}
        component={RequestStackComp}
      />
      <BottomTab.Screen
        name={navigationStrings.MORE}
        component={MoreStackComp}
      />
    </BottomTab.Navigator>

堆栈.js

export default function RequestStack() {
  return (
    <>
      <Stack.Screen
        name={navigationStrings.REQUEST}
        component={Request}
        options={{ headerShown: false }}
      />
      <Stack.Screen
        name="startBooking"
        component={StartBooking}
        options={{ headerShown: false }}
      />
      <Stack.Screen
        name="parking"
        component={Parking}
        options={{ headerShown: false }}
      />
      <Stack.Screen
        name={navigationStrings.RIDE_DETAILS}
        component={RideDetails}
        options={{ headerShown: false }}
      />
    </>
  );
}

【问题讨论】:

    标签: reactjs react-native react-native-android react-navigation


    【解决方案1】:

    把它放在底部标签屏幕选项中

    <BottomTab.Screen
            name={navigationStrings.REQUEST}
            component={RequestStackComp}
            options={{
              unmountOnBlur: true,
            }}
          />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-08
      • 1970-01-01
      • 1970-01-01
      • 2018-12-30
      • 1970-01-01
      • 2019-09-20
      相关资源
      最近更新 更多