用Redux反应Native Handle Headerback

时间:2017-11-28 20:34:27

标签: react-native redux header navigation react-navigation

我已将Redux集成到我的RN项目中。我可以在带有按钮的屏幕之间导航,但是当我想回到HeaderBackButton时,它会说:" undefined不是函数"

Github-Repo:https://github.com/bayraktarhasan/React-Navigation-Redux-Globalization-Example.git

我的Feed组件:

printf '%s' \2

减速机:

 class Feed extends Component {
  static navigationOptions = {
    title: 'Hello Ahmet',
    headerLeft: <HeaderBackButton onPress={this.goBack()} />,
  }
  constructor(props) {
    super(props);
    this.goBack = this.goBack.bind(this);
  }

  goBack = () => {
    this.props.navBack();
  }

  render() {
    return (

      <View style={styles.container}>
        <Text>{I18n.t('feedComponent')}</Text>
        <Button
          title={I18n.t('back')}
          onPress={this.goBack}
        />
      </View>
    );
  }
}

export default connect(null, { navBack, navToProfile })(Feed);

0 个答案:

没有答案