Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 从抽屉驱动装置上拆下滤网_Reactjs_React Native_React Navigation - Fatal编程技术网

Reactjs 从抽屉驱动装置上拆下滤网

Reactjs 从抽屉驱动装置上拆下滤网,reactjs,react-native,react-navigation,Reactjs,React Native,React Navigation,我有react navigation v2和drawerNavigator的react本机问题。实际上,我希望drawerNavigator(标题)显示在屏幕上,但我不希望drawer中的页面显示出来 这是我的主抽屉,我想把它也显示在ActionPage上,但我不想让里面有动作 const MainDrawer = DrawerNavigator( { Home: { screen: HomeStack, navigationOptions: {

我有react navigation v2和drawerNavigator的react本机问题。实际上,我希望drawerNavigator(标题)显示在屏幕上,但我不希望drawer中的页面显示出来

这是我的主抽屉,我想把它也显示在ActionPage上,但我不想让里面有动作

    const MainDrawer = DrawerNavigator(
  {
    Home: {
      screen: HomeStack,
      navigationOptions: {
        title: 'POČETNA',
      }
    },
    OrderP: {
      screen: OrderStack,
      navigationOptions: {
        title: 'NARUČI',
      }
    },
    CatalogP: {
      screen: CatalogStack,
      navigationOptions: {
        title: 'KATALOZI',
      }
    },
    InstructionP: {
      screen: InstructionStack,
      navigationOptions: {
        title: 'UPUTSTVO ZA PORUČIVANJE',
      }
    },
    InfoP: {
      screen: InfoStack,
      navigationOptions: {
        title: 'INFORMACIJE O APLIKACIJI'
      }
    },
    ActionP: {
      screen: ActionStack,
      navigationOptions: {
        header: null,
        title: ''
      }
    }
  }
);
和根堆栈:

const RootStack = StackNavigator(
  {
    MainDrawer: {
      screen: MainDrawer,
    },
    Contact: {
      screen: ContactPage
    },
    ActionP: {
      screen: ActionPage
    },
    News: {
      screen: NewsPage
    }
  },
  {
    headerMode: 'none'
  }
);

为了隐藏所需的页面,可以修改以下代码:

// this const is used to hide desired pages
const hiddenDrawerItems = [
  'Home',
  'Profile',
]

const MainDrawer = createDrawerNavigator(
  {
    Home: { screen: HomePage },
    Profile: { screen: ProfilePage },
    // other pages
  },
  {
    // this entry is used to actually hide you pages
    contentComponent: (props) => {
      const clonedProps = {
        ...props,
        items: props.items.filter(item => !hiddenDrawerItems.includes(item.key)),
      }
      return <DrawerPage {...clonedProps} />
    },
  },
)
//此常量用于隐藏所需的页面
常数hiddendrawritems=[
“家”,
"简介",,
]
const main drawer=createDrawerNavigator(
{
主页:{屏幕:主页},
配置文件:{screen:ProfilePage},
//其他页面
},
{
//此条目用于实际隐藏页面
contentComponent:(道具)=>{
常数clonedProps={
…道具,
items:props.items.filter(item=>!hiddendrawritems.includes(item.key)),
}
返回
},
},
)