@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.
Files changed (152) hide show
  1. package/.editorconfig +15 -0
  2. package/.gitattributes +3 -0
  3. package/.github/CODEOWNERS +1 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +8 -0
  5. package/.github/dependabot.yml +51 -0
  6. package/.github/workflows/ci.yml +90 -0
  7. package/.gitignore +60 -0
  8. package/CONTRIBUTING.md +184 -0
  9. package/README.md +11 -2
  10. package/android/gradle.properties +3 -3
  11. package/android/src/main/java/com/reactnativemenu/MenuView.kt +83 -54
  12. package/android/src/main/java/com/reactnativemenu/MenuViewManager.kt +5 -0
  13. package/babel.config.js +3 -0
  14. package/example/.gitignore +14 -0
  15. package/{android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json → example/.watchmanconfig} +0 -0
  16. package/example/android/build.gradle +14 -0
  17. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  18. package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  19. package/example/android/gradle.properties +6 -0
  20. package/example/android/gradlew +185 -0
  21. package/example/android/gradlew.bat +89 -0
  22. package/example/android/settings.gradle +12 -0
  23. package/example/app.json +28 -0
  24. package/example/babel.config.js +3 -0
  25. package/example/index.tsx +5 -0
  26. package/example/ios/Podfile +7 -0
  27. package/example/ios/Podfile.lock +515 -0
  28. package/example/metro.config.js +44 -0
  29. package/example/package.json +34 -0
  30. package/example/react-native.config.js +61 -0
  31. package/example/src/App.tsx +187 -0
  32. package/example/yarn.lock +6542 -0
  33. package/ios/ActionSheetView.swift +26 -12
  34. package/ios/MenuView.swift +8 -2
  35. package/ios/RCTUIMenuManager.m +4 -0
  36. package/lib/commonjs/UIMenuView.js +2 -2
  37. package/lib/commonjs/types.js +4 -0
  38. package/lib/module/types.js +1 -1
  39. package/lib/typescript/example/index.d.ts +1 -0
  40. package/lib/typescript/example/src/App.d.ts +2 -0
  41. package/lib/typescript/src/__tests__/index.test.d.ts +0 -0
  42. package/lib/typescript/src/types.d.ts +6 -0
  43. package/package.json +8 -7
  44. package/src/__tests__/index.test.tsx +1 -0
  45. package/src/types.ts +6 -0
  46. package/tsconfig.json +27 -0
  47. package/yarn.lock +9701 -0
  48. package/android/build/.transforms/fc5f9acad800c84b4b9e229c2b286008/classes/classes.dex +0 -0
  49. package/android/build/.transforms/fc5f9acad800c84b4b9e229c2b286008.bin +0 -1
  50. package/android/build/generated/source/buildConfig/debug/com/reactnativemenu/BuildConfig.java +0 -10
  51. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -11
  52. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -16
  53. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -2
  54. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  55. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  56. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1789
  57. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  58. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  59. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  60. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +0 -1
  61. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +0 -2
  62. package/android/build/intermediates/javac/debug/classes/com/reactnativemenu/BuildConfig.class +0 -0
  63. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  64. package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -11
  65. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
  66. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -13
  67. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  68. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -16
  69. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  70. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1315
  71. package/android/build/kotlin/compileDebugKotlin/build-history.bin +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.len +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/counters.tab +0 -2
  122. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.len +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i +0 -0
  128. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  129. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab +0 -0
  130. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  131. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  132. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.len +0 -0
  133. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  134. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i +0 -0
  135. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  136. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab +0 -0
  137. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream +0 -0
  138. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  139. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.len +0 -0
  140. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.values.at +0 -0
  141. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i +0 -0
  142. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i.len +0 -0
  143. package/android/build/kotlin/compileDebugKotlin/last-build.bin +0 -0
  144. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -37
  145. package/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt +0 -2
  146. package/android/build/tmp/kotlin-classes/debug/META-INF/reactnativemenu_debug.kotlin_module +0 -0
  147. package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuPackage.class +0 -0
  148. package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuView$prepareMenu$1.class +0 -0
  149. package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuView$prepareMenu$2.class +0 -0
  150. package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuView.class +0 -0
  151. package/android/build/tmp/kotlin-classes/debug/com/reactnativemenu/MenuViewManager$Companion.class +0 -0
  152. 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
+ });