title: How can I call two functions on an 'onPress' event in React Native?
body: <p>In the below code, I want to call both methods on the <code>onPress</code> event, but I'm facing some issues. How can I call two methods on an onpress event?</p>
  <p>One method for start chatting and the second for changing images on the onpress event.</p>
  <pre><code>chatStart = () =&gt; {
      var { msg } = this.state;
      var { o_code } = this.state;
      var ucod = o_code;
      //console.log(o_code);
      var { session } = this.state;
      //console.log(session);
      var { ocod } = this.state;
      //console.log(ocod);
      var { Name } = this.state;
      var user_name = Name;
  
      var request = new XMLHttpRequest();
      request.onreadystatechange = e =&gt; {
          if (request.readyState !== 4) {
              return;
          }
  
          if (request.status === 200) {
              console.log(&quot;success&quot;, request.responseText);
          } else {
              console.warn(&quot;error&quot;);
          }
      };
  
      // var msg = &quot;good things take some time&quot;;
  
      console.log(user_name);
  
      request.open(
          &quot;POST&quot;,
          &quot;http://www.aonde.biz/mobile/getChat.php?ocod=&quot; +
          ocod +
          &quot;&amp;ucod=&quot; +
          ucod +
          &quot;&amp;session=&quot; +
          session,
          true
      );
      request.setRequestHeader(
          &quot;Content-type&quot;,
          &quot;application/x-www-form-urlencoded&quot;
      );
      request.send(&quot;message=&quot; + msg + &quot;&amp;name=&quot; + user_name + &quot;&amp;ocod=&quot; + ocod);
  };
  
  changeImage = () =&gt; {
      console.log(&quot;state changed!&quot;);
      this.setState({
        uri: require(&quot;./35-reject-red.png&quot;)
      });
    };
  
  &lt;View&gt;
    &lt;TouchableOpacity activeOpacity={0.5} onPress={this.changeImage}&gt;
      &lt;Image source={this.state.uri} /&gt;
    &lt;/TouchableOpacity&gt;
  &lt;/View&gt;
  </code></pre>