Skip to main content
The Modal component is a simple way to present content above an enclosing view.

Example

import React, { useState } from 'react';
import { Modal, View, Text, Button, StyleSheet } from 'react-native';

const App = () => {
  const [modalVisible, setModalVisible] = useState(false);

  return (
    <View style={styles.centeredView}>
      <Modal
        animationType="slide"
        transparent={true}
        visible={modalVisible}
        onRequestClose={() => {
          setModalVisible(!modalVisible);
        }}
      >
        <View style={styles.centeredView}>
          <View style={styles.modalView}>
            <Text style={styles.modalText}>Hello Modal!</Text>
            <Button
              title="Hide Modal"
              onPress={() => setModalVisible(!modalVisible)}
            />
          </View>
        </View>
      </Modal>
      <Button
        title="Show Modal"
        onPress={() => setModalVisible(true)}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  centeredView: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 22,
  },
  modalView: {
    margin: 20,
    backgroundColor: 'white',
    borderRadius: 20,
    padding: 35,
    alignItems: 'center',
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 2,
    },
    shadowOpacity: 0.25,
    shadowRadius: 4,
    elevation: 5,
  },
  modalText: {
    marginBottom: 15,
    textAlign: 'center',
  },
});

export default App;

Props

visible
boolean
Determines whether your modal is visible.
onRequestClose
() => void
required
Called when the user taps the hardware back button on Android, dismisses the sheet using a gesture on iOS (when allowSwipeDismissal is set to true), or the menu button on Apple TV.Required on iOS and Android.
animationType
'none' | 'slide' | 'fade'
default:"'none'"
Controls how the modal animates:
  • 'slide' - Slides in from the bottom
  • 'fade' - Fades into view
  • 'none' - Appears without an animation
transparent
boolean
Determines whether your modal will fill the entire view. Setting this to true will render the modal over a transparent background.
onShow
() => void
Callback that is called once the modal has been shown.
backdropColor
ColorValue
Sets the background color of the modal’s container. Defaults to white if not provided and transparent is false. Ignored if transparent is true.

iOS-Specific Props

presentationStyle
'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'
Determines the style of modal to show.Platform: iOS
supportedOrientations
Array<'portrait' | 'portrait-upside-down' | 'landscape' | 'landscape-left' | 'landscape-right'>
Allowed orientations for the modal. On iOS, the modal is still restricted by what’s specified in your app’s Info.plist’s UISupportedInterfaceOrientations field.Platform: iOS
onDismiss
() => void
Callback that is called once the modal has been dismissed.Platform: iOS
onOrientationChange
(event: OrientationChangeEvent) => void
Called when the orientation changes while the modal is being displayed. The orientation provided is only ‘portrait’ or ‘landscape’.Platform: iOS
allowSwipeDismissal
boolean
Controls whether the modal can be dismissed by swiping down on iOS. This requires you to implement the onRequestClose prop to handle the dismissal.Platform: iOS

Android-Specific Props

hardwareAccelerated
boolean
default:false
Controls whether to force hardware acceleration for the underlying window.Platform: Android
statusBarTranslucent
boolean
Determines whether your modal should go under the system status bar.Platform: Android
navigationBarTranslucent
boolean
Determines whether your modal should go under the system navigation bar.Platform: Android

Presentation Styles (iOS)

fullScreen

The modal covers the entire screen. This is the default when transparent is false.

pageSheet

The modal covers the screen width but allows the previous view to be partially visible underneath (iPad only).

formSheet

The modal is displayed as a centered form that is smaller than the screen (iPad only).

overFullScreen

The modal covers the entire screen, but the underlying view is not removed. This is the default when transparent is true.

Important Notes

  • Internal state is not preserved when the modal is closed
  • The onRequestClose callback is required on Android and iOS
  • Modals can be nested, with the most recently mounted modal appearing on top
  • When using transparent={true}, you’re responsible for providing a background view
  • On iOS, onDismiss is called when the modal is dismissed through system gestures

Accessibility

Modal inherits all accessibility props from View. Make sure to:
  • Set accessibilityViewIsModal={true} to prevent interaction with views behind the modal
  • Provide appropriate accessibilityLabel for screen readers
  • Handle focus management when the modal opens and closes

Build docs developers (and LLMs) love