@react-native-menu/menu 0.8.0 → 0.9.1

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
@@ -158,6 +158,14 @@ Actions to be displayed in the menu.
158
158
  | ------------ | -------- |
159
159
  | MenuAction[] | Yes |
160
160
 
161
+ ### `themeVariant` (iOS only)
162
+
163
+ String to override theme of menu
164
+
165
+ | Type | Required |
166
+ | ------------ | -------- |
167
+ | enum('light', 'dark') | No |
168
+
161
169
  #### `MenuAction`
162
170
 
163
171
  Object representing Menu Action.
@@ -1,7 +1,7 @@
1
1
  arguments=
2
2
  auto.sync=false
3
3
  build.scans.enabled=false
4
- connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0))
4
+ connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5
5
  connection.project.dir=
6
6
  eclipse.preferences.version=1
7
7
  gradle.user.home=
@@ -11,12 +11,12 @@ 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
16
  didSet { self._title = title as? String }
17
17
  }
18
-
19
- private var _actions: [UIAlertAction] = [];
18
+
19
+ private var _actions: [UIAlertAction] = []
20
20
  @objc var actions: [NSDictionary]? {
21
21
  didSet {
22
22
  guard let actions = self.actions else {
@@ -34,7 +34,12 @@ class ActionSheetView: UIView {
34
34
  }
35
35
 
36
36
  @objc var shouldOpenOnLongPress: Bool = false
37
-
37
+
38
+ private var _themeVariant: String?
39
+ @objc var themeVariant: NSString? {
40
+ didSet { self._themeVariant = themeVariant as? String }
41
+ }
42
+
38
43
  override init(frame: CGRect) {
39
44
  super.init(frame: frame)
40
45
  let tap = UITapGestureRecognizer(target: self, action: #selector (self.handleTap (_:)))
@@ -42,30 +47,42 @@ class ActionSheetView: UIView {
42
47
  self.addGestureRecognizer(tap)
43
48
  self.addGestureRecognizer(longPress)
44
49
  }
45
-
50
+
46
51
  func launchActionSheet() {
47
52
 
48
53
  let alert = UIAlertController(title: _title, message: nil, preferredStyle: .actionSheet)
49
54
 
55
+ if #available(iOS 13.0, *) {
56
+ if self._themeVariant != nil {
57
+ if self._themeVariant == "dark" {
58
+ alert.overrideUserInterfaceStyle = .dark
59
+ } else if self._themeVariant == "light" {
60
+ alert.overrideUserInterfaceStyle = .light
61
+ } else {
62
+ alert.overrideUserInterfaceStyle = .unspecified
63
+ }
64
+ }
65
+ }
66
+
50
67
  self._actions.forEach({action in
51
68
  alert.addAction(action.copy() as! UIAlertAction)
52
69
  })
53
-
70
+
54
71
  alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
55
-
72
+
56
73
  if UIDevice.current.userInterfaceIdiom == .pad {
57
74
  alert.modalPresentationStyle = .popover
58
75
  alert.popoverPresentationController?.sourceView = self
59
76
  alert.popoverPresentationController?.sourceRect = self.bounds
60
77
  }
61
-
78
+
62
79
  if let root = RCTPresentedViewController() {
63
80
  root.present(alert, animated: true, completion: nil)
64
81
  }
65
-
82
+
66
83
  }
67
-
68
-
84
+
85
+
69
86
  @objc func handleTap(_ sender:UITapGestureRecognizer) {
70
87
  if shouldOpenOnLongPress {
71
88
  return
@@ -76,7 +93,7 @@ class ActionSheetView: UIView {
76
93
  }
77
94
  }
78
95
  }
79
-
96
+
80
97
  @objc func handleLongPress(_ sender: UILongPressGestureRecognizer) {
81
98
  if !shouldOpenOnLongPress {
82
99
  return
@@ -87,19 +104,19 @@ class ActionSheetView: UIView {
87
104
  }
88
105
  }
89
106
  }
90
-
107
+
91
108
  @objc func sendButtonAction(_ action: String) {
92
109
  if let onPress = onPressAction {
93
110
  onPress(["event":action])
94
111
  }
95
112
  }
96
-
113
+
97
114
  required init?(coder: NSCoder) {
98
115
  fatalError("init(coder:) has not been implemented")
99
116
  }
100
-
117
+
101
118
  override func reactSetFrame(_ frame: CGRect) {
102
- super.reactSetFrame(frame);
103
- };
104
-
119
+ super.reactSetFrame(frame)
120
+ }
121
+
105
122
  }
@@ -42,6 +42,14 @@ class MenuView: UIButton {
42
42
  }
43
43
  }
44
44
 
45
+ private var _themeVariant: String?
46
+ @objc var themeVariant: NSString? {
47
+ didSet {
48
+ self._themeVariant = themeVariant as? String
49
+ self.setup()
50
+ }
51
+ }
52
+
45
53
  override init(frame: CGRect) {
46
54
  super.init(frame: frame)
47
55
  self.setup()
@@ -51,6 +59,16 @@ class MenuView: UIButton {
51
59
  func setup () {
52
60
  let menu = UIMenu(title:_title, identifier: nil, children: self._actions)
53
61
 
62
+ if self._themeVariant != nil {
63
+ if self._themeVariant == "dark" {
64
+ self.overrideUserInterfaceStyle = .dark
65
+ } else if self._themeVariant == "light" {
66
+ self.overrideUserInterfaceStyle = .light
67
+ } else {
68
+ self.overrideUserInterfaceStyle = .unspecified
69
+ }
70
+ }
71
+
54
72
  self.menu = menu
55
73
  self.showsMenuAsPrimaryAction = !shouldOpenOnLongPress
56
74
  }
@@ -19,5 +19,9 @@ RCT_EXPORT_VIEW_PROPERTY(onPressAction, RCTDirectEventBlock);
19
19
  * shouldOpenOnLongPress: determines whether menu should be opened after long press or normal press
20
20
  */
21
21
  RCT_EXPORT_VIEW_PROPERTY(shouldOpenOnLongPress, BOOL)
22
+ /**
23
+ * themeVariant: determines whether menu should use dark theme, light theme or system theme
24
+ */
25
+ RCT_EXPORT_VIEW_PROPERTY(themeVariant, NSString)
22
26
 
23
27
  @end
@@ -1 +1 @@
1
- {"version":3,"names":["MenuView","style","children"],"sources":["UIMenuView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\nimport type { NativeMenuComponentProps } from './types';\n\n/**\n * TODO: implement for Web\n */\nconst MenuView: React.FC<NativeMenuComponentProps> = ({ style, children }) => {\n return <View style={style}>{children}</View>;\n};\n\nexport default MenuView;\n"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAGA;AACA;AACA;AACA,MAAMA,QAA4C,GAAG,CAAC;EAAEC,KAAF;EAASC;AAAT,CAAD,KAAyB;EAC5E,oBAAO,oBAAC,iBAAD;IAAM,KAAK,EAAED;EAAb,GAAqBC,QAArB,CAAP;AACD,CAFD;;eAIeF,Q"}
1
+ {"version":3,"names":["MenuView","style","children"],"sources":["UIMenuView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\nimport type { NativeMenuComponentProps } from './types';\n\n/**\n * TODO: implement for Web\n */\nconst MenuView: React.FC<React.PropsWithChildren<NativeMenuComponentProps>> = ({\n style,\n children,\n}) => {\n return <View style={style}>{children}</View>;\n};\n\nexport default MenuView;\n"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAGA;AACA;AACA;AACA,MAAMA,QAAqE,GAAG,CAAC;EAC7EC,KAD6E;EAE7EC;AAF6E,CAAD,KAGxE;EACJ,oBAAO,oBAAC,iBAAD;IAAM,KAAK,EAAED;EAAb,GAAqBC,QAArB,CAAP;AACD,CALD;;eAOeF,Q"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n ColorValue,\n processColor,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type * as React from 'react';\n\nexport type NativeActionEvent = {\n nativeEvent: {\n event: string;\n };\n};\n\ntype MenuAttributes = {\n /**\n * An attribute indicating the destructive style.\n */\n destructive?: boolean;\n /**\n * An attribute indicating the disabled style.\n */\n disabled?: boolean;\n /**\n * An attribute indicating the hidden style.\n */\n hidden?: boolean;\n};\n\n/**\n * The state of the action.\n * - off: A constant indicating the menu element is in the “off” state.\n * - on: A constant indicating the menu element is in the “on” state.\n * - mixed: A constant indicating the menu element is in the “mixed” state.\n */\ntype MenuState = 'off' | 'on' | 'mixed';\n\nexport type MenuAction = {\n /**\n * Identifier of the menu action.\n * The value set in this id will be returned when menu is selected.\n */\n id?: string;\n /**\n * The action's title.\n */\n title: string;\n /**\n * (Android only)\n * The action's title color.\n * @platform Android\n */\n titleColor?: number | ColorValue;\n /**\n * (iOS14+ only)\n * An elaborated title that explains the purpose of the action.\n * @platform iOS\n */\n subtitle?: string;\n /**\n * The attributes indicating the style of the action.\n */\n attributes?: MenuAttributes;\n /**\n * (iOS14+ only)\n * The state of the action.\n * @platform iOS\n */\n state?: MenuState;\n /**\n * (Android and iOS13+ only)\n * - The action's image.\n * - Allows icon name included in project or system (Android) resources drawables and\n * in SF Symbol (iOS)\n * @example // (iOS)\n * image=\"plus\"\n * @example // (Android)\n * image=\"ic_menu_add\"\n * - TODO: Allow images other than those included in SF Symbol and resources drawables\n */\n image?: string;\n /**\n * (Android and iOS13+ only)\n * - The action's image color.\n */\n imageColor?: number | ColorValue;\n /**\n * (Android and iOS14+ only)\n * - Actions to be displayed in the sub menu\n * - On Android it does not support nesting next sub menus in sub menu item\n */\n subactions?: MenuAction[];\n /**\n * Whether subactions should be inline (separated by divider) or nested (sub menu)\n */\n displayInline?: boolean;\n};\n\ntype MenuComponentPropsBase = {\n style?: StyleProp<ViewStyle>;\n /**\n * Callback function that will be called when selecting a menu item.\n * It will contain id of the given action.\n */\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n /**\n * Actions to be displayed in the menu.\n */\n actions: MenuAction[];\n /**\n * The title of the menu.\n */\n title?: string;\n /**\n * (Android API 23+)\n * Boolean value determines whether popup menu should be anchored\n * to right corner of parent view - default value is `false`\n * @platform Android\n */\n isAnchoredToRight?: boolean;\n /**\n * Determines if menu should open after long press or on normal press\n *\n * @default false\n */\n shouldOpenOnLongPress?: boolean;\n};\n\nexport type MenuComponentProps =\n React.PropsWithChildren<MenuComponentPropsBase>;\n\nexport type ProcessedMenuAction = Omit<\n MenuAction,\n 'imageColor' | 'titleColor' | 'subactions'\n> & {\n imageColor: ReturnType<typeof processColor>;\n titleColor: ReturnType<typeof processColor>;\n subactions?: ProcessedMenuAction[];\n};\n\nexport type NativeMenuComponentProps = {\n style?: StyleProp<ViewStyle>;\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n actions: ProcessedMenuAction[];\n title?: string;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n ColorValue,\n processColor,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type * as React from 'react';\n\nexport type NativeActionEvent = {\n nativeEvent: {\n event: string;\n };\n};\n\ntype MenuAttributes = {\n /**\n * An attribute indicating the destructive style.\n */\n destructive?: boolean;\n /**\n * An attribute indicating the disabled style.\n */\n disabled?: boolean;\n /**\n * An attribute indicating the hidden style.\n */\n hidden?: boolean;\n};\n\n/**\n * The state of the action.\n * - off: A constant indicating the menu element is in the “off” state.\n * - on: A constant indicating the menu element is in the “on” state.\n * - mixed: A constant indicating the menu element is in the “mixed” state.\n */\ntype MenuState = 'off' | 'on' | 'mixed';\n\nexport type MenuAction = {\n /**\n * Identifier of the menu action.\n * The value set in this id will be returned when menu is selected.\n */\n id?: string;\n /**\n * The action's title.\n */\n title: string;\n /**\n * (Android only)\n * The action's title color.\n * @platform Android\n */\n titleColor?: number | ColorValue;\n /**\n * (iOS14+ only)\n * An elaborated title that explains the purpose of the action.\n * @platform iOS\n */\n subtitle?: string;\n /**\n * The attributes indicating the style of the action.\n */\n attributes?: MenuAttributes;\n /**\n * (iOS14+ only)\n * The state of the action.\n * @platform iOS\n */\n state?: MenuState;\n /**\n * (Android and iOS13+ only)\n * - The action's image.\n * - Allows icon name included in project or system (Android) resources drawables and\n * in SF Symbol (iOS)\n * @example // (iOS)\n * image=\"plus\"\n * @example // (Android)\n * image=\"ic_menu_add\"\n * - TODO: Allow images other than those included in SF Symbol and resources drawables\n */\n image?: string;\n /**\n * (Android and iOS13+ only)\n * - The action's image color.\n */\n imageColor?: number | ColorValue;\n /**\n * (Android and iOS14+ only)\n * - Actions to be displayed in the sub menu\n * - On Android it does not support nesting next sub menus in sub menu item\n */\n subactions?: MenuAction[];\n /**\n * Whether subactions should be inline (separated by divider) or nested (sub menu)\n */\n displayInline?: boolean;\n};\n\ntype MenuComponentPropsBase = {\n style?: StyleProp<ViewStyle>;\n /**\n * Callback function that will be called when selecting a menu item.\n * It will contain id of the given action.\n */\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n /**\n * Actions to be displayed in the menu.\n */\n actions: MenuAction[];\n /**\n * The title of the menu.\n */\n title?: string;\n /**\n * (Android API 23+)\n * Boolean value determines whether popup menu should be anchored\n * to right corner of parent view - default value is `false`\n * @platform Android\n */\n isAnchoredToRight?: boolean;\n /**\n * Determines if menu should open after long press or on normal press\n *\n * @default false\n */\n shouldOpenOnLongPress?: boolean;\n /**\n * Overrides theme variant of menu to light mode, dark mode or system theme\n * (Only support iOS for now)\n *\n * @platform iOS\n */\n themeVariant?: string;\n};\n\nexport type MenuComponentProps =\n React.PropsWithChildren<MenuComponentPropsBase>;\n\nexport type ProcessedMenuAction = Omit<\n MenuAction,\n 'imageColor' | 'titleColor' | 'subactions'\n> & {\n imageColor: ReturnType<typeof processColor>;\n titleColor: ReturnType<typeof processColor>;\n subactions?: ProcessedMenuAction[];\n};\n\nexport type NativeMenuComponentProps = {\n style?: StyleProp<ViewStyle>;\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n actions: ProcessedMenuAction[];\n title?: string;\n};\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","MenuView","style","children"],"sources":["UIMenuView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\nimport type { NativeMenuComponentProps } from './types';\n\n/**\n * TODO: implement for Web\n */\nconst MenuView: React.FC<NativeMenuComponentProps> = ({ style, children }) => {\n return <View style={style}>{children}</View>;\n};\n\nexport default MenuView;\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAAqB,cAArB;;AAGA;AACA;AACA;AACA,MAAMC,QAA4C,GAAG,CAAC;EAAEC,KAAF;EAASC;AAAT,CAAD,KAAyB;EAC5E,oBAAO,oBAAC,IAAD;IAAM,KAAK,EAAED;EAAb,GAAqBC,QAArB,CAAP;AACD,CAFD;;AAIA,eAAeF,QAAf"}
1
+ {"version":3,"names":["React","View","MenuView","style","children"],"sources":["UIMenuView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\nimport type { NativeMenuComponentProps } from './types';\n\n/**\n * TODO: implement for Web\n */\nconst MenuView: React.FC<React.PropsWithChildren<NativeMenuComponentProps>> = ({\n style,\n children,\n}) => {\n return <View style={style}>{children}</View>;\n};\n\nexport default MenuView;\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAAqB,cAArB;;AAGA;AACA;AACA;AACA,MAAMC,QAAqE,GAAG,CAAC;EAC7EC,KAD6E;EAE7EC;AAF6E,CAAD,KAGxE;EACJ,oBAAO,oBAAC,IAAD;IAAM,KAAK,EAAED;EAAb,GAAqBC,QAArB,CAAP;AACD,CALD;;AAOA,eAAeF,QAAf"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n ColorValue,\n processColor,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type * as React from 'react';\n\nexport type NativeActionEvent = {\n nativeEvent: {\n event: string;\n };\n};\n\ntype MenuAttributes = {\n /**\n * An attribute indicating the destructive style.\n */\n destructive?: boolean;\n /**\n * An attribute indicating the disabled style.\n */\n disabled?: boolean;\n /**\n * An attribute indicating the hidden style.\n */\n hidden?: boolean;\n};\n\n/**\n * The state of the action.\n * - off: A constant indicating the menu element is in the “off” state.\n * - on: A constant indicating the menu element is in the “on” state.\n * - mixed: A constant indicating the menu element is in the “mixed” state.\n */\ntype MenuState = 'off' | 'on' | 'mixed';\n\nexport type MenuAction = {\n /**\n * Identifier of the menu action.\n * The value set in this id will be returned when menu is selected.\n */\n id?: string;\n /**\n * The action's title.\n */\n title: string;\n /**\n * (Android only)\n * The action's title color.\n * @platform Android\n */\n titleColor?: number | ColorValue;\n /**\n * (iOS14+ only)\n * An elaborated title that explains the purpose of the action.\n * @platform iOS\n */\n subtitle?: string;\n /**\n * The attributes indicating the style of the action.\n */\n attributes?: MenuAttributes;\n /**\n * (iOS14+ only)\n * The state of the action.\n * @platform iOS\n */\n state?: MenuState;\n /**\n * (Android and iOS13+ only)\n * - The action's image.\n * - Allows icon name included in project or system (Android) resources drawables and\n * in SF Symbol (iOS)\n * @example // (iOS)\n * image=\"plus\"\n * @example // (Android)\n * image=\"ic_menu_add\"\n * - TODO: Allow images other than those included in SF Symbol and resources drawables\n */\n image?: string;\n /**\n * (Android and iOS13+ only)\n * - The action's image color.\n */\n imageColor?: number | ColorValue;\n /**\n * (Android and iOS14+ only)\n * - Actions to be displayed in the sub menu\n * - On Android it does not support nesting next sub menus in sub menu item\n */\n subactions?: MenuAction[];\n /**\n * Whether subactions should be inline (separated by divider) or nested (sub menu)\n */\n displayInline?: boolean;\n};\n\ntype MenuComponentPropsBase = {\n style?: StyleProp<ViewStyle>;\n /**\n * Callback function that will be called when selecting a menu item.\n * It will contain id of the given action.\n */\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n /**\n * Actions to be displayed in the menu.\n */\n actions: MenuAction[];\n /**\n * The title of the menu.\n */\n title?: string;\n /**\n * (Android API 23+)\n * Boolean value determines whether popup menu should be anchored\n * to right corner of parent view - default value is `false`\n * @platform Android\n */\n isAnchoredToRight?: boolean;\n /**\n * Determines if menu should open after long press or on normal press\n *\n * @default false\n */\n shouldOpenOnLongPress?: boolean;\n};\n\nexport type MenuComponentProps =\n React.PropsWithChildren<MenuComponentPropsBase>;\n\nexport type ProcessedMenuAction = Omit<\n MenuAction,\n 'imageColor' | 'titleColor' | 'subactions'\n> & {\n imageColor: ReturnType<typeof processColor>;\n titleColor: ReturnType<typeof processColor>;\n subactions?: ProcessedMenuAction[];\n};\n\nexport type NativeMenuComponentProps = {\n style?: StyleProp<ViewStyle>;\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n actions: ProcessedMenuAction[];\n title?: string;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n ColorValue,\n processColor,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type * as React from 'react';\n\nexport type NativeActionEvent = {\n nativeEvent: {\n event: string;\n };\n};\n\ntype MenuAttributes = {\n /**\n * An attribute indicating the destructive style.\n */\n destructive?: boolean;\n /**\n * An attribute indicating the disabled style.\n */\n disabled?: boolean;\n /**\n * An attribute indicating the hidden style.\n */\n hidden?: boolean;\n};\n\n/**\n * The state of the action.\n * - off: A constant indicating the menu element is in the “off” state.\n * - on: A constant indicating the menu element is in the “on” state.\n * - mixed: A constant indicating the menu element is in the “mixed” state.\n */\ntype MenuState = 'off' | 'on' | 'mixed';\n\nexport type MenuAction = {\n /**\n * Identifier of the menu action.\n * The value set in this id will be returned when menu is selected.\n */\n id?: string;\n /**\n * The action's title.\n */\n title: string;\n /**\n * (Android only)\n * The action's title color.\n * @platform Android\n */\n titleColor?: number | ColorValue;\n /**\n * (iOS14+ only)\n * An elaborated title that explains the purpose of the action.\n * @platform iOS\n */\n subtitle?: string;\n /**\n * The attributes indicating the style of the action.\n */\n attributes?: MenuAttributes;\n /**\n * (iOS14+ only)\n * The state of the action.\n * @platform iOS\n */\n state?: MenuState;\n /**\n * (Android and iOS13+ only)\n * - The action's image.\n * - Allows icon name included in project or system (Android) resources drawables and\n * in SF Symbol (iOS)\n * @example // (iOS)\n * image=\"plus\"\n * @example // (Android)\n * image=\"ic_menu_add\"\n * - TODO: Allow images other than those included in SF Symbol and resources drawables\n */\n image?: string;\n /**\n * (Android and iOS13+ only)\n * - The action's image color.\n */\n imageColor?: number | ColorValue;\n /**\n * (Android and iOS14+ only)\n * - Actions to be displayed in the sub menu\n * - On Android it does not support nesting next sub menus in sub menu item\n */\n subactions?: MenuAction[];\n /**\n * Whether subactions should be inline (separated by divider) or nested (sub menu)\n */\n displayInline?: boolean;\n};\n\ntype MenuComponentPropsBase = {\n style?: StyleProp<ViewStyle>;\n /**\n * Callback function that will be called when selecting a menu item.\n * It will contain id of the given action.\n */\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n /**\n * Actions to be displayed in the menu.\n */\n actions: MenuAction[];\n /**\n * The title of the menu.\n */\n title?: string;\n /**\n * (Android API 23+)\n * Boolean value determines whether popup menu should be anchored\n * to right corner of parent view - default value is `false`\n * @platform Android\n */\n isAnchoredToRight?: boolean;\n /**\n * Determines if menu should open after long press or on normal press\n *\n * @default false\n */\n shouldOpenOnLongPress?: boolean;\n /**\n * Overrides theme variant of menu to light mode, dark mode or system theme\n * (Only support iOS for now)\n *\n * @platform iOS\n */\n themeVariant?: string;\n};\n\nexport type MenuComponentProps =\n React.PropsWithChildren<MenuComponentPropsBase>;\n\nexport type ProcessedMenuAction = Omit<\n MenuAction,\n 'imageColor' | 'titleColor' | 'subactions'\n> & {\n imageColor: ReturnType<typeof processColor>;\n titleColor: ReturnType<typeof processColor>;\n subactions?: ProcessedMenuAction[];\n};\n\nexport type NativeMenuComponentProps = {\n style?: StyleProp<ViewStyle>;\n onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;\n actions: ProcessedMenuAction[];\n title?: string;\n};\n"],"mappings":""}
@@ -3,5 +3,5 @@ import type { NativeMenuComponentProps } from './types';
3
3
  /**
4
4
  * TODO: implement for Web
5
5
  */
6
- declare const MenuView: React.FC<NativeMenuComponentProps>;
6
+ declare const MenuView: React.FC<React.PropsWithChildren<NativeMenuComponentProps>>;
7
7
  export default MenuView;
@@ -114,6 +114,13 @@ declare type MenuComponentPropsBase = {
114
114
  * @default false
115
115
  */
116
116
  shouldOpenOnLongPress?: boolean;
117
+ /**
118
+ * Overrides theme variant of menu to light mode, dark mode or system theme
119
+ * (Only support iOS for now)
120
+ *
121
+ * @platform iOS
122
+ */
123
+ themeVariant?: string;
117
124
  };
118
125
  export declare type MenuComponentProps = React.PropsWithChildren<MenuComponentPropsBase>;
119
126
  export declare type ProcessedMenuAction = Omit<MenuAction, 'imageColor' | 'titleColor' | 'subactions'> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-menu/menu",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "UIMenu component for react-native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -43,22 +43,22 @@
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": "^3.0.0",
46
+ "@react-native/eslint-config": "^0.72.2",
47
47
  "@release-it/conventional-changelog": "^3.0.1",
48
48
  "@types/jest": "^29.1.2",
49
- "@types/react": "^17.0.1",
50
- "@types/react-native": "0.67.6",
51
- "eslint": "8.26.0",
52
- "eslint-config-prettier": "^8.1.0",
49
+ "@types/react": "^18.2.2",
50
+ "@types/react-native": "0.72.2",
51
+ "eslint": "8.47.0",
52
+ "eslint-config-prettier": "^9.0.0",
53
53
  "eslint-plugin-prettier": "^4.2.1",
54
54
  "jest": "^29.1.2",
55
55
  "pod-install": "^0.1.0",
56
56
  "prettier": "^2.2.1",
57
- "react": "17.0.1",
58
- "react-native": "0.64.4",
59
- "react-native-test-app": "^2.0.0",
57
+ "react": "18.2.0",
58
+ "react-native": "0.72.2",
59
+ "react-native-test-app": "^2.5.20",
60
60
  "release-it": "^14.10.0",
61
- "typescript": "^4.1.3"
61
+ "typescript": "4.8.4"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "react": "*",
@@ -90,7 +90,7 @@
90
90
  },
91
91
  "eslintConfig": {
92
92
  "extends": [
93
- "@react-native-community",
93
+ "@react-native",
94
94
  "prettier"
95
95
  ],
96
96
  "rules": {
@@ -5,7 +5,10 @@ import type { NativeMenuComponentProps } from './types';
5
5
  /**
6
6
  * TODO: implement for Web
7
7
  */
8
- const MenuView: React.FC<NativeMenuComponentProps> = ({ style, children }) => {
8
+ const MenuView: React.FC<React.PropsWithChildren<NativeMenuComponentProps>> = ({
9
+ style,
10
+ children,
11
+ }) => {
9
12
  return <View style={style}>{children}</View>;
10
13
  };
11
14
 
package/src/types.ts CHANGED
@@ -124,6 +124,13 @@ type MenuComponentPropsBase = {
124
124
  * @default false
125
125
  */
126
126
  shouldOpenOnLongPress?: boolean;
127
+ /**
128
+ * Overrides theme variant of menu to light mode, dark mode or system theme
129
+ * (Only support iOS for now)
130
+ *
131
+ * @platform iOS
132
+ */
133
+ themeVariant?: string;
127
134
  };
128
135
 
129
136
  export type MenuComponentProps =