react-native-multiple-modals v2.1.0
React Native Multiple Modals
Native Modal implementation which allows to display multiple Modals simultaneously.
β¨ Features
- π± iOS & Android
- π Performant Native Implementation
- β Accessibility Support
- π― Compatible with Expo
- π₯ New Architecture (Fabric)
- π Old Architecture (Paper)
- π Written in TypeScript
Installation
npm i react-native-multiple-modals
or
yarn add react-native-multiple-modals
iOS
pod install --project-directory=ios
Usage
import { ModalView } from 'react-native-multiple-modals';
const YourComponent = () => {
const [isVisible, setVisibility] = useState(false);
return (
<View>
<Button text='Open modal' onPress={() => setVisibility(true)} />
{isVisible && (
<ModalView onRequestClose={() => setVisibility(false)}>
<YourContentView />
</ModalView>
)}
</View>
);
};
More Examples: https://github.com/paufau/react-native-multiple-modals-examples
Properties
contentContainerStyle?: ViewStyle
Styles of the content wrapper. Use it for aligning your content view.
statusBarTranslucent?: boolean = false
- Android only
Determines whether your modal should go under the system statusbar.
onRequestClose?: (calledBy: 'Backdrop' | 'BackButton') => void
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.
renderBackdrop?: () => ReactNode
Use it to render custom backdrop. For example <BlurView />
backdropColor?: string
Default: rgba(0, 0, 0, 0.3)
BackdropPressableComponent?: FC<PressableProps>
The component which wraps renderBackdrop
.
Use it to overwrite default props or make backdrop untouchable.
Contribution
FOUND A BUG? HELP THE PROJECT AND REPORT IT!
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 π.
Also, if there are any well-known issues in React Native that havenβt been fixed for a long time and they show up here too, let me know! Letβs make things better together π.
Known issues
- Some layout animations from
react-native-reanimated
don't work properly inside the ModalView on new architecture
Roadmap
Common:
- Add default
fade
andslide
animations - Add UI tests automation
- Create separate documentation page
Versions
version | react-native | links |
---|---|---|
2.0.0+ | 71+ | Documentation |
1.0.0 - 1.2.6 | 70+ | Documentation |
Author
Sponsor & Support
If you found the library useful, you can support me:
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago