简体   繁体   English

go 到 React 导航选项卡 Navigator 中的主屏幕

[英]go to home screen in react navigation tabNavigator

I am implementing Tab navigator where I am calling stack navigator inside as you can see.我正在实现 Tab 导航器,如您所见,我在其中调用堆栈导航器。

expected result : when I go from Schedule Ride to Pending , the screen should go to the initial screen of the Ride but it remains on Schedule Ride .预期结果:当我 go 从Schedule RidePending时,屏幕应该 go 到 Ride 的初始屏幕,但它仍然在Schedule Ride上。 Tabroute.js Tabroute.js

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

Stack.js堆栈.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 }}
      />
    </>
  );
}

演示

Put this in bottom tab screen option将此放在底部选项卡屏幕选项中

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM