Skip to content

Commit 2418f7a

Browse files
committed
Add preview & Update README
1 parent 33a6f02 commit 2418f7a

File tree

8 files changed

+41
-8
lines changed

8 files changed

+41
-8
lines changed

.github/bottom-modal.gif

3.52 MB
Loading

.github/swipeable-modal.gif

3.98 MB
Loading

README.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Just click on ⭐️ button 😘
1414
<br>
1515
<!-- ![Example](https://jacklam718.github.io/react-native-modals/resources/react-native-modals.gif) -->
1616
<span>
17-
<img src="https://raw.githubusercontent.com/jacklam718/react-native-modals/master/.github/fade-animation.gif" width="220">&nbsp;&nbsp;
18-
<img src="https://raw.githubusercontent.com/jacklam718/react-native-modals/master/.github/scale-animation.gif" width="220">&nbsp;&nbsp;
17+
<img src="https://raw.githubusercontent.com/jacklam718/react-native-modals/master/.github/swipeable-modal.gif" width="220">&nbsp;&nbsp;
18+
<img src="https://raw.githubusercontent.com/jacklam718/react-native-modals/master/.github/bottom-modal.gif" width="220">&nbsp;&nbsp;
1919
<img src="https://raw.githubusercontent.com/jacklam718/react-native-modals/master/.github/slide-animation.gif" width="220">
2020
</span>
2121

@@ -33,6 +33,7 @@ yarn add react-native-modals
3333
## Exposed Modules
3434

3535
* Modal
36+
* BottomModal
3637
* Backdrop
3738
* ModalButton
3839
* ModalContent
@@ -42,6 +43,8 @@ yarn add react-native-modals
4243
* FadeAnimation
4344
* ScaleAnimation
4445
* SlideAnimation
46+
* DragEvent,
47+
* SwipeDirection,
4548
* ModalProps
4649
* ModalFooterProps
4750
* ModalButtonProps
@@ -96,6 +99,27 @@ import Modal, { SlideAnimation, ModalContent } from 'react-native-modals';
9699
</View>
97100
```
98101

102+
## Usage - Swipe
103+
```jsx
104+
import Modal, { ModalContent } from 'react-native-modals';
105+
import { Button } from 'react-native'
106+
107+
<View style={styles.container}>
108+
<Modal
109+
visible={this.state.visible}
110+
swipeDirection={['up', 'down']} // can be string or an array
111+
swipeThreshold={200} // default 100
112+
onSwipeOut={(event) => {
113+
this.setState({ visible: false });
114+
}}
115+
>
116+
<ModalContent>
117+
{...}
118+
</ModalContent>
119+
</Modal>
120+
</View>
121+
```
122+
99123
## Usage - Modal Title
100124
```jsx
101125
import Modal, { ModalTitle, ModalContent } from 'react-native-modals';
@@ -164,9 +188,15 @@ import Modal, { ModalFooter, ModalButton, ModalContent } from 'react-native-moda
164188
| `onDismiss?` | `Function` | | You can pass onDismiss function as a callback function, will call the function when modal dismissed | |
165189
| `onTouchOutside?` | `Function` | `() => {}` | | |
166190
| `onHardwareBackPress?` | `Function` | `() => true` | [Handle hardware button presses](https://facebook.github.io/react-native/docs/backhandler) | |
191+
| `onMove?` | `Function` | `() => {}` | | |
192+
| `onSwiping?` | `Function` | `() => {}` | | |
193+
| `onSwipeRelease?` | `Function` | `() => {}` | | |
194+
| `onSwipingOut?` | `Function` | `() => {}` | | |
195+
| `onSwipeOut?` | `Function` | | | |
196+
| `swipeDirection?` | `string or Array<string>` | [] | Available option: `up`, `down`, `left`, `right` | |
197+
| `swipeThreshold?` | `number` | `100` | | |
167198
| `footer?` | `React Element` | `null` | for example: ```<View><Button text="DISMISS" align="center" onPress={() => {}}/></View>``` | |
168199

169-
170200
### ModalTitle
171201
| Prop | Type | Default | Note |
172202
|---|---|---|---|

dist/components/BaseModal.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-modals",
3-
"version": "0.19.4",
3+
"version": "0.19.5",
44
"description": "React Native Modals Library for IOS & Android.",
55
"main": "dist/index.js",
66
"scripts": {

src/components/BaseModal.js

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class BaseModal extends Component<ModalProps, State> {
9191
onSwiping: () => {},
9292
onSwipeRelease: () => {},
9393
onSwipingOut: () => {},
94-
onSwipeOut: () => {},
9594
useNativeDriver: true,
9695
}
9796

src/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import {
2+
DragEvent,
3+
SwipeDirection,
24
ModalProps,
35
ModalFooterProps,
46
ModalFooterActionList,
@@ -21,7 +23,7 @@ import FadeAnimation from './animations/FadeAnimation';
2123
import ScaleAnimation from './animations/ScaleAnimation';
2224
import SlideAnimation from './animations/SlideAnimation';
2325

24-
Modal.BottomModal = BottomModal
26+
Modal.BottomModal = BottomModal;
2527

2628
export {
2729
DraggableView,
@@ -36,6 +38,8 @@ export {
3638
FadeAnimation,
3739
ScaleAnimation,
3840
SlideAnimation,
41+
DragEvent,
42+
SwipeDirection,
3943
ModalProps,
4044
ModalFooterProps,
4145
ModalFooterActionList,

0 commit comments

Comments
 (0)