@react-native-menu/menu 0.4.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +15 -0
- package/.gitattributes +3 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +8 -0
- package/.github/dependabot.yml +51 -0
- package/.github/workflows/ci.yml +90 -0
- package/.gitignore +60 -0
- package/CONTRIBUTING.md +184 -0
- package/README.md +11 -2
- package/android/gradle.properties +3 -3
- package/android/src/main/java/com/reactnativemenu/MenuView.kt +83 -54
- package/android/src/main/java/com/reactnativemenu/MenuViewManager.kt +5 -0
- package/babel.config.js +3 -0
- package/example/.gitignore +14 -0
- package/{android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json → example/.watchmanconfig} +0 -0
- package/example/android/build.gradle +14 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/example/android/gradle.properties +6 -0
- package/example/android/gradlew +185 -0
- package/example/android/gradlew.bat +89 -0
- package/example/android/settings.gradle +12 -0
- package/example/app.json +28 -0
- package/example/babel.config.js +3 -0
- package/example/index.tsx +5 -0
- package/example/ios/Podfile +7 -0
- package/example/ios/Podfile.lock +515 -0
- package/example/metro.config.js +44 -0
- package/example/package.json +34 -0
- package/example/react-native.config.js +61 -0
- package/example/src/App.tsx +187 -0
- package/example/yarn.lock +6542 -0
- package/ios/ActionSheetView.swift +26 -12
- package/ios/MenuView.swift +8 -2
- package/ios/RCTUIMenuManager.m +4 -0
- package/lib/commonjs/UIMenuView.js +2 -2
- package/lib/commonjs/types.js +4 -0
- package/lib/module/types.js +1 -1
- package/lib/typescript/example/index.d.ts +1 -0
- package/lib/typescript/example/src/App.d.ts +2 -0
- package/lib/typescript/src/__tests__/index.test.d.ts +0 -0
- package/lib/typescript/src/types.d.ts +6 -0
- package/package.json +8 -7
- package/src/__tests__/index.test.tsx +1 -0
- package/src/types.ts +6 -0
- package/tsconfig.json +27 -0
- package/yarn.lock +9701 -0
- package/android/build/.transforms/fc5f9acad800c84b4b9e229c2b286008/classes/classes.dex +0 -0
- package/android/build/.transforms/fc5f9acad800c84b4b9e229c2b286008.bin +0 -1
- package/android/build/generated/source/buildConfig/debug/com/reactnativemenu/BuildConfig.java +0 -10
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -11
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -16
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -2
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1789
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/javac/debug/classes/com/reactnativemenu/BuildConfig.class +0 -0
- package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -11
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -13
- package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -16
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1315
- package/android/build/kotlin/compileDebugKotlin/build-history.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/counters.tab +0 -2
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/last-build.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -37
- package/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt +0 -2
- package/android/build/tmp/kotlin-classes/debug/META-INF/reactnativemenu_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuPackage.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuView$prepareMenu$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuView$prepareMenu$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuView.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuViewManager$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuViewManager.class +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Platform, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { MenuView } from '@react-native-menu/menu';
|
|
4
|
+
|
|
5
|
+
export const App = () => {
|
|
6
|
+
return (
|
|
7
|
+
<View style={styles.container}>
|
|
8
|
+
<MenuView
|
|
9
|
+
title="Menu Title"
|
|
10
|
+
onPressAction={({ nativeEvent }) => {
|
|
11
|
+
console.warn(JSON.stringify(nativeEvent));
|
|
12
|
+
}}
|
|
13
|
+
actions={[
|
|
14
|
+
{
|
|
15
|
+
id: 'add',
|
|
16
|
+
title: 'Add to List',
|
|
17
|
+
titleColor: '#2367A2',
|
|
18
|
+
image: Platform.select({
|
|
19
|
+
ios: 'plus',
|
|
20
|
+
android: 'ic_menu_add',
|
|
21
|
+
}),
|
|
22
|
+
imageColor: '#2367A2',
|
|
23
|
+
subactions: [
|
|
24
|
+
{
|
|
25
|
+
id: 'nested1',
|
|
26
|
+
title: 'Nested action',
|
|
27
|
+
titleColor: 'rgba(250,180,100,0.5)',
|
|
28
|
+
subtitle: 'State is mixed',
|
|
29
|
+
image: Platform.select({
|
|
30
|
+
ios: 'heart.fill',
|
|
31
|
+
android: 'ic_menu_today',
|
|
32
|
+
}),
|
|
33
|
+
imageColor: 'rgba(100,200,250,0.3)',
|
|
34
|
+
state: 'mixed',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'nestedDestructive',
|
|
38
|
+
title: 'Destructive Action',
|
|
39
|
+
attributes: {
|
|
40
|
+
destructive: true,
|
|
41
|
+
},
|
|
42
|
+
image: Platform.select({
|
|
43
|
+
ios: 'trash',
|
|
44
|
+
android: 'ic_menu_delete',
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'share',
|
|
51
|
+
title: 'Share Action',
|
|
52
|
+
titleColor: '#46F289',
|
|
53
|
+
subtitle: 'Share action on SNS',
|
|
54
|
+
image: Platform.select({
|
|
55
|
+
ios: 'square.and.arrow.up',
|
|
56
|
+
android: 'ic_menu_share',
|
|
57
|
+
}),
|
|
58
|
+
imageColor: '#46F289',
|
|
59
|
+
state: 'on',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'mixed',
|
|
63
|
+
title: 'Mixed State',
|
|
64
|
+
titleColor: 'rgba(100,200,250,0.3)',
|
|
65
|
+
subtitle: 'State is mixed',
|
|
66
|
+
image: Platform.select({
|
|
67
|
+
ios: 'heart.fill',
|
|
68
|
+
android: 'ic_menu_today',
|
|
69
|
+
}),
|
|
70
|
+
imageColor: 'rgba(100,200,250,0.3)',
|
|
71
|
+
state: 'mixed',
|
|
72
|
+
subactions: [
|
|
73
|
+
{
|
|
74
|
+
id: 'nested2',
|
|
75
|
+
title: 'Nested action',
|
|
76
|
+
titleColor: 'rgba(250,180,100,0.5)',
|
|
77
|
+
subtitle: 'State is mixed',
|
|
78
|
+
image: Platform.select({
|
|
79
|
+
ios: 'tray',
|
|
80
|
+
android: 'ic_menu_agenda',
|
|
81
|
+
}),
|
|
82
|
+
imageColor: 'rgba(100,200,250,0.3)',
|
|
83
|
+
state: 'mixed',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'nestedMixed',
|
|
87
|
+
title: 'Mixed State',
|
|
88
|
+
subtitle: 'State is mixed',
|
|
89
|
+
image: Platform.select({
|
|
90
|
+
ios: 'heart.fill',
|
|
91
|
+
android: 'ic_menu_today',
|
|
92
|
+
}),
|
|
93
|
+
imageColor: '#46F289',
|
|
94
|
+
subactions: [
|
|
95
|
+
{
|
|
96
|
+
id: 'nestednesteddisabled',
|
|
97
|
+
title: 'Disabled Action',
|
|
98
|
+
subtitle: 'Action is disabled',
|
|
99
|
+
attributes: {
|
|
100
|
+
disabled: true,
|
|
101
|
+
},
|
|
102
|
+
image: Platform.select({
|
|
103
|
+
ios: 'tray',
|
|
104
|
+
android: 'ic_menu_agenda',
|
|
105
|
+
}),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 'nestednestedhidden',
|
|
109
|
+
title: 'Hidden Action',
|
|
110
|
+
subtitle: 'Action is hidden',
|
|
111
|
+
attributes: {
|
|
112
|
+
hidden: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'nestednesteddestructive',
|
|
117
|
+
title: 'Destructive Action',
|
|
118
|
+
attributes: {
|
|
119
|
+
destructive: true,
|
|
120
|
+
},
|
|
121
|
+
image: Platform.select({
|
|
122
|
+
ios: 'trash',
|
|
123
|
+
android: 'ic_menu_delete',
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 'disabled',
|
|
132
|
+
title: 'Disabled Action',
|
|
133
|
+
subtitle: 'Action is disabled',
|
|
134
|
+
attributes: {
|
|
135
|
+
disabled: true,
|
|
136
|
+
},
|
|
137
|
+
image: Platform.select({
|
|
138
|
+
ios: 'tray',
|
|
139
|
+
android: 'ic_menu_agenda',
|
|
140
|
+
}),
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 'hidden',
|
|
144
|
+
title: 'Hidden Action',
|
|
145
|
+
subtitle: 'Action is hidden',
|
|
146
|
+
attributes: {
|
|
147
|
+
hidden: true,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: 'destructive',
|
|
152
|
+
title: 'Destructive Action',
|
|
153
|
+
attributes: {
|
|
154
|
+
destructive: true,
|
|
155
|
+
},
|
|
156
|
+
image: Platform.select({
|
|
157
|
+
ios: 'trash',
|
|
158
|
+
android: 'ic_menu_delete',
|
|
159
|
+
}),
|
|
160
|
+
},
|
|
161
|
+
]}
|
|
162
|
+
shouldOpenOnLongPress={true}
|
|
163
|
+
>
|
|
164
|
+
<View style={styles.button}>
|
|
165
|
+
<Text style={styles.buttonText}>Test</Text>
|
|
166
|
+
</View>
|
|
167
|
+
</MenuView>
|
|
168
|
+
</View>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const styles = StyleSheet.create({
|
|
173
|
+
container: {
|
|
174
|
+
flex: 1,
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
},
|
|
178
|
+
button: {
|
|
179
|
+
height: 100,
|
|
180
|
+
width: 100,
|
|
181
|
+
backgroundColor: 'red',
|
|
182
|
+
borderRadius: 50,
|
|
183
|
+
justifyContent: 'center',
|
|
184
|
+
alignItems: 'center',
|
|
185
|
+
},
|
|
186
|
+
buttonText: { color: 'white' },
|
|
187
|
+
});
|