在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5/ react-navigation導航欄按鈕怎么跳轉頁面?

react-navigation導航欄按鈕怎么跳轉頁面?

react-navigation跳轉的代碼是this.props.navigation.navigate('xxxxx')這個我知道
可是一般情況定義navigationOptions都放在static里面,如果我定義一個headerRight,按鈕,onPress里面怎么寫跳轉語句呢?static拿不到props啊

求大佬解惑

回答
編輯回答
枕頭人

Demo 如下:

  static navigationOptions = ({navigation}) =>  ({
    title: navigation.state.params.url,
    headerLeft: (
      <TouchableNativeFeedback onPress={() => navigation.goBack()}>
        <View style={{width: 50, alignItems: 'center', height: '100%', justifyContent: 'center',}}>
          <Icon name="md-close" size={25} color="#FEFEFE" />
        </View>
      </TouchableNativeFeedback>
    ),
    headerRight: (
      <TouchableNativeFeedback onPress={() => {
          const scope = navigation.state.params.that;
          scope.handlePressMore.call(scope);
      }}>
        <View style={{width: 50, alignItems: 'center', height: '100%', justifyContent: 'center',}}>
          <Icon name="md-more" size={25} color="#FEFEFE" />
        </View>
      </TouchableNativeFeedback>
    ),
    headerTitleStyle: {
      fontSize: 20,
      color: '#FEFEFE',
    },
    headerTintColor: '#FEFEFE',
    headerStyle: {
      backgroundColor: '#343434',
    }
  });
2017年8月13日 12:58