我从另一个导航收到了作为 Appcontainer的ID 。
如何在 StackNavigation 屏幕上获取每个收到的 Id?
const Parent = createStackNavigator(
{
User: User, // <----- I want to bring Id to this screen.
Noti: Noti,
},
{
initialRouteName: 'User',
defaultNavigationOptions: ({navigation}) => ({
headerStyle: {
backgroundColor: '#004680',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontSize:20,
},
}),
}
);
const AppContainer = createAppContainer(Parent);
export default class App extends React.Component {
render() {
return <AppContainer id={this.props.id} />; // <----- When I printed this value, it correctly.
}
}