React native 如何把抽屉藏在抽屉里?

React native 如何把抽屉藏在抽屉里?,react-native,react-native-router-flux,React Native,React Native Router Flux,嘿,我正在使用react原生项目,我正在使用react路由器流量进行导航,我使用抽屉,所以如何在一些屏幕中禁用抽屉?像登录屏幕 我尝试了DroperLockMode={'lock-closed'},但它不起作用 这是麦可德 <RouterRedux backAndroidHandler={() => {}}> <Drawer> <Scene key="root" hideNavBar transitionConfig={trans

嘿,我正在使用react原生项目,我正在使用react路由器流量进行导航,我使用抽屉,所以如何在一些屏幕中禁用抽屉?像登录屏幕

我尝试了DroperLockMode={'lock-closed'},但它不起作用

这是麦可德

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

您需要在主体场景中编写抽屉锁模式。。诸如此类

<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>
{}>
>
{/**/}

我希望我帮助过……:)

您需要在主体场景中写入抽屉锁模式。。诸如此类

<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>
{}>
>
{/**/}

我希望我帮助过……:)

您是否尝试将
drawerLockMode
传递到每个场景?是的,我尝试过,但不起作用。您能否显示您迄今为止尝试过的内容并将其放入上述代码中?我的意思是为禁用的场景传递
lock closed
,为启用的场景传递
unlock
。您是否尝试将
drawerLockMode
传递到每个场景?是的,我尝试过,但不起作用。您能否显示您迄今为止所尝试的内容并将其放入上述代码中?我的意思是对禁用的场景传递
lock closed
,对启用的场景传递
unlock