如何在我的 React 导航抽屉中隐藏链接?
How can I hide links in my react navigation drawer?
所以我有一个 React 导航抽屉,但我无法找出如何隐藏抽屉中的链接。
我有几个指向其他屏幕的链接,但我不想让它们全部可见。
这是我的代码:
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'
},
});
有什么想法吗?谢谢!
在您的代码中进行以下更改:
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>
)
所以我有一个 React 导航抽屉,但我无法找出如何隐藏抽屉中的链接。 我有几个指向其他屏幕的链接,但我不想让它们全部可见。 这是我的代码:
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'
},
});
有什么想法吗?谢谢!
在您的代码中进行以下更改:
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>
)