title: display a view content for a few seconds in a timeout function react native
body: <p>I need to show the response or error message for some seconds how to do this using setTimeout function or by some other way. Any help is appreciated.</p>
  
  <pre><code>&lt;View&gt;
      {!!this.state.error &amp;&amp; (
          &lt;Text style={styles.message}&gt;
            {this.state.errorMessage}
          &lt;/Text&gt;
      )}
      {!!this.state.response &amp;&amp; (
          &lt;Text style={styles.successMessage}&gt;
            {this.state.response}
          &lt;/Text&gt;
      )}
  &lt;/View&gt;
  </code></pre>
  
  <p>This view either shows response message or an error message coming from the API.</p>