Skip to main content
Version: v1.0.0

Migrate from react-native-modal

Most react-native-modal code builds a bottom sheet or a dialog by hand: style={{ justifyContent: 'flex-end', margin: 0 }}, a white box with rounded corners, and the same close function passed to three callbacks. BottomSheet is that sheet: one onClose for every way of closing, and the surface, handle and padding drawn for you.

React Native 0.88

react-native-modal 14.0.0-rc.1, the latest release, calls InteractionManager.createInteractionHandle. React Native 0.88 no longer exports InteractionManager, so the modal throws Cannot read property 'createInteractionHandle' of undefined as soon as it opens. BottomSheet uses React Native core only and works on 0.88.

Code changes​

- import Modal from 'react-native-modal';
+ import { BottomSheet } from '@elik56a/react-native-pickers';

- <Modal
- isVisible={open}
- onBackdropPress={close}
- onBackButtonPress={close}
- onSwipeComplete={close}
- swipeDirection="down"
- style={{ justifyContent: 'flex-end', margin: 0 }}
- >
- <View style={{ backgroundColor: 'white', borderTopLeftRadius: 16, borderTopRightRadius: 16, padding: 16 }}>
- <Filters />
- </View>
- </Modal>
+ <BottomSheet visible={open} onClose={close}>
+ <Filters />
+ </BottomSheet>

For a centered dialog, the default react-native-modal look, pass presentation="modal".

Props​

react-native-modalReact Native Pickers
isVisiblevisible
onBackdropPress / onBackButtonPress / onSwipeCompleteone onClose
swipeDirection="down"enableSwipeToClose (default true)
swipeDirection up, left or right—
no onBackdropPresscloseOnBackdropPress={false}
style={{ justifyContent: 'flex-end', margin: 0 }}the default: a bottom sheet, or a centered modal on wide web windows (presentation="bottomSheet" keeps the sheet)
a centered modalpresentation="modal"
backdropColor / backdropOpacitystyles={{ backdrop: { backgroundColor } }}, or the theme's backdrop colour
animationIn / animationOut / animationInTimingslide up, or fade and rise as a modal; theme={{ animation: { duration } }}
onModalShow / onModalHideonOpened / onClosed
avoidKeyboardbuilt in
propagateSwipea ScrollView inside just scrolls; the handle and header drag the sheet
coverScreen={false} / hasBackdrop={false}—

See all migration guides for other libraries.