@react-native-menu/menu 1.0.3 → 1.1.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 +13 -9
- package/android/build.gradle +1 -1
- package/android/gradle.properties +1 -1
- package/ios/MenuViewManager.mm +1 -1
- package/lib/commonjs/utils.js +1 -0
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/utils.js +1 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/src/types.d.ts +4 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/types.ts +5 -5
- package/src/utils.ts +1 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Android PopupMenu and iOS14+ UIMenu components for react-native.
|
|
|
6
6
|
Falls back to ActionSheet for versions below iOS14.
|
|
7
7
|
|
|
8
8
|
| Android | iOS 14+ | iOS 13 |
|
|
9
|
-
|
|
9
|
+
|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
|
|
10
10
|
| <img src="https://user-images.githubusercontent.com/6936373/112418277-827ac380-8d6c-11eb-96e2-324487ff3dde.png" width="320" /> | <img src="https://user-images.githubusercontent.com/6936373/112418272-80b10000-8d6c-11eb-9edb-f91eeff0877e.png" width="320" /> | <img src="https://user-images.githubusercontent.com/6936373/98471162-cb9f0080-222d-11eb-89ef-9342a1f10893.png" width="320" /> |
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
@@ -135,6 +135,10 @@ const App = () => {
|
|
|
135
135
|
};
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
### Declarative usage
|
|
139
|
+
|
|
140
|
+
It's also possible to obtain the `action` is a more React-ish, declarative fashion. Refer to the [`react-to-imperative`](https://github.com/vonovak/react-to-imperative?tab=readme-ov-file#why) package, and see an example [here](https://github.com/vonovak/react-navigation-header-buttons/blob/cca6ce6d04d3b106efe7aa62279101db33c7941b/example/src/screens/UsageNativeMenu.tsx#L62).
|
|
141
|
+
|
|
138
142
|
## Reference
|
|
139
143
|
|
|
140
144
|
### Props
|
|
@@ -144,7 +148,7 @@ const App = () => {
|
|
|
144
148
|
The title of the menu.
|
|
145
149
|
|
|
146
150
|
| Type | Required |
|
|
147
|
-
|
|
151
|
+
|--------|----------|
|
|
148
152
|
| string | Yes |
|
|
149
153
|
|
|
150
154
|
### `isAnchoredToRight` (Android only)
|
|
@@ -152,7 +156,7 @@ The title of the menu.
|
|
|
152
156
|
Boolean determining if menu should anchored to right or left corner of parent view.
|
|
153
157
|
|
|
154
158
|
| Type | Required |
|
|
155
|
-
|
|
159
|
+
|---------|----------|
|
|
156
160
|
| boolean | No |
|
|
157
161
|
|
|
158
162
|
### `shouldOpenOnLongPress`
|
|
@@ -160,7 +164,7 @@ Boolean determining if menu should anchored to right or left corner of parent vi
|
|
|
160
164
|
Boolean determining if menu should open after long press or on normal press
|
|
161
165
|
|
|
162
166
|
| Type | Required |
|
|
163
|
-
|
|
167
|
+
|---------|----------|
|
|
164
168
|
| boolean | No |
|
|
165
169
|
|
|
166
170
|
### `actions`
|
|
@@ -168,16 +172,16 @@ Boolean determining if menu should open after long press or on normal press
|
|
|
168
172
|
Actions to be displayed in the menu.
|
|
169
173
|
|
|
170
174
|
| Type | Required |
|
|
171
|
-
|
|
175
|
+
|--------------|----------|
|
|
172
176
|
| MenuAction[] | Yes |
|
|
173
177
|
|
|
174
178
|
### `themeVariant` (iOS only)
|
|
175
179
|
|
|
176
180
|
String to override theme of the menu. If you want to control theme universally across your app, [see this package](https://github.com/vonovak/react-native-theme-control).
|
|
177
181
|
|
|
178
|
-
| Type
|
|
179
|
-
|
|
180
|
-
| enum('light', 'dark') | No
|
|
182
|
+
| Type | Required |
|
|
183
|
+
|-----------------------|----------|
|
|
184
|
+
| enum('light', 'dark') | No |
|
|
181
185
|
|
|
182
186
|
#### `MenuAction`
|
|
183
187
|
|
|
@@ -282,7 +286,7 @@ Callback function that will be called when selecting a menu item.
|
|
|
282
286
|
It will contain id of the given action.
|
|
283
287
|
|
|
284
288
|
| Type | Required |
|
|
285
|
-
|
|
289
|
+
|-------------------------|----------|
|
|
286
290
|
| ({nativeEvent}) => void | No |
|
|
287
291
|
|
|
288
292
|
## Contributing
|
package/android/build.gradle
CHANGED
|
@@ -56,7 +56,7 @@ android {
|
|
|
56
56
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
57
57
|
|
|
58
58
|
defaultConfig {
|
|
59
|
-
minSdkVersion
|
|
59
|
+
minSdkVersion 23
|
|
60
60
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
61
61
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
62
62
|
versionCode 1
|
package/ios/MenuViewManager.mm
CHANGED
package/lib/commonjs/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hashCode","str","hash","i","length","char","charCodeAt","objectHash","obj","jsonString","JSON","stringify","String"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA;AACA,SAASA,QAAQA,CAACC,GAAW,EAAU;EACrC,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACnC,MAAME,IAAI,GAAGJ,GAAG,CAACK,UAAU,CAACH,CAAC,CAAC;
|
|
1
|
+
{"version":3,"names":["hashCode","str","hash","i","length","char","charCodeAt","objectHash","obj","jsonString","JSON","stringify","String"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA;AACA,SAASA,QAAQA,CAACC,GAAW,EAAU;EACrC,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACnC,MAAME,IAAI,GAAGJ,GAAG,CAACK,UAAU,CAACH,CAAC,CAAC;IAC9B;IACAD,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGG,IAAI;EAClC;EACA,OAAOH,IAAI;AACb;;AAEA;AACO,SAASK,UAAUA,CAACC,GAAwB,EAAU;EAC3D,IAAI,CAACA,GAAG,EAAE;IACR,OAAO,EAAE;EACX;EACA;EACA,MAAMC,UAAU,GAAGC,IAAI,CAACC,SAAS,CAACH,GAAG,CAAC;;EAEtC;EACA,MAAMN,IAAI,GAAGF,QAAQ,CAACS,UAAU,CAAC;;EAEjC;EACA,OAAOG,MAAM,CAACV,IAAI,CAAC;AACrB"}
|
package/lib/module/utils.js
CHANGED
package/lib/module/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hashCode","str","hash","i","length","char","charCodeAt","objectHash","obj","jsonString","JSON","stringify","String"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAAA;AACA,SAASA,QAAQA,CAACC,GAAW,EAAU;EACrC,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACnC,MAAME,IAAI,GAAGJ,GAAG,CAACK,UAAU,CAACH,CAAC,CAAC;
|
|
1
|
+
{"version":3,"names":["hashCode","str","hash","i","length","char","charCodeAt","objectHash","obj","jsonString","JSON","stringify","String"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAAA;AACA,SAASA,QAAQA,CAACC,GAAW,EAAU;EACrC,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACnC,MAAME,IAAI,GAAGJ,GAAG,CAACK,UAAU,CAACH,CAAC,CAAC;IAC9B;IACAD,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGG,IAAI;EAClC;EACA,OAAOH,IAAI;AACb;;AAEA;AACA,OAAO,SAASK,UAAUA,CAACC,GAAwB,EAAU;EAC3D,IAAI,CAACA,GAAG,EAAE;IACR,OAAO,EAAE;EACX;EACA;EACA,MAAMC,UAAU,GAAGC,IAAI,CAACC,SAAS,CAACH,GAAG,CAAC;;EAEtC;EACA,MAAMN,IAAI,GAAGF,QAAQ,CAACS,UAAU,CAAC;;EAEjC;EACA,OAAOG,MAAM,CAACV,IAAI,CAAC;AACrB"}
|
|
@@ -92,10 +92,10 @@ export type MenuAction = {
|
|
|
92
92
|
*/
|
|
93
93
|
displayInline?: boolean;
|
|
94
94
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
* (iOS 16+ only)
|
|
96
|
+
* The preferred size of this menu's child elements.
|
|
97
|
+
* @platform iOS
|
|
98
|
+
*/
|
|
99
99
|
preferredElementSize?: 'small' | 'medium' | 'large';
|
|
100
100
|
};
|
|
101
101
|
type MenuComponentPropsBase = {
|
|
@@ -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,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;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,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,UAAU,EACV,YAAY,GAAG,YAAY,GAAG,YAAY,CAC3C,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAYA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAY3D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-menu/menu",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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.
|
|
51
|
+
"@react-native/metro-config": "0.74.84",
|
|
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",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"react": "18.2.0",
|
|
65
65
|
"react-native": "^0.73.0",
|
|
66
66
|
"react-native-builder-bob": "^0.23.2",
|
|
67
|
-
"react-native-test-app": "^3.2
|
|
67
|
+
"react-native-test-app": "^3.7.2",
|
|
68
68
|
"release-it": "^17.2.0",
|
|
69
69
|
"typescript": "5.4.5"
|
|
70
70
|
},
|
package/src/types.ts
CHANGED
|
@@ -99,12 +99,12 @@ export type MenuAction = {
|
|
|
99
99
|
/**
|
|
100
100
|
* Whether subactions should be inline (separated by divider) or nested (sub menu)
|
|
101
101
|
*/
|
|
102
|
-
displayInline?: boolean;
|
|
102
|
+
displayInline?: boolean;
|
|
103
103
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
* (iOS 16+ only)
|
|
105
|
+
* The preferred size of this menu's child elements.
|
|
106
|
+
* @platform iOS
|
|
107
|
+
*/
|
|
108
108
|
preferredElementSize?: 'small' | 'medium' | 'large';
|
|
109
109
|
};
|
|
110
110
|
|