title: Back button event listener with react-native-image-zoom-viewer
body: <p>I'm trying to use the plugin <a href="https://github.com/magicwing/react-native-image-zoom-viewer" rel="nofollow noreferrer">react-native-image-zoom-viewer</a> to display an image preview and I want to  achieve the simple goal of closing the modal when the user clicks the Android back button. However, the handler function <code>closeModal</code> is not fired upon clicking.</p>
  
  <p>I already tried to replace <code>closeModal</code> by a non-anonymous function but I still got no results. How could I workaround this problem?</p>
  
  <p>Thanks for help!</p>
  
  <pre><code>import ImageViewer from 'react-native-image-zoom-viewer'
  import { BackHandler, Modal } from 'react-native'
  import React, { useEffect, useState } from 'react'
  
  const [isModalVisible, setModalVisible] = useState(false)
  
  const closeModal = () =&gt; {
    if (isModalVisible) {
      setModalVisible(false)
    }
  }
  
  useEffect(() =&gt; {
    BackHandler.addEventListener('hardwareBackPress', closeModal)
    return () =&gt; BackHandler.removeEventListener('hardwareBackPress', closeModal)
  }, [])
  
  
  // Here is how I call the modal in the jsx
  &lt;Modal transparent visible={isModalVisible}&gt;
    &lt;ImageViewer
      enableSwipeDown
      imageUrls={[
        {
          url: picture.url_min,
        },
      ]}
      onSwipeDown={closeModal}
      renderIndicator={() =&gt; null}
      saveToLocalByLongPress={false}
    /&gt;
  &lt;/Modal&gt;
  </code></pre>