在特定屏幕上隐藏抽屉

时间:2020-02-26 17:47:18

标签: react-native react-native-router-flux react-navigation-drawer

嘿,我正在与一个使用React Router流量进行导航的react native项目一起工作,一切正常,除了我想从登录屏幕和tuto屏幕隐藏抽屉 这是下面的代码

Other Linker Flags

那么我如何在登录屏幕和tuto屏幕上隐藏抽屉?

1 个答案:

答案 0 :(得分:0)

我找到了锁定抽屉的方法,并且对显示锁定/解锁变量进行了一些更改。 您需要将抽屉锁和另一组(未锁)的场景分开,就像这样……

<RouterRedux backAndroidHandler={() => { }}>
    <Drawer
        hideNavBar
        open={false}
        key="drawer"
        contentComponent={SideBar}
        drawerWidth={300}
    // drawerLockMode={show ? 'locked-closed' : 'unlocked'}>
    >
        <Scene
            key="root" hideNavBar
            transitionConfig={transitionConfig}
            drawerLockMode='locked-closed'
        >
            <Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
            <Scene
                initial
                key="CheckAuth"
                component={CheckAuth}
                type={ActionConst.RESET}
            />
        </Scene>
        <Scene
            key="root2"
            hideNavBar
            transitionConfig={transitionConfig}
            drawerLockMode='unlocked'
        >
            {/*<Scene key="WIP" component={WorkInProgress} />*/}
            <Scene key="SignIn" component={SignIn} />
            <Scene key="ResetPassword" component={ResetPassword} />
            <Scene key="Visits" component={Visits} />
            <Scene key="VisitDetails" component={VisitDetails} />
            <Scene key="Statistiques" component={Statistiques} />
            <Scene key="Notification" component={Notification} />
            <Scene key="Sync" component={Sync} />
        </Scene>
    </Drawer>
</RouterRedux>