title: How set function on react-navigation navigationOptions?
body: <p>after setup a simple textInput on navigationOptions, i'd like to render a clear button conditionally. </p>
  
  <pre><code>static navigationOptions = ({ navigation }) =&gt; {
      const q = navigation.getParam("q", "");
      const onSearch = navigation.getParam("onSearch");
      const onFocus = navigation.getParam("onFocus");
  
      return {
        headerStyle: {
          backgroundColor: "#fff"
        },
        header: (
          &lt;View style={styles.searchContainer}&gt;
            &lt;HeaderBackButton
              tintColor="black"
              onPress={() =&gt; navigation.navigate("Home")}
            /&gt;
            &lt;TextInput
              underlineColorAndroid="transparent"
              style={styles.inputContainer}
              placeholder="Search"
              value={q}
              onChangeText={text =&gt; onSearch(text)}
              onFocus={onFocus}
              //clearButtonMode="always"
            /&gt;
            {this.renderClearButton()}
          &lt;/View&gt;
        )
      };
    };
  </code></pre>
  
  <p>So here is the function</p>
  
  <pre><code> renderClearButton() {
      if (this.state.onSearchStatus == "touched") {
        return (
          &lt;TouchableOpacity onPress={navigation.getParam("clearText")}&gt;
            &lt;Image
              style={styles.button}
              source={require("../assets/icons/clear.png")}
            /&gt;
          &lt;/TouchableOpacity&gt;
        );
      } else {
        return "";
      }
    }
  </code></pre>
  
  <p>But this happen</p>
  
  <blockquote>
    <p>TypeError: undefined is not a function (evaluating
    '_this2.renderClearButton()')</p>
  </blockquote>
  
  <p>i've tried to:</p>
  
  <pre><code>const renderClearButton = navigation.getParam("renderClearButton");
  and {renderClearButton}
  </code></pre>
  
  <p>but</p>
  
  <blockquote>
    <p>the error now is Functions are not valid as a react child. this may
    happen if you return a component instead</p>
  </blockquote>
  
  <p>So is possible to add a function to <strong>navigationOptions</strong>?</p>