我有props ,在最初的屏幕上从服务器加载.我想将它们传递到其他选项卡屏幕.然而,我没有在网上找到任何例子.我知道电影props ,但不知道如何设置.我try 过的所有方法都会导致错误.
const EProj = TabNavigator({
Home: { screen: HomeScreen },
Map: { screen: MapG },
Login: { screen: Login },
Profile: { screen: Profile },
}, {
tabBarPosition: 'bottom',
animationEnabled: true,
tabBarOptions: {
activeTintColor: '#1abc9c',
},
});
这是我的屏幕设置.我应该把电影props 放在哪里?
<EProj
screenProps={cats}
/>
任何好的例子都会很有帮助.提前谢谢.
主屏幕设置:
class HomeScreen extends React.Component {
static navigationOptions = {
tabBarLabel: 'Home',
};
...
componentWillMount(){
console.log("Starting to load assets from server!");
this.onLoadCats(); /*starts asset loading*/
}
render() {
return (
<View style={styles.container}>
<Text>Welcome to alpha 1.17 This is hard system test.</Text>
<AssetsLoad catsL={this.state.catsL} />
</View>
);
}
}