Skip to content

Commit 9bee622

Browse files
Pawan KumarPawan Kumar
Pawan Kumar
authored and
Pawan Kumar
committed
fix merge conflicts
2 parents e0807be + 014ecd6 commit 9bee622

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

docs/content/docs/modal/index.md

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,43 @@ Wrapper around `<Modal />` of [react-native-modal](https://github.com/react-nati
1313
<br />
1414

1515
```jsx
16-
import { Button, Modal, Icon } from 'react-native-magnus'
17-
18-
const modalRef = React.createRef();
19-
20-
<Button
21-
onPress={() => {
22-
if (modalRef.current) {
23-
modalRef.current.open();
24-
}
25-
}}
26-
>
27-
Open Modal
28-
</Button>
29-
30-
<Modal ref={modalRef}>
31-
<Button
32-
bg="gray400"
33-
h={35}
34-
w={35}
35-
position="absolute"
36-
top={50}
37-
right={15}
38-
rounded="circle"
39-
onPress={() => {
40-
if (modalRef.current) {
41-
modalRef.current.close();
42-
}
43-
}}
44-
>
45-
<Icon color="gray900" name="close" />
46-
</Button>
47-
</Modal>
16+
import React, { useState } from "react";
17+
import { SafeAreaView, StatusBar, FlatList } from "react-native";
18+
import { Div, Button, Icon, Modal, ThemeProvider } from "react-native-magnus";
19+
20+
const App = () => {
21+
const [visible, setVisible] = useState(false);
22+
23+
return (
24+
<ThemeProvider>
25+
<StatusBar barStyle="dark-content" />
26+
<SafeAreaView style={{ flex: 1 }}>
27+
<Button block m={10} onPress={() => setVisible(true)}>
28+
Open Modal
29+
</Button>
30+
31+
<Modal isVisible={visible}>
32+
<Button
33+
bg="gray400"
34+
h={35}
35+
w={35}
36+
position="absolute"
37+
top={50}
38+
right={15}
39+
rounded="circle"
40+
onPress={() => {
41+
setVisible(false);
42+
}}
43+
>
44+
<Icon color="black900" name="close" />
45+
</Button>
46+
</Modal>
47+
</SafeAreaView>
48+
</ThemeProvider>
49+
);
50+
};
51+
52+
export default App;
4853
```
4954

5055
## Props

0 commit comments

Comments
 (0)