@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
@@ -11,14 +11,9 @@ import UIKit
11
11
  @objc(ActionSheetView)
12
12
  class ActionSheetView: UIView {
13
13
  @objc var onPressAction: RCTDirectEventBlock?
14
- private var _title: String = "";
14
+ private var _title: String?;
15
15
  @objc var title: NSString? {
16
- didSet {
17
- guard let title = self.title else {
18
- return
19
- }
20
- self._title = title as String
21
- }
16
+ didSet { self._title = title as? String }
22
17
  }
23
18
 
24
19
  private var _actions: [UIAlertAction] = [];
@@ -27,6 +22,7 @@ class ActionSheetView: UIView {
27
22
  guard let actions = self.actions else {
28
23
  return
29
24
  }
25
+ _actions.removeAll()
30
26
  actions.forEach({ alertAction in
31
27
  if let action = RCTAlertAction(details: alertAction).createAction({
32
28
  event in self.sendButtonAction(event)
@@ -37,11 +33,14 @@ class ActionSheetView: UIView {
37
33
  }
38
34
  }
39
35
 
36
+ @objc var shouldOpenOnLongPress: Bool = false
40
37
 
41
38
  override init(frame: CGRect) {
42
39
  super.init(frame: frame)
43
40
  let tap = UITapGestureRecognizer(target: self, action: #selector (self.handleTap (_:)))
41
+ let longPress = UILongPressGestureRecognizer(target: self, action: #selector(self.handleLongPress(_:)))
44
42
  self.addGestureRecognizer(tap)
43
+ self.addGestureRecognizer(longPress)
45
44
  }
46
45
 
47
46
  func launchActionSheet() {
@@ -49,7 +48,7 @@ class ActionSheetView: UIView {
49
48
  let alert = UIAlertController(title: _title, message: nil, preferredStyle: .actionSheet)
50
49
 
51
50
  self._actions.forEach({action in
52
- alert.addAction(action)
51
+ alert.addAction(action.copy() as! UIAlertAction)
53
52
  })
54
53
 
55
54
  alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
@@ -67,10 +66,25 @@ class ActionSheetView: UIView {
67
66
  }
68
67
 
69
68
 
70
- @objc func handleTap(_ sender:UITapGestureRecognizer){
71
- // do other task
72
- DispatchQueue.main.async {
73
- self.launchActionSheet()
69
+ @objc func handleTap(_ sender:UITapGestureRecognizer) {
70
+ if shouldOpenOnLongPress {
71
+ return
72
+ }
73
+ if sender.state == .ended {
74
+ DispatchQueue.main.async {
75
+ self.launchActionSheet()
76
+ }
77
+ }
78
+ }
79
+
80
+ @objc func handleLongPress(_ sender: UILongPressGestureRecognizer) {
81
+ if !shouldOpenOnLongPress {
82
+ return
83
+ }
84
+ if sender.state == .ended {
85
+ DispatchQueue.main.async {
86
+ self.launchActionSheet()
87
+ }
74
88
  }
75
89
  }
76
90
 
@@ -16,6 +16,7 @@ class MenuView: UIButton {
16
16
  guard let actions = self.actions else {
17
17
  return
18
18
  }
19
+ _actions.removeAll()
19
20
  actions.forEach { menuAction in
20
21
  _actions.append(RCTMenuAction(details: menuAction).createUIMenuElement({action in self.sendButtonAction(action)}))
21
22
  }
@@ -34,7 +35,12 @@ class MenuView: UIButton {
34
35
  }
35
36
  }
36
37
  @objc var onPressAction: RCTDirectEventBlock?
37
-
38
+
39
+ @objc var shouldOpenOnLongPress: Bool = false {
40
+ didSet {
41
+ self.setup()
42
+ }
43
+ }
38
44
 
39
45
  override init(frame: CGRect) {
40
46
  super.init(frame: frame)
@@ -46,7 +52,7 @@ class MenuView: UIButton {
46
52
  let menu = UIMenu(title:_title, identifier: nil, options: .displayInline, children: self._actions)
47
53
 
48
54
  self.menu = menu
49
- self.showsMenuAsPrimaryAction = true
55
+ self.showsMenuAsPrimaryAction = !shouldOpenOnLongPress
50
56
  }
51
57
 
52
58
  override func reactSetFrame(_ frame: CGRect) {
@@ -15,5 +15,9 @@ RCT_EXPORT_VIEW_PROPERTY(actions, NSArray);
15
15
  * onPressAction: callback to be called once user selects an action
16
16
  */
17
17
  RCT_EXPORT_VIEW_PROPERTY(onPressAction, RCTDirectEventBlock);
18
+ /**
19
+ * shouldOpenOnLongPress: determines whether menu should be opened after long press or normal press
20
+ */
21
+ RCT_EXPORT_VIEW_PROPERTY(shouldOpenOnLongPress, BOOL)
18
22
 
19
23
  @end
@@ -9,9 +9,9 @@ var React = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
 
14
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
16
  /**
17
17
  * TODO: implement for Web
@@ -1,2 +1,6 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
2
6
  //# sourceMappingURL=types.js.map
@@ -1,2 +1,2 @@
1
-
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const App: () => JSX.Element;
File without changes
@@ -103,6 +103,12 @@ export declare type MenuComponentProps = {
103
103
  * @platform Android
104
104
  */
105
105
  isAnchoredToRight?: boolean;
106
+ /**
107
+ * Determines if menu should open after long press or on normal press
108
+ *
109
+ * @default false
110
+ */
111
+ shouldOpenOnLongPress?: boolean;
106
112
  };
107
113
  export declare type ProcessedMenuAction = Omit<MenuAction, 'imageColor' | 'titleColor' | 'subactions'> & {
108
114
  imageColor: ReturnType<typeof processColor>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-menu/menu",
3
- "version": "0.4.1",
3
+ "version": "0.5.2",
4
4
  "description": "UIMenu component for react-native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -43,20 +43,21 @@
43
43
  "homepage": "https://github.com/react-native-menu/menu#readme",
44
44
  "devDependencies": {
45
45
  "@react-native-community/bob": "^0.17.1",
46
- "@react-native-community/eslint-config": "^2.0.0",
46
+ "@react-native-community/eslint-config": "^3.0.0",
47
47
  "@release-it/conventional-changelog": "^1.1.4",
48
48
  "@types/jest": "^26.0.0",
49
49
  "@types/react": "^17.0.1",
50
- "@types/react-native": "0.64.2",
51
- "eslint": "7.25.0",
50
+ "@types/react-native": "0.66.2",
51
+ "eslint": "7.32.0",
52
52
  "eslint-config-prettier": "^8.1.0",
53
53
  "eslint-plugin-prettier": "^3.1.3",
54
- "jest": "^26.6.3",
54
+ "jest": "^27.0.6",
55
55
  "pod-install": "^0.1.0",
56
56
  "prettier": "^2.2.1",
57
57
  "react": "17.0.1",
58
- "react-native": "0.64.0",
59
- "release-it": "^13.5.8",
58
+ "react-native": "0.64.1",
59
+ "react-native-test-app": "^0.7.5",
60
+ "release-it": "^14.10.0",
60
61
  "typescript": "^4.1.3"
61
62
  },
62
63
  "peerDependencies": {
@@ -0,0 +1 @@
1
+ it.todo('write a test');
package/src/types.ts CHANGED
@@ -113,6 +113,12 @@ export type MenuComponentProps = {
113
113
  * @platform Android
114
114
  */
115
115
  isAnchoredToRight?: boolean;
116
+ /**
117
+ * Determines if menu should open after long press or on normal press
118
+ *
119
+ * @default false
120
+ */
121
+ shouldOpenOnLongPress?: boolean;
116
122
  };
117
123
 
118
124
  export type ProcessedMenuAction = Omit<
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "@react-native-menu/menu": ["./src/index"]
6
+ },
7
+ "allowUnreachableCode": false,
8
+ "allowUnusedLabels": false,
9
+ "esModuleInterop": true,
10
+ "importsNotUsedAsValues": "error",
11
+ "forceConsistentCasingInFileNames": true,
12
+ "jsx": "react",
13
+ "lib": ["esnext"],
14
+ "module": "esnext",
15
+ "moduleResolution": "node",
16
+ "noFallthroughCasesInSwitch": true,
17
+ "noImplicitReturns": true,
18
+ "noImplicitUseStrict": false,
19
+ "noStrictGenericChecks": false,
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "resolveJsonModule": true,
23
+ "skipLibCheck": true,
24
+ "strict": true,
25
+ "target": "esnext"
26
+ }
27
+ }