Javascript 使用TabNavigator和StackNavigator将主App.js文件中的本机传递函数反应到导航中的屏幕
在App.js文件中,我有一个函数:Javascript 使用TabNavigator和StackNavigator将主App.js文件中的本机传递函数反应到导航中的屏幕,javascript,android,ios,react-native,Javascript,Android,Ios,React Native,在App.js文件中,我有一个函数: resetToken = () => { try { ... } catch (error) { ... } }; 和导航组件: <MyRootNavigation resetToken={this.resetToken} /> SettingsScreen如何知道resetToken函数?我忘了写,我的解决方案是screenProp
resetToken = () => {
try {
...
} catch (error) {
...
}
};
和导航组件:
<MyRootNavigation resetToken={this.resetToken} />
SettingsScreen如何知道resetToken函数?我忘了写,我的解决方案是screenProps:我忘了写,我的解决方案是screenProps:
const SimpleStack = TabNavigator({
Settings: {
screen: SettingsScreen
},
Notification: {
screen: NotificationScreen
},
...