-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
124 lines (117 loc) · 3.53 KB
/
App.tsx
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//
// ────────────────────────────────────────────────────── I ──────────
// :::::: I M P O R T S : : : : : : : :
// ────────────────────────────────────────────────────────────────
//
import { MenuView } from '@react-native-menu/menu';
import React, { useCallback } from 'react';
import {
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View,
// SafeAreaView,
} from 'react-native';
import { Icon } from 'react-native-elements';
import {SafeAreaView} from 'react-native-safe-area-context';
import Col from './demo/Col';
//
// ────────────────────────────────────────────────────────────── I ──────────
// :::::: T Y P E S H A P E S : : : : : : : :
// ────────────────────────────────────────────────────────────────────────
//
const items = [
'Item 1',
'Item 2',
'Item 3',
];
const styles = StyleSheet.create({
absoluteFill: {
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0,
},
content: {
width: 300,
height: 200,
margin: 12,
borderRadius: 12,
backgroundColor: "#000000",
},
touchable: {
width: 300,
height: 200,
backgroundColor: "#FF00FF",
},
menuViewItemContainer: {
position: "absolute",
top: 12,
bottom: 0,
right: 0,
width: 40,
backgroundColor: "#FFFF00",
},
icon: {
alignSelf: "center",
backgroundColor: "#00FF00",
},
});
const App = () => {
const renderItems = useCallback(
() => items.map((item, index) => {
return (
<View key={index} style={styles.content}>
<View style={styles.absoluteFill}>
<TouchableOpacity style={styles.touchable} activeOpacity={1}>
<View
style={[
styles.menuViewItemContainer,
{
left: styles.touchable.width - styles.menuViewItemContainer.width
}
]}
>
<MenuView
isAnchoredToRight={true}
actions={[
{
id: 'duplicate',
title: 'Duplicate',
},
{
id: 'send to event',
title: 'Send to Event',
},
{
id: 'delete',
title: 'Delete',
},
]}
>
<Icon
name="more-vert"
containerStyle={styles.icon}
/>
</MenuView>
</View>
</TouchableOpacity>
</View>
</View>
)
}),
[],
)
return (
<SafeAreaView>
<ScrollView>
<Col>
{renderItems()}
</Col>
</ScrollView>
</SafeAreaView>
);
};
export default App;