@react-native-menu/menu 1.0.1 → 1.0.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/README.md CHANGED
@@ -224,7 +224,6 @@ export type MenuAction = {
224
224
  * image="plus"
225
225
  * @example // (Android)
226
226
  * image="ic_menu_add"
227
- * - TODO: Allow images other than those included in SF Symbol and resources drawables
228
227
  */
229
228
  image?: string;
230
229
  /**
@@ -0,0 +1,21 @@
1
+ package com.reactnativemenu
2
+
3
+ import com.facebook.react.bridge.Arguments
4
+ import com.facebook.react.bridge.WritableMap
5
+ import com.facebook.react.uimanager.events.Event
6
+
7
+ class MenuOnPressActionEvent(
8
+ surfaceId: Int,
9
+ viewTag: Int,
10
+ private val event: String?,
11
+ private val target: Int
12
+ ) : Event<MenuOnPressActionEvent>(surfaceId, viewTag) {
13
+
14
+ override fun getEventName(): String = "onPressAction"
15
+ override fun getEventData(): WritableMap = Arguments.createMap().apply {
16
+ if (event != null) {
17
+ putString("event", event)
18
+ }
19
+ putString("target", target.toString())
20
+ }
21
+ }
@@ -10,6 +10,8 @@ import android.text.style.ForegroundColorSpan
10
10
  import android.view.*
11
11
  import android.widget.PopupMenu
12
12
  import com.facebook.react.bridge.*
13
+ import com.facebook.react.uimanager.UIManagerHelper
14
+ import com.facebook.react.uimanager.events.Event
13
15
  import com.facebook.react.uimanager.events.RCTEventEmitter
14
16
  import com.facebook.react.views.view.ReactViewGroup
15
17
  import java.lang.reflect.Field
@@ -165,14 +167,14 @@ class MenuView(private val mContext: ReactContext): ReactViewGroup(mContext) {
165
167
  subMenuItem.setOnMenuItemClickListener {
166
168
  if (!it.hasSubMenu()) {
167
169
  mIsMenuDisplayed = false
168
- val args: WritableMap = Arguments.createMap()
169
170
  if (!subactions.isNull(it.order)) {
170
171
  val selectedItem = subactions.getMap(it.order)
171
- args.putString("event", selectedItem?.getString("id"))
172
- args.putString("target", "$id")
173
- mContext
174
- .getJSModule(RCTEventEmitter::class.java)
175
- .receiveEvent(id, "onPressAction", args)
172
+ val dispatcher =
173
+ UIManagerHelper.getEventDispatcherForReactTag(mContext, id)
174
+ val surfaceId: Int = UIManagerHelper.getSurfaceId(this)
175
+ dispatcher?.dispatchEvent(
176
+ MenuOnPressActionEvent(surfaceId, id, selectedItem.getString("id"), id)
177
+ )
176
178
  }
177
179
  true
178
180
  } else {
@@ -210,14 +212,14 @@ class MenuView(private val mContext: ReactContext): ReactViewGroup(mContext) {
210
212
  menuItem.setOnMenuItemClickListener {
211
213
  if (!it.hasSubMenu()) {
212
214
  mIsMenuDisplayed = false
213
- val args: WritableMap = Arguments.createMap()
214
215
  if (!mActions.isNull(it.order)) {
215
216
  val selectedItem = mActions.getMap(it.order)
216
- args.putString("event", selectedItem?.getString("id"))
217
- args.putString("target", "$id")
218
- mContext
219
- .getJSModule(RCTEventEmitter::class.java)
220
- .receiveEvent(id, "onPressAction", args)
217
+ val dispatcher =
218
+ UIManagerHelper.getEventDispatcherForReactTag(mContext, id)
219
+ val surfaceId: Int = UIManagerHelper.getSurfaceId(this)
220
+ dispatcher?.dispatchEvent(
221
+ MenuOnPressActionEvent(surfaceId, id, selectedItem.getString("id"), id)
222
+ )
221
223
  }
222
224
  true
223
225
  } else {
@@ -7,7 +7,7 @@
7
7
  #import "MenuView.h"
8
8
  #else
9
9
  // OLD ARCH
10
- #import <react_native_menu-Swift.h>
10
+ #import <react_native_menu/react_native_menu-Swift.h>
11
11
  #endif
12
12
 
13
13
  @interface MenuViewManager : RCTViewManager
@@ -18,6 +18,8 @@ class RCTMenuAction {
18
18
  var attributes: UIAction.Attributes = []
19
19
  var state: UIAction.State = .off
20
20
  var subactions: [RCTMenuAction] = []
21
+ // Only available in iOS 16+
22
+ var preferredElementSizeString: String?
21
23
 
22
24
  init(details: NSDictionary){
23
25
 
@@ -61,6 +63,11 @@ class RCTMenuAction {
61
63
  if (attributes["hidden"] as? Bool) == true {
62
64
  self.attributes.update(with: .hidden)
63
65
  }
66
+ if(attributes["keepsMenuPresented"] as? Bool) == true {
67
+ if #available(iOS 16.0, *) {
68
+ self.attributes.update(with: .keepsMenuPresented)
69
+ }
70
+ }
64
71
  }
65
72
 
66
73
  if let state = details["state"] as? NSString {
@@ -83,6 +90,9 @@ class RCTMenuAction {
83
90
  }
84
91
  }
85
92
 
93
+ if let preferredElementSizeString = details["preferredElementSize"] as? String {
94
+ self.preferredElementSizeString = preferredElementSizeString
95
+ }
86
96
 
87
97
  }
88
98
 
@@ -92,11 +102,24 @@ class RCTMenuAction {
92
102
  subactions.forEach { subaction in
93
103
  subMenuActions.append(subaction.createUIMenuElement(handler))
94
104
  }
105
+ var menu: UIMenu;
95
106
  if self.displayInline {
96
- return UIMenu(title: title, image: image, options: .displayInline, children: subMenuActions)
107
+ menu = UIMenu(title: title, image: image, options: .displayInline, children: subMenuActions)
97
108
  } else {
98
- return UIMenu(title: title, image: image, children: subMenuActions)
109
+ menu = UIMenu(title: title, image: image, children: subMenuActions)
110
+ }
111
+
112
+ if #available(iOS 16.0, *) {
113
+ if(preferredElementSizeString == "small") {
114
+ menu.preferredElementSize = .small
115
+ } else if(preferredElementSizeString == "medium") {
116
+ menu.preferredElementSize = .medium
117
+ } else if(preferredElementSizeString == "large") {
118
+ menu.preferredElementSize = .large
119
+ }
99
120
  }
121
+
122
+ return menu
100
123
  }
101
124
 
102
125
  if #available(iOS 15, *) {
@@ -1,6 +1,6 @@
1
1
  import type { DirectEventHandler, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
2
2
  import type { HostComponent, ViewProps } from 'react-native';
3
- declare type SubAction = {
3
+ type SubAction = {
4
4
  id?: string;
5
5
  title: string;
6
6
  titleColor?: Int32;
@@ -15,7 +15,7 @@ declare type SubAction = {
15
15
  hidden?: boolean;
16
16
  };
17
17
  };
18
- declare type MenuAction = {
18
+ type MenuAction = {
19
19
  id?: string;
20
20
  title: string;
21
21
  titleColor?: Int32;
@@ -1 +1 @@
1
- {"version":3,"file":"UIMenuNativeComponent.d.ts","sour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AE,kBAAkB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;AAED,wBAEgC"}
1
+ {"version":3,"file":"UIMenuNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/NativeModuleSpecs/UIMenuNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACN,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAU7D,KAAK,SAAS,GAAG;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH,CAAC;AACF,KAAK,UAAU,GAAG;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC/B,CAAC;AACF,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,aAAa,CAAC,EAAE,kBAAkB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;AAED,wBAEgC"}
@@ -1,11 +1,11 @@
1
1
  import type { ColorValue, processColor, StyleProp, ViewStyle } from 'react-native';
2
2
  import type * as React from 'react';
3
- export declare type NativeActionEvent = {
3
+ export type NativeActionEvent = {
4
4
  nativeEvent: {
5
5
  event: string;
6
6
  };
7
7
  };
8
- declare type MenuAttributes = {
8
+ type MenuAttributes = {
9
9
  /**
10
10
  * An attribute indicating the destructive style.
11
11
  */
@@ -18,6 +18,12 @@ declare type MenuAttributes = {
18
18
  * An attribute indicating the hidden style.
19
19
  */
20
20
  hidden?: boolean;
21
+ /**
22
+ * (iOS16+ only)
23
+ * @platform iOS
24
+ * An attribute indicating that the menu should remain presented after firing.
25
+ */
26
+ keepsMenuPresented?: boolean;
21
27
  };
22
28
  /**
23
29
  * The state of the action.
@@ -25,8 +31,8 @@ declare type MenuAttributes = {
25
31
  * - on: A constant indicating the menu element is in the “on” state.
26
32
  * - mixed: A constant indicating the menu element is in the “mixed” state.
27
33
  */
28
- declare type MenuState = 'off' | 'on' | 'mixed';
29
- export declare type MenuAction = {
34
+ type MenuState = 'off' | 'on' | 'mixed';
35
+ export type MenuAction = {
30
36
  /**
31
37
  * Identifier of the menu action.
32
38
  * The value set in this id will be returned when menu is selected.
@@ -85,8 +91,14 @@ export declare type MenuAction = {
85
91
  * Whether subactions should be inline (separated by divider) or nested (sub menu)
86
92
  */
87
93
  displayInline?: boolean;
94
+ /**
95
+ * (iOS 16+ only)
96
+ * The preferred size of this menu's child elements.
97
+ * @platform iOS
98
+ */
99
+ preferredElementSize?: 'small' | 'medium' | 'large';
88
100
  };
89
- declare type MenuComponentPropsBase = {
101
+ type MenuComponentPropsBase = {
90
102
  style?: StyleProp<ViewStyle>;
91
103
  /**
92
104
  * Callback function that will be called when selecting a menu item.
@@ -122,13 +134,13 @@ declare type MenuComponentPropsBase = {
122
134
  */
123
135
  themeVariant?: string;
124
136
  };
125
- export declare type MenuComponentProps = React.PropsWithChildren<MenuComponentPropsBase>;
126
- export declare type ProcessedMenuAction = Omit<MenuAction, 'imageColor' | 'titleColor' | 'subactions'> & {
137
+ export type MenuComponentProps = React.PropsWithChildren<MenuComponentPropsBase>;
138
+ export type ProcessedMenuAction = Omit<MenuAction, 'imageColor' | 'titleColor' | 'subactions'> & {
127
139
  imageColor: ReturnType<typeof processColor>;
128
140
  titleColor: ReturnType<typeof processColor>;
129
141
  subactions?: ProcessedMenuAction[];
130
142
  };
131
- export declare type NativeMenuComponentProps = {
143
+ export type NativeMenuComponentProps = {
132
144
  style?: StyleProp<ViewStyle>;
133
145
  onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;
134
146
  actions: ProcessedMenuAction[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,oBAAY,iBAAiB,GAAG;IAC9B,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,aAAK,cAAc,GAAG;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;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GAAG;IACF,UAAU,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IAC5C,UAAU,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IAC5C,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-menu/menu",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "UIMenu component for react-native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -48,7 +48,7 @@
48
48
  "@callstack/react-native-visionos": "^0.73.0",
49
49
  "@react-native/babel-preset": "^0.74.79",
50
50
  "@react-native/eslint-config": "^0.74.0",
51
- "@react-native/metro-config": "0.74.80",
51
+ "@react-native/metro-config": "0.74.81",
52
52
  "@release-it/conventional-changelog": "^8.0.1",
53
53
  "@rnx-kit/metro-config": "^1.3.15",
54
54
  "@types/jest": "^29.1.2",
@@ -65,8 +65,8 @@
65
65
  "react-native": "^0.73.0",
66
66
  "react-native-builder-bob": "^0.23.2",
67
67
  "react-native-test-app": "^3.2.9",
68
- "release-it": "^14.10.0",
69
- "typescript": "4.8.4"
68
+ "release-it": "^17.2.0",
69
+ "typescript": "5.4.5"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "react": "*",
package/src/types.ts CHANGED
@@ -25,6 +25,12 @@ type MenuAttributes = {
25
25
  * An attribute indicating the hidden style.
26
26
  */
27
27
  hidden?: boolean;
28
+ /**
29
+ * (iOS16+ only)
30
+ * @platform iOS
31
+ * An attribute indicating that the menu should remain presented after firing.
32
+ */
33
+ keepsMenuPresented?: boolean;
28
34
  };
29
35
 
30
36
  /**
@@ -93,7 +99,13 @@ export type MenuAction = {
93
99
  /**
94
100
  * Whether subactions should be inline (separated by divider) or nested (sub menu)
95
101
  */
96
- displayInline?: boolean;
102
+ displayInline?: boolean;
103
+ /**
104
+ * (iOS 16+ only)
105
+ * The preferred size of this menu's child elements.
106
+ * @platform iOS
107
+ */
108
+ preferredElementSize?: 'small' | 'medium' | 'large';
97
109
  };
98
110
 
99
111
  type MenuComponentPropsBase = {