@takeoffmedia/react-native-modal
v0.1.3
Published
React Native modal component with backdrop, swipe-to-close and Reanimated-powered transitions.
Readme
@takeoffmedia/react-native-modal
Reusable React Native modal component based on the local ReactNativeModal fork used in BritBox.
Installation
npm install @takeoffmedia/react-native-modalYou must also have these peer dependencies installed in the consumer app:
npm install react react-native react-native-reanimatedUsage
import React, { useState } from 'react';
import { Button, Text, View } from 'react-native';
import Modal from '@takeoffmedia/react-native-modal';
export const Example = () => {
const [visible, setVisible] = useState(false);
return (
<View>
<Button title="Open modal" onPress={() => setVisible(true)} />
<Modal
isVisible={visible}
swipeDirection={['down']}
onBackdropPress={() => setVisible(false)}
onBackButtonPress={() => setVisible(false)}
onSwipeComplete={() => setVisible(false)}
style={{ justifyContent: 'flex-end', margin: 0 }}
>
<View
style={{
backgroundColor: 'white',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
padding: 24,
}}
>
<Text>Bottom sheet content</Text>
</View>
</Modal>
</View>
);
};Publish
npm version patch
npm publish --access publicFor automated releases:
yarn releaseLicense
MIT
