title: React Navigation - How to use this.state in Header navigationOptions?
body: <p>I have spent a couple hours to find a code to handle the state in <code>navigationOptions</code>, but I don't get it till now,</p>
  
  <p>I have a code :</p>
  
  <pre><code>static navigationOptions = ({ navigation }) =&gt; {
      const { params = {} } = navigation.state
      return {
        headerLeft: &lt;FontAwesome name='arrow-left' size={20} color="#FFF" onPress={() =&gt; navigation.navigate('Home')} style={{margin: DeviceWidth*0.04}}/&gt;,
        // here I want to show the TextInput if the `HeaderRight pressed` and show the `String` for the first time
        headerTitle: this.state.showSearch ? &lt;TextInput
          placeholder="this is placeholder"
          placeholder="search"
          underlineColorAndroid='transparent'
          placeholderTextColor= 'gray'
          minWidth={DeviceWidth*0.75}
          style={{borderWidth:1, borderColor:'grey', backgroundColor:'white', borderRadius:50}}
        /&gt; : 'My Patient',
        // Here I want to set the state of `showSearch` to visible at `onPress`
        headerRight: &lt;FontAwesome name='search' size={20} color="#FFF" onPress={() =&gt; params.handleRemove()} style={{margin: DeviceWidth*0.04}}/&gt;,
      }
    }
  
    componentDidMount () {
      this.props.navigation.setParams({ handleRemove: this.removeVehicle })
    }
  
    removeVehicle = () =&gt; {
      this.setState({showSearch: !this.state.showSearch})
    }
    constructor(props){
      super(props); 
      this.state = {showSearch: false}
    }
  </code></pre>
  
  <p>when I run the code, I have an error </p>
  
  <blockquote>
    <p>TypeError: undefined is not an object (evaluating '_this3.state.showSearch')</p>
  </blockquote>
  
  <p>It is possible to show/hide the headerTitle depending on <code>this.state.showSearch</code>?</p>