TabNavigator重新渲染

时间:2017-11-06 09:39:02

标签: reactjs react-native tabnavigator

我在反应原生中使用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>
        );
    }
}

0 个答案:

没有答案