Skip to content

Commit 75eee7e

Browse files
committed
2 parents 3748f3a + 47d6458 commit 75eee7e

1 file changed

Lines changed: 16 additions & 77 deletions

File tree

README.md

Lines changed: 16 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,29 @@
11
# react-native-ma-modal
2-
完全使用ts实现的RN弹窗组件,支持自定义动画
32

4-
<img src="./screenshot/overlay.gif" width="250" />
3+
This component is a react-native popup component implemented using TypeScript, which supports custom animations as well as customizable popup content.
54

6-
## 安装
7-
在使用之前请先安装`react-native-reanimated``react-native-gesture-handle`
8-
```
9-
npm install react-native-reanimated react-native-gesture-handler
10-
```
11-
并正确配置项目,详情请参考:
12-
- [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)
13-
- [react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler)
145

15-
安装`react-native-ma-modal`
16-
```
17-
npm install react-native-ma-modal
18-
```
196

20-
## 使用
21-
在App的入口,使用`ModalProvider`
7+
| <img src="./screenshot/opacity.gif" width="250"> | <img src="./screenshot/scale.gif" width="250"> |<img src="./screenshot/drawer.gif" width="250"> |
8+
|-|-|-|
9+
| <img src="./screenshot/trans-1.gif" width="250"> | <img src="./screenshot/trans-2.gif" width="250"> | <img src="./screenshot/eas.svg" width="250"> |
2210

23-
```javascript
24-
import { ModalProvider, modalRef } from 'react-native-ma-modal';
11+
## install
2512

26-
export default function App() {
27-
return (
28-
<ModalProvider ref={modalRef}>
29-
<NavigationContainer ref={navigationRef}>
30-
<Index />
31-
</NavigationContainer>
32-
</ModalProvider>
33-
);
34-
}
35-
```
36-
### 组件内函数式调用
37-
```javascript
38-
import { useModal } from 'react-native-ma-modal';
13+
Before using it, please install react-native-reanimated and react-native-gesture-handler first.
3914

40-
export default function Example() {
41-
const { add, remove } = useModal();
42-
return (
43-
<View>
44-
<Button
45-
onPress={() => {
46-
add(<Text>Modal视图</Text>);
47-
}}
48-
>
49-
<Text>添加弹窗</Text>
50-
</Button>
51-
<Button onPress={remove}>
52-
<Text>删除弹窗</Text>
53-
</Button>
54-
</View>
55-
)
56-
}
5715
```
58-
### 在函数内使用
59-
```javascript
60-
import { ModalUtil } from 'react-native-ma-modal';
16+
npm install react-native-reanimated react-native-gesture-handler
17+
```
18+
And properly configure the project. For details, please refer to:
19+
- [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)
20+
- [react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler)
6121

62-
const show = () => {
63-
ModalUtil.add(<Text>Modal视图</Text>)
64-
}
22+
install`react-native-ma-modal`
6523
```
66-
### Modal组件
67-
```javascript
68-
export default function Example() {
69-
const [isVisible, setVisible] = useState(false);
70-
71-
return (
72-
<Modal isVisible={isVisible}>
73-
<Text>Modal视图</Text>
74-
</Modal>
75-
)
76-
}
24+
npm install react-native-ma-modal
7725
```
78-
### Modal的弹出效果
79-
目前有几种弹出效果
80-
- 渐变效果:`OpacityContainer`
81-
- 平移效果:`TranslateContainer`
82-
- 抽屉效果:`DrawerContainer`
83-
- 缩放效果:`ScaleContainer`
84-
85-
更多示例请参照[Demo](https://github.com/mahaaoo/react-native-ma-modal/blob/main/example/src/Home.tsx)
86-
87-
## Expo Demo
88-
Scan the QR code with Expo Go (Android) or the Camera app
8926

90-
<img src="./screenshot/expo.png" width="250" />
27+
## usage
28+
For usage examples, please refer to
29+
[Demo](https://github.com/mahaaoo/react-native-ma-modal/blob/main/example/src/Home.tsx)

0 commit comments

Comments
 (0)