-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathindex.tsx
More file actions
63 lines (59 loc) · 1.49 KB
/
index.tsx
File metadata and controls
63 lines (59 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as React from 'react';
import { useState } from 'react';
import { StyleSheet, Modal, View, Text } from 'react-native';
import {
GestureHandlerRootView,
TouchableOpacity,
} from 'react-native-gesture-handler';
import { DraggableBox } from '../../basic/draggable';
export default function App() {
const [isModalVisible, setIsModalVisible] = useState(false);
function ToggleModalButton() {
return (
<TouchableOpacity
style={styles.button}
onPress={() => setIsModalVisible((visible) => !visible)}>
<Text>{isModalVisible ? 'Close' : 'Open'} modal</Text>
</TouchableOpacity>
);
}
return (
<GestureHandlerRootView style={styles.container}>
<Text style={styles.description}>
DraggableBox inside modal should be moveable
</Text>
<ToggleModalButton />
<Modal visible={isModalVisible}>
<GestureHandlerRootView style={{ flex: 1 }}>
<View style={styles.modalView}>
<DraggableBox />
<ToggleModalButton />
</View>
</GestureHandlerRootView>
</Modal>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
modalView: {
margin: 20,
marginTop: 200,
backgroundColor: 'transparent',
borderRadius: 6,
padding: 20,
alignItems: 'center',
borderWidth: 2,
},
container: {
flex: 1,
display: 'flex',
alignItems: 'center',
},
description: {
margin: 20,
},
button: {
borderWidth: 2,
padding: 10,
},
});