DEV Community

Cover image for React Native Modal
Helena Strada
Helena Strada

Posted on

React Native Modal

React Native = A framework for building native apps using React

This post aims to show the solution to a problem that we recently went through using the React Native Modal component.

If you have already used it, you have probably experienced the following problem: when opening a modal, unless you have a button inside it to hide or dismiss, it will remain open as in the following example.

Alt Text

Alt Text

Researching, I managed to reach a very objective conclusion. Even if someone has solved it in another way, I am available.

Alt Text

Alt Text

With the TouchableWithoutFeedback inclusion and its behavior, I can change the state of its visibility and it will be closed after I click anywhere outside the modal.

Source code

The source code for this project is available and can be found in this GitHub repository.

https://github.com/hstrada/medium-RNModalExample

Top comments (0)