Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Navigation headerButton invoke Component's Function #147

Open
youngjuning opened this issue Jul 20, 2018 · 0 comments
Open

React Navigation headerButton invoke Component's Function #147

youngjuning opened this issue Jul 20, 2018 · 0 comments

Comments

@youngjuning
Copy link
Owner

...
import { Button } from 'antd-mobile-rn'
...
static navigationOptions = ({ navigation }) => ({
    headerTitle: navigation.getParam('headerTitle', '选择联系人'),
    headerRight: (
      <Button
        style={{marginRight: 10}}
        type="primary"
        size="large"
        onClick={navigation.getParam('groupSave')}
      >确认
      </Button>
    ),
  })
...
componentDidMount() {
  const { navigation } = this.props
  navigation.setParams({groupSave: this.groupSave})
}
...
groupSave = () => {
  alert('点击顶部按钮,触发组件函数')
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant