renderScene ={SceneMap({
'1':() => <FirstRoute {...this.state.data}/>,
'2':() => <SecondRoute {...this.state.data,...this.props.navigation}/>
这是完整的代码
render() {
if(!this.state.loading){
return (
<View
style={{
flex: 1,
}}>
<StatusBar
backgroundColor="mediumpurple"
barStyle="light-content"/>
<TabView
style={styles.container}
navigationState={this.state}
renderScene ={SceneMap({
'1':() => <FirstRoute {...this.state.data}/>,
'2':() => <SecondRoute {...this.state.data, ...this.props.navigation}/>,
})}
renderHeader={this._renderHeader}
onIndexChange={index => this.setState({ index })}
/>
</View>
);
}else{
return (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color="#0000ff" />
</View>
);
}
}
}