我在TabNavigator中有堆栈导航器,我正在尝试使用screenProps将对象传递到所有屏幕。当我将screenProps分配给一个对象并在其中一个屏幕中控制台this.props时,我得到“ screenProps”:未定义
const home = createStackNavigator(
{
Home: {
screen: Home //React component imported from another file
},
},
{
mode: 'modal',
}
);
const account = createStackNavigator(
{
Account: {
screen: Account //React component imported from another file
},
},
{
mode: 'modal',
}
);
export default TabNavigator({
Home: { screen: home },
Account: { screen: account },
},
{
navigationOptions: ({ navigation, screenProps }) => ({}),
}
);
//Using TabNavigator
<TabNavigator onNavigationStateChange={null} screenProps={{'test': 'value'}}/>