React Native Modal
The React Native Modal is a type of View component which is used to present the content above an enclosing view. There are three different types of options (slide, fade and none) available in a modal that decides how the modal will show inside the react native app.
The Modal shows above the screen covers all the application area. To use the Modal component in our application, we need to import Modal from the react-native library.
||This prop determines whether your modal is visible.
||It allow for rotating the modal in any of the specified orientations (portrait, portrait-upside-down, landscape, landscape-left, landscape-right).
||This is a callback prop which is called when the user taps on the hardware back button on Android or the menu button on Apple TV.
||This allows passing a function which will show when the modal once visible.
||It determines whether the modal will cover the entire view. Setting it to "true" renders the modal over the transparent background.
||It controls how the modal animates. There are three types of animated props available:
slide: It slides the modal from the bottom.
fade: It fades into the view.
none: It appears the model without any animation.
||It controls whether to force hardware acceleration for the underlying window.
||This prop passes a function that will be called once the modal has been dismissed.
||This props is called when the orientation changes while the modal is being displayed. The type of orientation is "portrait" or "landscape".
||It controls the appearance of a model (fullScreen, pageSheet, fromSheet, overFullScreen) generally on the large devices.
||This prop is deprecated. Use the animatedType prop instead, which is discussed above.
React Native Modal Example
Let's see an example of displaying a pop-up modal on clicking the button. Once we clicked the button, state variable isVisible sets to true and opens the Modal component.
To implement the Modal component import Modal from the react-native library.