我在反应原生中使用TabNavigator,我想在我导航时重新渲染,但我不能这样做......有人知道怎么做?
我的尝试: navigation.js
const Navigation = TabNavigator({
Listing: {screen: ListingScreen},
Preferences: {screen: PreferencesScreen},
Add: {screen: AddScreen},
Calendar: {screen: CalendarScreen},
Professional: {screen: ProfessionalScreen},
},
{
initialRouteName: 'Add',
tabBarOptions: {
activeTintColor: 'blue',
activeBackgroundColor: 'grey',
inactiveTintColor: 'black',
},
});
export default class App extends Component {
render() {
return (
<Navigation
screenProps={{ prop: "I am a Props !" }}
/>
);
}
}
页面导航 professional.js
export default class Professional extends Component {
static navigationOptions = {
title: 'Professional',
tabBarOnPress: (scene, jumpToIndex) => {jumpToIndex(scene.index), console.log("Professional")},
};
render() {
return (
<View>
<Text style={{marginTop: '80%', marginLeft: '40%'}}> Professional </Text>
</View>
);
}
}