title: How to handle multiple onPress in react native
body: <p>I have a modal component their I have two buttons and one imageView.</p>
  <pre class="lang-js prettyprint-override"><code>const ImageModal = ({ modalOpen, onClose, returnButton, customerImage, nextPage, nextPageText }) =&gt; {
    const { container, modalToggle, modalClose, imageStyle } = styles;
    return (
      &lt;Modal visible={modalOpen} animationType='slide'&gt;
        &lt;View&gt;
          &lt;View style={styles.ButtonsContainer}&gt;
            
             {/* Button number 1*/}
            &lt;TouchableOpacity onPress={onClose}&gt;
              &lt;View style={styles.buttonView}&gt;
                &lt;Text style={styles.textButton}&gt;{returnButton}&lt;/Text&gt;
              &lt;/View&gt;
            &lt;/TouchableOpacity&gt;
  
            {/* Button number 2*/}
            &lt;TouchableOpacity onPress={nextPage}&gt;
              &lt;View style={styles.buttonView}&gt;
                &lt;Text style={styles.textButton}&gt;{nextPageText}&lt;/Text&gt;
              &lt;/View&gt;
            &lt;/TouchableOpacity&gt;
  
          &lt;/View&gt;
          &lt;Image style={styles.imageStyle} source={customerImage} /&gt;
        &lt;/View&gt;
      &lt;/Modal&gt;
  </code></pre>
  <p>and i have import this component to my screen component.</p>
  <pre class="lang-js prettyprint-override"><code>&lt;Modal visible={modalOpen} animationType='slide'&gt;
     &lt;ImageModal 
         returnButton=&quot;Ta om&quot; 
         onClose={()=&gt; setModalOpen(false)} 
         customerImage={{uri: image}}
         nextPage={() =&gt; navigation.navigate('SaveCase', { image })}
         nextPageText=&quot;Välj&quot;
     /&gt;
  &lt;/Modal&gt;
  </code></pre>
  <p>But when run the App I can only press one button(onClose). But sometimes that button works on both &quot;onClose&quot; and &quot;nextPage&quot; props.</p>