【发布时间】:2021-12-12 09:56:53
【问题描述】:
有人可以告诉我如何隐藏底部导航中显示的选项卡,我想从代码跳转到选项卡,但我不希望它显示在底部导航中。下面是我正在使用的一些代码,我只想从底部隐藏 vehicle_edit 选项卡,但我想通过 jumpTo 在我的代码中继续使用它,
如果有人可以建议。
//routes
const [routes] = React.useState([
{ key: "dashboard", title: "Dashboard", icon: "home" },
{ key: "notifications", title: "Notifications", icon: "bell" },
{ key: "account", title: "My Account", icon: "account" },
{ key: "vehicle_edit", title: "Vehicles", icon: "car" },
{ key: "appointments", title: "Appointments", icon: "calendar" },
]);
//set bottom tab to first always
useEffect(() => {
setIndex(0);
}, []);
//screens
const renderScene = BottomNavigation.SceneMap({
dashboard: DashboardScreen,
notifications: NotificationsScreen,
account: AccountScreen,
vehicle_edit: VehicleEditScreen,
appointments: AppointmentsScreen,
});
//render
return <BottomNavigation navigationState={{ index, routes }} onIndexChange={setIndex} renderScene={renderScene} />;
【问题讨论】:
标签: reactjs react-native react-native-paper