Modal
The Modal component is a basic way to present content above an enclosing view.
Exampleโ
- Function Component
- Class Component
Reference
Propsโ
animated
โ
Deprecated. Use the
animationType
prop instead.
animationType
โ
The animationType
prop controls how the modal animates.
Possible values:
slide
slides in from the bottom,fade
fades into view,none
appears without an animation.
Type | Default |
---|---|
enum('none' , 'slide' , 'fade' ) | none |
hardwareAccelerated
Androidโ
The hardwareAccelerated
prop controls whether to force hardware acceleration for the underlying window.
Type | Default |
---|---|
bool | false |
onDismiss
iOSโ
The onDismiss
prop allows passing a function that will be called once the modal has been dismissed.
Type |
---|
function |
onOrientationChange
iOSโ
The onOrientationChange
callback is called when the orientation changes while the modal is being displayed. The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation.
Type |
---|
function |
onRequestClose
โ
The onRequestClose
callback is called when the user taps the hardware back button on Android or the menu button on Apple TV. Because of this required prop, be aware that BackHandler
events will not be emitted as long as the modal is open.
Type |
---|
function Required Android TV function iOS |
onShow
โ
The onShow
prop allows passing a function that will be called once the modal has been shown.
Type |
---|
function |
presentationStyle
iOSโ
The presentationStyle
prop controls how the modal appears (generally on larger devices such as iPad or plus-sized iPhones). See https://developer.apple.com/reference/uikit/uimodalpresentationstyle for details.
Possible values:
fullScreen
covers the screen completelypageSheet
covers portrait-width view centered (only on larger devices)formSheet
covers narrow-width view centered (only on larger devices)overFullScreen
covers the screen completely, but allows transparency
Type | Default |
---|---|
enum('fullScreen' , 'pageSheet' , 'formSheet' , 'overFullScreen' ) | fullScreen if transparent={false} overFullScreen if transparent={true} |
statusBarTranslucent
Androidโ
The statusBarTranslucent
prop determines whether your modal should go under the system statusbar.
Type | Default |
---|---|
bool | false |
supportedOrientations
iOSโ
The supportedOrientations
prop allows the modal to be rotated to any of the specified orientations. On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field.
When using
presentationStyle
ofpageSheet
orformSheet
, this property will be ignored by iOS.
Type | Default |
---|---|
array of enums('portrait' , 'portrait-upside-down' , 'landscape' , 'landscape-left' , 'landscape-right' ) | ['portrait'] |
transparent
โ
The transparent
prop determines whether your modal will fill the entire view. Setting this to true
will render the modal over a transparent background.
Type | Default |
---|---|
bool | false |
visible
โ
The visible
prop determines whether your modal is visible.
Type | Default |
---|---|
bool | true |