相关疑难解决方法(0)

React Navigation 5 隐藏抽屉项目

我试图隐藏在抽屉导航器中按下我的一个路线的能力,因为它是另一个导航器和应用程序中的默认位置。我希望抽屉仅用于导航到不适合其他地方的用户流程的无关路线。在 React Navigation 5 之前,我可以通过简单地设置drawerLabel: () => null. 但是现在有了变化,我无法弄清楚如何以相同的方式隐藏它。

以下是我当前的导航器代码:

const DrawerNavigator = () => {
    const dispatch = useDispatch();
    return (
    <MainDrawerNavigator.Navigator 
        drawerContent={props => customDrawerContent(props, dispatch)}
        drawerStyle={drawerStyle}
    >
        <MainDrawerNavigator.Screen 
            name="DrawerNav"
            component={MainTabNavigator}
            options={{
                drawerLabel: () => null,
                title: null,
                drawerIcon: () => null
            }}
        />

        <MainDrawerNavigator.Screen
            name="FAQNav"
            component={FAQStackNavigator}
            options={
                { 
                    drawerLabel: "FAQ", 
                    drawerIcon: ({tintColor}) => <EvilIcons name={'question'} size={30} color={tintColor} />
                }
            }
        />
    </MainDrawerNavigator.Navigator>
    )
}

const customDrawerContent = (props, dispatch) => {
    console.log(props.descriptors)
    return (
        <View style={{flex: …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation react-navigation-drawer react-navigation-v5

12
推荐指数
4
解决办法
2万
查看次数