我正在尝试将状态数据从App.js
传递到我的抽屉屏幕,该屏幕位于另一个文件中,但道具无法检索该数据。
App.js
render() {
return (
<GalioProvider theme={argonTheme}>
<Block flex>
<Screens user={this.state.user} />
</Block>
</GalioProvider>
);
}
Screen.js
const AppStack = createDrawerNavigator(
{
Home: {
screen: HomeStack,
navigationOptions: (navOpt) => ({
drawerLabel: ({ focused }) => (
<DrawerItem focused={focused} title="Home" />
),
}),
},
},
{
contentComponent: (props) => {
console.log(props.user);
return (
<View
style={{ flex: 1, alignItems: "center", justifyContent: "center" }}
></View>
);
},
}
);
const AppContainer = createAppContainer(AppStack);
export default AppContainer;
console.log(props.user)
行返回undefined