Native Modal implementation which allows to display multiple Modals simultaneously.
- π Shows multiple instances at the same time
- π― Displays on top of default modal
- π Supports gesture handler out of the box
- π οΈ Displays above bottom tabs navigation
- π± Adjusts content when rotated
- π₯ Enhanced status bar configuration
- β Accessibility Support
npm i react-native-multiple-modalsyarn add react-native-multiple-modalspod install --project-directory=iosimport { ModalView } from 'react-native-multiple-modals';
const YourComponent = () => {
const [isVisible, setVisibility] = useState(false);
return (
<View>
<Button text='Open modal' onPress={() => setVisibility(true)} />
{isVisible && (
<ModalView
animationType='fade'
statusBar={{ translucent: true, barStyle: 'dark-content' }}
backdropColor='rgba(0,0,0,0.5)'
contentContainerStyle={{
justifyContent: 'center',
alignItems: 'center',
}}
onRequestDismiss={() => setVisibility(false)}
>
<YourContentView />
</ModalView>
)}
</View>
);
};More Examples: https://github.com/paufau/react-native-multiple-modals-examples
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
Styles of the content wrapper. Use it for aligning your content view.
Controls the status bar.
Android - supports only translucent, barStyle
iOS - all props are supported.
Allows to disable inner StatusBar component in case you are using 'expo-status-bar'.
Note that it is only applicable for iOS because there status bar is shared between all modal windows. On the other hand on android status bar is tightly coupled to the individual modal window and couldn't be controller through the StatusBar component.
The method is called when backdrop or back button is pressed
TIP: If you want the modal to block the interface and not close when user taps the backdrop or back button. Then just don't pass this function. The modal will be rendered until you remove it from the React tree.
Use it to render custom backdrop. For example <BlurView />
Default: rgba(0, 0, 0, 0.3)
The component which wraps renderBackdrop.
Use it to overwrite default props or make backdrop untouchable.
Determines whether your modal should go under the system statusbar.
If you notice any bugs or anything working differently compared to React Native, feel free to open an issue. Itβll really help improve the project π.
I would love if you would let me know what you are missing in the library. Together we can make it a community standard!
Follow instructions: https://github.com/paufau/react-native-multiple-modals-examples
Common:
- Create separate documentation page
- Reanimated modal has wrong size for the first only render: software-mansion/react-native-reanimated#6659
| library version | react-native | old arch | new arch | docs |
|---|---|---|---|---|
| 3.0.0+ | 73+ | β | β | Documentation |
| 2.0.0 - 2.5.0 | 71+ | β | β | Documentation |
| 1.0.0 - 1.2.6 | 70+ | β | β | Documentation |
If you found the library useful, you can support me here:
