如何隐藏抽屉中的反应路由器流量?

问题描述 投票:1回答:1

[嘿,我正在与React Native项目一起工作,我正在使用React Router流量进行导航,并且我使用了Drawer,所以我如何在某些屏幕上禁用抽屉?喜欢登录屏幕吗?

我尝试了drawerLockMode = {'锁关闭'},但它不起作用

这里是mycode

 <RouterRedux backAndroidHandler={() => {}}>
      <Drawer>
        <Scene key="root" hideNavBar transitionConfig={transitionConfig}>
          <Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
          <Scene
            initial
            key="CheckAuth"
            component={CheckAuth}
            type={ActionConst.RESET}
          />
          <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>
      </Drawer>
    </RouterRedux>
react-native react-native-router-flux
1个回答
0
投票

您需要在主体场景中编写抽屉锁模式。。类似这样

<RouterRedux backAndroidHandler={() => {}}>
  <Drawer>
    <Scene 
       key="root" 
       hideNavBar 
       transitionConfig={transitionConfig}
       drawerLockMode='locked-closed' //New line
     >
      <Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
      <Scene
        initial
        key="CheckAuth"
        component={CheckAuth}
        type={ActionConst.RESET}
      />
      <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>
  </Drawer>
</RouterRedux>

如果要锁定/解锁不同的场景,则需要与父场景分开,每个要锁定/解锁抽屉的场景组...

<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>

我希望我有所帮助...:)

© www.soinside.com 2019 - 2024. All rights reserved.