react-native-reanimated-modal
v1.3.3
Published
A lightweight and performant modal component. Designed for smooth animations, flexibility, and minimal footprint.
Maintainers
Readme
react-native-reanimated-modal
A lightweight, performant modal for React Native — animations on the UI thread, swipe to dismiss in any direction, on top of the native Modal.
Built on React Native's own Modal, so it behaves like one on every platform, with its animations and gestures in Reanimated and Gesture Handler.
Documentation · Getting started · Animations · Swipe · API · Example app
Features
- Animations —
fade,slidefrom any edge andscale, at 60 fps on the UI thread. - Your own animations — worklets for the content and the backdrop, on top of a preset or on their own.
- Swipe to dismiss — up, down, left, right, with a threshold and a spring back.
- Backdrop — a color, your component (a blur), or none; presses close, call your handler, or do nothing.
- Declarative or imperative —
visible+onHide, orref.current.close(). - Several at once —
coverScreenstacks modals and works in React Navigation'sFullWindowOverlay. - Native behaviour — the Android back button, translucent bars, iOS orientations.
- Small — one component in TypeScript, no dependencies of its own.
Install
npm install react-native-reanimated-modalPeers: react-native-reanimated, react-native-worklets and react-native-gesture-handler — with Expo, npx expo install react-native-reanimated react-native-worklets react-native-gesture-handler.
Version 1.2.5 and later need
react-native-worklets0.7.2+ (Expo SDK 55+). On Expo SDK 54 or Worklets 0.5.1, install[email protected]. Version compatibility
Quick start
import { useState } from 'react';
import { Button, Text, View } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { Modal } from 'react-native-reanimated-modal';
export default function App() {
const [visible, setVisible] = useState(false);
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<Button title="Show modal" onPress={() => setVisible(true)} />
<Modal
visible={visible}
onHide={() => setVisible(false)}
animation={{ type: 'slide', direction: 'down' }}
swipe={{ directions: ['down'] }}
>
<View
style={{
margin: 20,
padding: 20,
borderRadius: 12,
backgroundColor: 'white',
}}
>
<Text>Hello from the modal!</Text>
</View>
</Modal>
</GestureHandlerRootView>
);
}Always pass onHide and set visible to false there: the modal calls it once the user has closed it — backdrop, swipe or back button — and its animation has finished.
Next: the presets and their options, swipe directions, every prop.
Example app
Scan the QR code with Expo Go to open the example app on your phone: a basic modal, a bottom sheet, full screen, blur, scroll, keyboard input, a toast and stacked modals. Or run it from the repository — pnpm install && pnpm example start.
For AI assistants
Every page of the docs is also Markdown — llms.txt, llms-full.txt, more.
Development
pnpm install # the library, example/ and docs/ (one pnpm workspace)
pnpm example start # the Expo example, on the library's source
pnpm validate # typecheck, lint, unit tests, build
pnpm run docs dev # the documentation on http://localhost:4321/react-native-reanimated-modal/The workflow, conventions and releases are in CONTRIBUTING.md; architecture notes for coding agents in AGENTS.md.
