0
私は最初の画面でサーバから読み込まれたものを持っています。残りのタブ画面にそれらを渡したいと思います。しかし、私はオンラインでの例は見つけていません。私はscreenPropsについて知っていますが、どのように設定するのか分かりません。私が試したすべての方法は、エラーに終わった。TabNavigatorのナビゲーションナビゲーションパスの小道
const EProj = TabNavigator({
Home: { screen: HomeScreen },
Map: { screen: MapG },
Login: { screen: Login },
Profile: { screen: Profile },
}, {
tabBarPosition: 'bottom',
animationEnabled: true,
tabBarOptions: {
activeTintColor: '#1abc9c',
},
});
これは私の画面設定です。 screenPropsはどこに配置すればよいですか?
<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>
);
}
}
でなければなりません。将来の初心者のために小道具にアクセスするための注意は "this.props.screenProps.cats"を使用します。 – GhostPengy
@EmilsStopins申し訳ありません。私はそれを混ぜた。これは 'this.props.screenProps'でなければなりません。私は答えを更新しています – bennygenel
ええ、私は私の答えも変えました。理解した。 *乾杯* – GhostPengy