如何隐藏我的React导航抽屉中的链接?

时间:2019-05-04 12:50:58

标签: react-native navigator drawer

所以我有一个反应式导航抽屉,我无法设法找出如何在抽屉中隐藏链接。 我有几个指向其他屏幕的链接,但我不希望它们全部可见。 这是我的代码:

const AppDrawerNavigator = createDrawerNavigator({
  Home: drawer,
  Play: PlayScreen,
  Gall: Gallery,
  PlayerInput: PlayerInput,
  Cam: OpenCamera,
  srollView: ScrollView,
  Profil: Profil,
})
export default class HomeScreen extends React.Component {
    render() {
    return (
      <View style={styles.full}>
        <AppDrawerNavigator/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
   full: {
   flex: 1,
   backgroundColor: '#458680',
   flexDirection:'column'
 },
});

有什么主意吗?谢谢!

1 个答案:

答案 0 :(得分:0)

在代码中进行以下更改:

const AppDrawerNavigator = createDrawerNavigator({
  Home: drawer,
  Play: PlayScreen,
  Gall: Gallery,
  PlayerInput: PlayerInput,
  Cam: OpenCamera,
  srollView: ScrollView,
  Profil: Profil,
},
{
    contentComponent: DrawerContent,
}
)

const DrawerContent = (props) => (
  <View>
    <View
      style={{
        height: '100%',
        backgroundColor: '#458680',
      }}
    >
      //Your code here whatever you wanna display
    </View>
    <DrawerItems {...props} />
  </View>
)