When I clicked outside the modal, the pop-up was closing. Is there any way, when I click on the close button, only that should close the popup. Instead of closing when someone clicks outside. It should close on the close button only.
<TouchableWithoutFeedback onPress={() => { setVisible(false); }}>
<TouchableWithoutFeedback onPress={() => { setVisible(false); }>
When we keep setVisible (false) and click outside the pop-up, it will close it. To make a pop-up close on the CLOSE button, you have to make it like:
<TouchableWithoutFeedback onPress={() => { setVisible(true); }>
Explanation
This is basically using a TouchableOpacity in the whole screen to get when the user clicks to close the modal. The TouchableWithoutFeedback is to avoid the TouchableOpacity to work inside of the Modal.