title: React-native/react-navigation: how do I access a component's state from `static navigationOptions`?
body: <p>How do you handle cases when you have, say, a form component, and you need to submit a part of the component's state using button in navigation bar?</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>const navBtn = (iconName, onPress) =&gt; (
    &lt;TouchableOpacity
      onPress={onPress}
      style={styles.iconWrapper}
    &gt;
      &lt;Icon name={iconName} size={cs.iconSize} style={styles.icon} /&gt;
    &lt;/TouchableOpacity&gt;
  )
  
  class ComponentName extends Component {
  
    static navigationOptions = {
      header: (props) =&gt; ({
        tintColor: 'white',
        style: {
          backgroundColor: cs.primaryColor
        },
        left: navBtn('clear', () =&gt; props.goBack()),
        right: navBtn('done', () =&gt; this.submitForm()), // error: this.submitForm is not a function
      }),
      title: 'Form',
    }
  
    constructor(props) {
      super(props);
      this.state = {
        formText: ''
      };
    }
  
    submitForm() {
      this.props.submitFormAction(this.state.formText)
    }
  
    render() {
      return (
        &lt;View&gt;
          ...form goes here
        &lt;/View&gt;
      );
    }
  }
  </code></pre>