-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathindex.tsx
More file actions
61 lines (54 loc) · 1.33 KB
/
index.tsx
File metadata and controls
61 lines (54 loc) · 1.33 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
import React from 'react';
import { StyleSheet, View } from 'react-native';
import {
Gesture,
GestureDetector,
MouseButton,
} from 'react-native-gesture-handler';
export default function ContextMenuExample() {
const p1 = Gesture.Pan().mouseButton(MouseButton.RIGHT);
const p2 = Gesture.Pan();
const p3 = Gesture.Pan();
return (
<View style={styles.container}>
<GestureDetector gesture={p1}>
<View style={[styles.box, styles.grandParent]}>
<GestureDetector gesture={p2} enableContextMenu={true}>
<View style={[styles.box, styles.parent]}>
<GestureDetector gesture={p3} enableContextMenu={false}>
<View style={[styles.box, styles.child]} />
</GestureDetector>
</View>
</GestureDetector>
</View>
</GestureDetector>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'space-around',
alignItems: 'center',
},
grandParent: {
width: 300,
height: 300,
backgroundColor: 'lightblue',
},
parent: {
width: 200,
height: 200,
backgroundColor: 'lightgreen',
},
child: {
width: 100,
height: 100,
backgroundColor: 'crimson',
},
box: {
display: 'flex',
justifyContent: 'space-around',
alignItems: 'center',
},
});