title: Call function onPress React Native
body: <p>I just want to know how to call a function <code>onPress</code>. I've setup my code like this:</p>
  
  <pre><code>export default class Tab3 extends Component {
      constructor(props) {
          super(props);
          this.state = {myColor: "green"};
      }
  
      handleClick = () =&gt; {
          if (this.state.color === 'green'){
             this.setState({myColor: 'blue'});
          } else {
             this.setState({myColor: 'green'});
          }
      }
  
      render() {
       return(
        &lt;View&gt;
             &lt;Icon
              name='heart'
              color={this.state.myColor}
              size= {45}
              style={{marginLeft:40}}
              onPress={() =&gt; handleClick(this)}                                 
              /&gt;
        &lt;/View&gt;
        )};
  </code></pre>
  
  <p>But when I try this, I'm getting error that <code>can't find variable handleClick</code></p>
  
  <p>Please help. I just want to know how to bind a function to a click event.</p>