Skip to content

Instantly share code, notes, and snippets.

@hungdev
Last active May 6, 2018 07:28
Show Gist options
  • Select an option

  • Save hungdev/02d5ce1408f676193de73d215adb5a81 to your computer and use it in GitHub Desktop.

Select an option

Save hungdev/02d5ce1408f676193de73d215adb5a81 to your computer and use it in GitHub Desktop.
use this in static
  static navigationOptions ({ navigation }) {
    const { category } = navigation.state.params
    if (!category.parentId) {
      return {
        title: category.name,
        headerRight: (
          <TouchableOpacity onPress={() => navigation.state.params.handleCreate()} style={{ marginRight: 20 }}>
            <Ionicons name='ios-add-circle-outline' size={30} color='#fff' />
          </TouchableOpacity>
        ),
        headerTintColor: 'white'
      }
    } else {
      return {
        title: category.name,
        headerTintColor: 'white'
      }
    }
  };

  saveDetails () {
    return this.refs.modalCate.show()
  }
  componentDidMount () {
    this.props.navigation.setParams({
      handleCreate: this.saveDetails.bind(this)
    })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment