NativeBase 抽屉道具
NativeBase Drawer Props
是否可以在抽屉的侧边栏传递道具(侧边栏是我的自定义组件)。在此示例中,测试道具未显示在 SideBar
中
render () {
const sideBar = <SideBar onRest={this.changeToRest} test="12" />
return (
<Drawer ref={ref => (this.drawer = ref)} content={sideBar}>
....
是的,可以将道具传递给侧边栏自定义组件
<SideBar onRest={this.changeToRest} test="12" />
1.Here you can pass the test="12" as a props
2.You can get the props at the sidebar component {this.props.test} like that
您可以像下面这样将 Sidebar 组件添加到 Drawer DrawerNavigator
const DrawerNav = DrawerNavigator({
MainScreen: {
screen: TabNav
},
ProfileScreen: {
screen: ProfileNav
},
NotificationScreen : {
screen: NotificationNav
},
RewardScreen: {
screen : RewardNav
}
},{
drawerPosition: 'left',
initialRouteName: 'MainScreen',
contentComponent: props => <SideBarNav {...props} test="12"/>
});
是否可以在抽屉的侧边栏传递道具(侧边栏是我的自定义组件)。在此示例中,测试道具未显示在 SideBar
中render () {
const sideBar = <SideBar onRest={this.changeToRest} test="12" />
return (
<Drawer ref={ref => (this.drawer = ref)} content={sideBar}>
....
是的,可以将道具传递给侧边栏自定义组件
<SideBar onRest={this.changeToRest} test="12" />
1.Here you can pass the test="12" as a props
2.You can get the props at the sidebar component {this.props.test} like that
您可以像下面这样将 Sidebar 组件添加到 Drawer DrawerNavigator
const DrawerNav = DrawerNavigator({
MainScreen: {
screen: TabNav
},
ProfileScreen: {
screen: ProfileNav
},
NotificationScreen : {
screen: NotificationNav
},
RewardScreen: {
screen : RewardNav
}
},{
drawerPosition: 'left',
initialRouteName: 'MainScreen',
contentComponent: props => <SideBarNav {...props} test="12"/>
});