@react-native-menu/menu 2.1.1 → 2.2.0

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/Package.swift ADDED
@@ -0,0 +1,85 @@
1
+ // swift-tools-version: 6.0
2
+
3
+ import Foundation
4
+ import PackageDescription
5
+
6
+ // React Native evaluates this package through build/generated/autolinking/libs/.
7
+ let reactHeaders: [Target.Dependency] = [
8
+ .product(name: "ReactHeaders", package: "ReactNative"),
9
+ .product(name: "ReactNativeHeaders", package: "ReactNative"),
10
+ .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
11
+ .product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
12
+ ]
13
+
14
+ // The Swift import shim lives outside ios/. Keep unrelated repository and npm
15
+ // package contents out of SwiftPM's resource discovery.
16
+ let usedRootEntries: Set<String> = ["ios", "spm-support", "spm-headers", "Package.swift"]
17
+ let unusedRootEntries = try! FileManager.default.contentsOfDirectory(atPath: Context.packageDirectory)
18
+ .filter { !usedRootEntries.contains($0) }
19
+ .sorted()
20
+
21
+ // Discover sources as folders, splitting the podspec's native and Swift files.
22
+ // Exclude projects and non-source files from both targets.
23
+ let iosDirectory = URL(fileURLWithPath: Context.packageDirectory).appendingPathComponent("ios")
24
+ let iosEntries = try! FileManager.default.subpathsOfDirectory(atPath: iosDirectory.path)
25
+ .filter { !$0.contains(".xcodeproj/") }
26
+ func unusedIosEntries(sourceExtensions: Set<String>) -> [String] {
27
+ iosEntries.filter { entry in
28
+ let url = iosDirectory.appendingPathComponent(entry)
29
+ if url.pathExtension == "xcodeproj" { return true }
30
+ let isFile = try! url.resourceValues(forKeys: [.isRegularFileKey]).isRegularFile == true
31
+ return isFile && (!sourceExtensions.contains(url.pathExtension)
32
+ || entry == "Menu-Bridging-Header.h")
33
+ }
34
+ .map { "ios/" + $0 }
35
+ .sorted()
36
+ }
37
+ let unusedSwiftIosEntries = unusedIosEntries(sourceExtensions: ["swift"])
38
+ let unusedObjCIosEntries = unusedIosEntries(sourceExtensions: ["h", "m", "mm"])
39
+
40
+ let package = Package(
41
+ name: "react_native_menu",
42
+ platforms: [.iOS("15.1")],
43
+ products: [
44
+ .library(name: "react_native_menu", targets: ["react_native_menu", "ReactNativeMenuObjC"]),
45
+ ],
46
+ dependencies: [
47
+ .package(name: "ReactNative", path: "../../../../xcframeworks"),
48
+ .package(name: "React-GeneratedCode", path: "../../../ios"),
49
+ ],
50
+ targets: [
51
+ // Preserve the CocoaPods Swift module name. Swift depends on React only;
52
+ // the Fabric adapter below depends on Swift, avoiding a target cycle.
53
+ .target(
54
+ name: "react_native_menu",
55
+ dependencies: reactHeaders,
56
+ path: ".",
57
+ exclude: unusedRootEntries + ["spm-headers"] + unusedSwiftIosEntries,
58
+ sources: ["ios/Shared", "ios/OldArch", "ios/NewArch", "spm-support"]
59
+ ),
60
+ .target(
61
+ name: "ReactNativeMenuObjC",
62
+ dependencies: [.target(name: "react_native_menu")] + reactHeaders,
63
+ // Root the target here so its empty public module stays outside ios/.
64
+ path: ".",
65
+ exclude: unusedRootEntries + ["spm-support"] + unusedObjCIosEntries,
66
+ sources: ["ios"],
67
+ // Required: without it SwiftPM looks for a default include/ folder, which this target does not have.
68
+ publicHeadersPath: "spm-headers/public",
69
+ cSettings: [
70
+ .define("RCT_NEW_ARCH_ENABLED", to: "1"),
71
+ .headerSearchPath("ios/NewArch"),
72
+ .headerSearchPath("spm-headers"),
73
+ ],
74
+ cxxSettings: [
75
+ .define("RCT_NEW_ARCH_ENABLED", to: "1"),
76
+ .define("DEBUG", .when(configuration: .debug)),
77
+ .define("NDEBUG", .when(configuration: .release)),
78
+ .headerSearchPath("ios/NewArch"),
79
+ .headerSearchPath("spm-headers"),
80
+ ]
81
+ ),
82
+ ],
83
+ swiftLanguageModes: [.v5],
84
+ cxxLanguageStandard: .cxx20
85
+ )
@@ -1,6 +1,6 @@
1
1
  #import <React/RCTViewManager.h>
2
2
  #import <React/RCTUIManager.h>
3
- #import "RCTBridge.h"
3
+ #import <React/RCTBridge.h>
4
4
 
5
5
  #ifdef RCT_NEW_ARCH_ENABLED
6
6
  // NEW ARCH
@@ -1,3 +1,9 @@
1
+ // biome-ignore-start lint/suspicious/noReactNativeDeepImports: this is a codegen spec file.
2
+ // React Native's codegen parses these imports directly and expects CodegenTypes and
3
+ // codegenNativeComponent on these exact paths. react-native/index.js does re-export
4
+ // codegenNativeComponent, but rewriting an import that codegen parses risks breaking native
5
+ // builds for no benefit -- see the note on this file in CLAUDE.md. Scoped to this import
6
+ // block rather than the whole file, so accidental deep imports below are still caught.
1
7
  import type {
2
8
  DirectEventHandler,
3
9
  Int32,
@@ -5,6 +11,7 @@ import type {
5
11
  } from "react-native/Libraries/Types/CodegenTypes";
6
12
  import type { HostComponent, ViewProps } from "react-native";
7
13
  import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
14
+ // biome-ignore-end lint/suspicious/noReactNativeDeepImports: end of the codegen import block.
8
15
 
9
16
  /*
10
17
  Caution, those below are not just typescript types.
@@ -6,11 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _react = require("react");
9
- var _codegenNativeCommands = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
10
9
  var _jsxRuntime = require("react/jsx-runtime");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
10
  const NativeMenuComponent = (0, _reactNative.requireNativeComponent)("MenuView");
13
- const Commands = (0, _codegenNativeCommands.default)({
11
+ const Commands = (0, _reactNative.codegenNativeCommands)({
14
12
  supportedCommands: ["show"]
15
13
  });
16
14
  const MenuComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_react","_codegenNativeCommands","_interopRequireDefault","_jsxRuntime","e","__esModule","default","NativeMenuComponent","requireNativeComponent","Commands","codegenNativeCommands","supportedCommands","MenuComponent","forwardRef","props","ref","nativeRef","useRef","useImperativeHandle","show","current","isFabric","global","nativeFabricUIManager","node","findNodeHandle","command","UIManager","getViewManagerConfig","dispatchViewManagerCommand","undefined","jsx","_default","exports"],"sourceRoot":"../../src","sources":["UIMenuView.android.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA2F,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3F,MAAMG,mBAAmB,GAAG,IAAAC,mCAAsB,EACjD,UACD,CAA4C;AAI5C,MAAMC,QAAQ,GAAG,IAAAC,8BAAqB,EAEnC;EACFC,iBAAiB,EAAE,CAAC,MAAM;AAC3B,CAAC,CAAC;AAEF,MAAMC,aAAa,gBAAG,IAAAC,iBAAU,EAC/B,CAACC,KAAK,EAAEC,GAAG,KAAK;EACf,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAE9B,IAAAC,0BAAmB,EAClBH,GAAG,EACH,OAAO;IACNI,IAAI,EAAEA,CAAA,KAAM;MACX,IAAIH,SAAS,CAACI,OAAO,EAAE;QACtB;QACA,MAAMC,QAAQ,GAAG,CAAC,CAAEC,MAAM,CAASC,qBAAqB;QAExD,IAAIF,QAAQ,EAAE;UACbZ,QAAQ,CAACU,IAAI,CAACH,SAAS,CAACI,OAAO,CAAC;QACjC,CAAC,MAAM;UACN,MAAMI,IAAI,GAAG,IAAAC,2BAAc,EAACT,SAAS,CAACI,OAAO,CAAC;UAC9C,MAAMM,OAAO,GACZC,sBAAS,CAACC,oBAAoB,CAAC,UAAU,CAAC,CAACnB,QAAQ,CAACU,IAAI;UAEzDQ,sBAAS,CAACE,0BAA0B,CAACL,IAAI,EAAEE,OAAO,EAAEI,SAAS,CAAC;QAC/D;MACD;IACD;EACD,CAAC,CAAC,EACF,EACD,CAAC;EAED,oBAAO,IAAA3B,WAAA,CAAA4B,GAAA,EAACxB,mBAAmB;IAAA,GAAKO,KAAK;IAAEC,GAAG,EAAEC;EAAU,CAAE,CAAC;AAC1D,CACD,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAA3B,OAAA,GAEaM,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_react","_jsxRuntime","NativeMenuComponent","requireNativeComponent","Commands","codegenNativeCommands","supportedCommands","MenuComponent","forwardRef","props","ref","nativeRef","useRef","useImperativeHandle","show","current","isFabric","global","nativeFabricUIManager","node","findNodeHandle","command","UIManager","getViewManagerConfig","dispatchViewManagerCommand","undefined","jsx","_default","exports","default"],"sourceRoot":"../../src","sources":["UIMenuView.android.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AAAgE,IAAAE,WAAA,GAAAF,OAAA;AAEhE,MAAMG,mBAAmB,GAAG,IAAAC,mCAAsB,EACjD,UACD,CAA4C;AAI5C,MAAMC,QAAQ,GAAG,IAAAC,kCAAqB,EAEnC;EACFC,iBAAiB,EAAE,CAAC,MAAM;AAC3B,CAAC,CAAC;AAEF,MAAMC,aAAa,gBAAG,IAAAC,iBAAU,EAC/B,CAACC,KAAK,EAAEC,GAAG,KAAK;EACf,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAE9B,IAAAC,0BAAmB,EAClBH,GAAG,EACH,OAAO;IACNI,IAAI,EAAEA,CAAA,KAAM;MACX,IAAIH,SAAS,CAACI,OAAO,EAAE;QACtB;QACA,MAAMC,QAAQ,GAAG,CAAC,CAAEC,MAAM,CAASC,qBAAqB;QAExD,IAAIF,QAAQ,EAAE;UACbZ,QAAQ,CAACU,IAAI,CAACH,SAAS,CAACI,OAAO,CAAC;QACjC,CAAC,MAAM;UACN,MAAMI,IAAI,GAAG,IAAAC,2BAAc,EAACT,SAAS,CAACI,OAAO,CAAC;UAC9C,MAAMM,OAAO,GACZC,sBAAS,CAACC,oBAAoB,CAAC,UAAU,CAAC,CAACnB,QAAQ,CAACU,IAAI;UAEzDQ,sBAAS,CAACE,0BAA0B,CAACL,IAAI,EAAEE,OAAO,EAAEI,SAAS,CAAC;QAC/D;MACD;IACD;EACD,CAAC,CAAC,EACF,EACD,CAAC;EAED,oBAAO,IAAAxB,WAAA,CAAAyB,GAAA,EAACxB,mBAAmB;IAAA,GAAKO,KAAK;IAAEC,GAAG,EAAEC;EAAU,CAAE,CAAC;AAC1D,CACD,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEatB,aAAa","ignoreList":[]}
@@ -1,3 +1,9 @@
1
+ // biome-ignore-start lint/suspicious/noReactNativeDeepImports: this is a codegen spec file.
2
+ // React Native's codegen parses these imports directly and expects CodegenTypes and
3
+ // codegenNativeComponent on these exact paths. react-native/index.js does re-export
4
+ // codegenNativeComponent, but rewriting an import that codegen parses risks breaking native
5
+ // builds for no benefit -- see the note on this file in CLAUDE.md. Scoped to this import
6
+ // block rather than the whole file, so accidental deep imports below are still caught.
1
7
  import type {
2
8
  DirectEventHandler,
3
9
  Int32,
@@ -5,6 +11,7 @@ import type {
5
11
  } from "react-native/Libraries/Types/CodegenTypes";
6
12
  import type { HostComponent, ViewProps } from "react-native";
7
13
  import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
14
+ // biome-ignore-end lint/suspicious/noReactNativeDeepImports: end of the codegen import block.
8
15
 
9
16
  /*
10
17
  Caution, those below are not just typescript types.
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import { findNodeHandle, requireNativeComponent, UIManager } from "react-native";
3
+ import { codegenNativeCommands, findNodeHandle, requireNativeComponent, UIManager } from "react-native";
4
4
  import { forwardRef, useImperativeHandle, useRef } from "react";
5
- import codegenNativeCommands from "react-native/Libraries/Utilities/codegenNativeCommands";
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  const NativeMenuComponent = requireNativeComponent("MenuView");
8
7
  const Commands = codegenNativeCommands({
@@ -1 +1 @@
1
- {"version":3,"names":["findNodeHandle","requireNativeComponent","UIManager","forwardRef","useImperativeHandle","useRef","codegenNativeCommands","jsx","_jsx","NativeMenuComponent","Commands","supportedCommands","MenuComponent","props","ref","nativeRef","show","current","isFabric","global","nativeFabricUIManager","node","command","getViewManagerConfig","dispatchViewManagerCommand","undefined"],"sourceRoot":"../../src","sources":["UIMenuView.android.tsx"],"mappings":";;AAAA,SACCA,cAAc,EAEdC,sBAAsB,EACtBC,SAAS,QACH,cAAc;AAErB,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,MAAM,QAAQ,OAAO;AAC/D,OAAOC,qBAAqB,MAAM,wDAAwD;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3F,MAAMC,mBAAmB,GAAGR,sBAAsB,CACjD,UACD,CAA4C;AAI5C,MAAMS,QAAQ,GAAGJ,qBAAqB,CAEnC;EACFK,iBAAiB,EAAE,CAAC,MAAM;AAC3B,CAAC,CAAC;AAEF,MAAMC,aAAa,gBAAGT,UAAU,CAC/B,CAACU,KAAK,EAAEC,GAAG,KAAK;EACf,MAAMC,SAAS,GAAGV,MAAM,CAAC,IAAI,CAAC;EAE9BD,mBAAmB,CAClBU,GAAG,EACH,OAAO;IACNE,IAAI,EAAEA,CAAA,KAAM;MACX,IAAID,SAAS,CAACE,OAAO,EAAE;QACtB;QACA,MAAMC,QAAQ,GAAG,CAAC,CAAEC,MAAM,CAASC,qBAAqB;QAExD,IAAIF,QAAQ,EAAE;UACbR,QAAQ,CAACM,IAAI,CAACD,SAAS,CAACE,OAAO,CAAC;QACjC,CAAC,MAAM;UACN,MAAMI,IAAI,GAAGrB,cAAc,CAACe,SAAS,CAACE,OAAO,CAAC;UAC9C,MAAMK,OAAO,GACZpB,SAAS,CAACqB,oBAAoB,CAAC,UAAU,CAAC,CAACb,QAAQ,CAACM,IAAI;UAEzDd,SAAS,CAACsB,0BAA0B,CAACH,IAAI,EAAEC,OAAO,EAAEG,SAAS,CAAC;QAC/D;MACD;IACD;EACD,CAAC,CAAC,EACF,EACD,CAAC;EAED,oBAAOjB,IAAA,CAACC,mBAAmB;IAAA,GAAKI,KAAK;IAAEC,GAAG,EAAEC;EAAU,CAAE,CAAC;AAC1D,CACD,CAAC;AAED,eAAeH,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["codegenNativeCommands","findNodeHandle","requireNativeComponent","UIManager","forwardRef","useImperativeHandle","useRef","jsx","_jsx","NativeMenuComponent","Commands","supportedCommands","MenuComponent","props","ref","nativeRef","show","current","isFabric","global","nativeFabricUIManager","node","command","getViewManagerConfig","dispatchViewManagerCommand","undefined"],"sourceRoot":"../../src","sources":["UIMenuView.android.tsx"],"mappings":";;AAAA,SACCA,qBAAqB,EACrBC,cAAc,EAEdC,sBAAsB,EACtBC,SAAS,QACH,cAAc;AAErB,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,MAAM,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhE,MAAMC,mBAAmB,GAAGP,sBAAsB,CACjD,UACD,CAA4C;AAI5C,MAAMQ,QAAQ,GAAGV,qBAAqB,CAEnC;EACFW,iBAAiB,EAAE,CAAC,MAAM;AAC3B,CAAC,CAAC;AAEF,MAAMC,aAAa,gBAAGR,UAAU,CAC/B,CAACS,KAAK,EAAEC,GAAG,KAAK;EACf,MAAMC,SAAS,GAAGT,MAAM,CAAC,IAAI,CAAC;EAE9BD,mBAAmB,CAClBS,GAAG,EACH,OAAO;IACNE,IAAI,EAAEA,CAAA,KAAM;MACX,IAAID,SAAS,CAACE,OAAO,EAAE;QACtB;QACA,MAAMC,QAAQ,GAAG,CAAC,CAAEC,MAAM,CAASC,qBAAqB;QAExD,IAAIF,QAAQ,EAAE;UACbR,QAAQ,CAACM,IAAI,CAACD,SAAS,CAACE,OAAO,CAAC;QACjC,CAAC,MAAM;UACN,MAAMI,IAAI,GAAGpB,cAAc,CAACc,SAAS,CAACE,OAAO,CAAC;UAC9C,MAAMK,OAAO,GACZnB,SAAS,CAACoB,oBAAoB,CAAC,UAAU,CAAC,CAACb,QAAQ,CAACM,IAAI;UAEzDb,SAAS,CAACqB,0BAA0B,CAACH,IAAI,EAAEC,OAAO,EAAEG,SAAS,CAAC;QAC/D;MACD;IACD;EACD,CAAC,CAAC,EACF,EACD,CAAC;EAED,oBAAOjB,IAAA,CAACC,mBAAmB;IAAA,GAAKI,KAAK;IAAEC,GAAG,EAAEC;EAAU,CAAE,CAAC;AAC1D,CACD,CAAC;AAED,eAAeH,aAAa","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"UIMenuNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/NativeModuleSpecs/UIMenuNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,KAAK,EACL,WAAW,EACX,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAY7D,KAAK,SAAS,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;QACZ,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;CACF,CAAC;AACF,KAAK,UAAU,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC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AAC;KACjB,CAAC;IACF,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AACF,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC7C,aAAa,CAAC,EAAE,kBAAkB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,WAAW,CAAC,EAAE,kBAAkB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,kBAAkB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,OAAO,EAAE;QACR,GAAG,EAAE,KAAK,CAAC;QACX,MAAM,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,KAAK,CAAC;QACZ,KAAK,EAAE,KAAK,CAAC;KACb,CAAC;CACF;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -1 +1 @@
1
- {"version":3,"file":"UIMenuView.android.d.ts","sourceRoot":"","sources":["../../../src/UIMenuView.android.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAgB1E,QAAA,MAAM,aAAa,oIA6BlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"UIMenuView.android.d.ts","sourceRoot":"","sources":["../../../src/UIMenuView.android.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAe1E,QAAA,MAAM,aAAa,oIA6BlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-menu/menu",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "UIMenu component for react-native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -13,6 +13,9 @@
13
13
  "android",
14
14
  "ios",
15
15
  "cpp",
16
+ "Package.swift",
17
+ "spm-support",
18
+ "spm-headers",
16
19
  "react-native-menu.podspec",
17
20
  "!lib/typescript/example",
18
21
  "!**/__tests__",
@@ -49,7 +52,7 @@
49
52
  },
50
53
  "homepage": "https://github.com/react-native-menu/menu#readme",
51
54
  "devDependencies": {
52
- "@biomejs/biome": "1.9.4",
55
+ "@biomejs/biome": "2.6.7",
53
56
  "@callstack/react-native-visionos": "^0.79.6",
54
57
  "@react-native-community/cli": "^20.0.2",
55
58
  "@react-native/babel-preset": "^0.81.1",
@@ -63,7 +66,7 @@
63
66
  "pod-install": "1.2.1",
64
67
  "react": "19.1.0",
65
68
  "react-native": "^0.81.1",
66
- "react-native-builder-bob": "^0.43.0",
69
+ "react-native-builder-bob": "^0.44.1",
67
70
  "react-native-test-app": "^4.4.9",
68
71
  "release-it": "^18.1.1",
69
72
  "typescript": "5.9.3"
@@ -112,6 +115,9 @@
112
115
  "volta": {
113
116
  "node": "22.11.0"
114
117
  },
118
+ "swiftpmConfig": {
119
+ "name": "react_native_menu"
120
+ },
115
121
  "codegenConfig": {
116
122
  "name": "RNMenuViewSpec",
117
123
  "type": "components",
@@ -0,0 +1 @@
1
+ #import <React/RCTBridge.h>
@@ -0,0 +1 @@
1
+ #import <React/RCTFabricComponentsPlugins.h>
@@ -0,0 +1,4 @@
1
+ // The Fabric adapter has no public headers; MenuView.h stays private.
2
+ module ReactNativeMenuObjC {
3
+ export *
4
+ }
@@ -0,0 +1,28 @@
1
+ // Private SwiftPM declarations for the Fabric adapter. Xcode's generated
2
+ // react_native_menu-Swift.h is exposed through a module map, but C++ module
3
+ // imports are disabled and its directory is not an ObjC++ header search path.
4
+ // Keep this narrow interface in sync with that header and ios/NewArch/*.swift.
5
+ // The Swift classes use explicit @objc names, so these declarations resolve to
6
+ // their implementations without a Swift -> ObjC target dependency.
7
+ #pragma once
8
+ #import <UIKit/UIKit.h>
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+ __attribute__((objc_runtime_name("_TtP17react_native_menu32FabricViewImplementationProtocol_")))
12
+ @protocol FabricViewImplementationProtocol
13
+ @property (nonatomic, copy, nullable) NSArray<NSDictionary *> *actions;
14
+ @property (nonatomic, strong, nullable) NSString *title;
15
+ @property (nonatomic, strong, nullable) NSString *themeVariant;
16
+ @property (nonatomic) BOOL shouldOpenOnLongPress;
17
+ @property (nonatomic, copy, nullable) void (^onPressAction)(NSString *);
18
+ @property (nonatomic, copy, nullable) void (^onCloseMenu)(void);
19
+ @property (nonatomic, copy, nullable) void (^onOpenMenu)(void);
20
+ @optional
21
+ @property (nonatomic) UIEdgeInsets hitSlop;
22
+ @end
23
+
24
+ @interface FabricMenuViewImplementation : UIButton <FabricViewImplementationProtocol>
25
+ @end
26
+ @interface FabricActionSheetView : UIView <FabricViewImplementationProtocol>
27
+ @end
28
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,2 @@
1
+ @_exported import UIKit
2
+ @_exported import React
@@ -0,0 +1,75 @@
1
+ // Pins the Swift API mirrored by spm-headers/react_native_menu-Swift.h.
2
+ // If this file fails to compile, update both files together.
3
+ import UIKit
4
+
5
+ // Swift cannot check explicit @objc class/member names (#selector follows the
6
+ // current name) or the protocol's mangled runtime name at compile time.
7
+
8
+ private let _menuBase: (UIButton & FabricViewImplementationProtocol).Type = FabricMenuViewImplementation.self
9
+ private let _sheetBase: (UIView & FabricViewImplementationProtocol).Type = FabricActionSheetView.self
10
+
11
+ private let _protocol_actions: ReferenceWritableKeyPath<any FabricViewImplementationProtocol, [NSDictionary]?> = \.actions
12
+ private let _protocol_title: ReferenceWritableKeyPath<any FabricViewImplementationProtocol, NSString?> = \.title
13
+ private let _protocol_themeVariant: ReferenceWritableKeyPath<any FabricViewImplementationProtocol, NSString?> = \.themeVariant
14
+ private let _protocol_shouldOpenOnLongPress: ReferenceWritableKeyPath<any FabricViewImplementationProtocol, Bool> = \.shouldOpenOnLongPress
15
+ private let _protocol_onPressAction: ReferenceWritableKeyPath<any FabricViewImplementationProtocol, ((String) -> Void)?> = \.onPressAction
16
+ private let _protocol_onCloseMenu: ReferenceWritableKeyPath<any FabricViewImplementationProtocol, (() -> Void)?> = \.onCloseMenu
17
+ private let _protocol_onOpenMenu: ReferenceWritableKeyPath<any FabricViewImplementationProtocol, (() -> Void)?> = \.onOpenMenu
18
+
19
+ private let _menu_actions: ReferenceWritableKeyPath<FabricMenuViewImplementation, [NSDictionary]?> = \.actions
20
+ private let _menu_title: ReferenceWritableKeyPath<FabricMenuViewImplementation, NSString?> = \.title
21
+ private let _menu_themeVariant: ReferenceWritableKeyPath<FabricMenuViewImplementation, NSString?> = \.themeVariant
22
+ private let _menu_shouldOpenOnLongPress: ReferenceWritableKeyPath<FabricMenuViewImplementation, Bool> = \.shouldOpenOnLongPress
23
+ private let _menu_onPressAction: ReferenceWritableKeyPath<FabricMenuViewImplementation, ((String) -> Void)?> = \.onPressAction
24
+ private let _menu_onCloseMenu: ReferenceWritableKeyPath<FabricMenuViewImplementation, (() -> Void)?> = \.onCloseMenu
25
+ private let _menu_onOpenMenu: ReferenceWritableKeyPath<FabricMenuViewImplementation, (() -> Void)?> = \.onOpenMenu
26
+ private let _menu_hitSlop: ReferenceWritableKeyPath<FabricMenuViewImplementation, UIEdgeInsets> = \.hitSlop
27
+
28
+ private let _menu_selectors: [Selector] = [
29
+ #selector(getter: FabricMenuViewImplementation.actions),
30
+ #selector(setter: FabricMenuViewImplementation.actions),
31
+ #selector(getter: FabricMenuViewImplementation.title),
32
+ #selector(setter: FabricMenuViewImplementation.title),
33
+ #selector(getter: FabricMenuViewImplementation.themeVariant),
34
+ #selector(setter: FabricMenuViewImplementation.themeVariant),
35
+ #selector(getter: FabricMenuViewImplementation.shouldOpenOnLongPress),
36
+ #selector(setter: FabricMenuViewImplementation.shouldOpenOnLongPress),
37
+ #selector(getter: FabricMenuViewImplementation.onPressAction),
38
+ #selector(setter: FabricMenuViewImplementation.onPressAction),
39
+ #selector(getter: FabricMenuViewImplementation.onCloseMenu),
40
+ #selector(setter: FabricMenuViewImplementation.onCloseMenu),
41
+ #selector(getter: FabricMenuViewImplementation.onOpenMenu),
42
+ #selector(setter: FabricMenuViewImplementation.onOpenMenu),
43
+ #selector(getter: FabricMenuViewImplementation.hitSlop),
44
+ #selector(setter: FabricMenuViewImplementation.hitSlop),
45
+ ]
46
+
47
+ private let _sheet_actions: ReferenceWritableKeyPath<FabricActionSheetView, [NSDictionary]?> = \.actions
48
+ private let _sheet_title: ReferenceWritableKeyPath<FabricActionSheetView, NSString?> = \.title
49
+ private let _sheet_themeVariant: ReferenceWritableKeyPath<FabricActionSheetView, NSString?> = \.themeVariant
50
+ private let _sheet_shouldOpenOnLongPress: ReferenceWritableKeyPath<FabricActionSheetView, Bool> = \.shouldOpenOnLongPress
51
+ private let _sheet_onPressAction: ReferenceWritableKeyPath<FabricActionSheetView, ((String) -> Void)?> = \.onPressAction
52
+ private let _sheet_onCloseMenu: ReferenceWritableKeyPath<FabricActionSheetView, (() -> Void)?> = \.onCloseMenu
53
+ private let _sheet_onOpenMenu: ReferenceWritableKeyPath<FabricActionSheetView, (() -> Void)?> = \.onOpenMenu
54
+
55
+ private let _sheet_selectors: [Selector] = [
56
+ #selector(getter: FabricActionSheetView.actions),
57
+ #selector(setter: FabricActionSheetView.actions),
58
+ #selector(getter: FabricActionSheetView.title),
59
+ #selector(setter: FabricActionSheetView.title),
60
+ #selector(getter: FabricActionSheetView.themeVariant),
61
+ #selector(setter: FabricActionSheetView.themeVariant),
62
+ #selector(getter: FabricActionSheetView.shouldOpenOnLongPress),
63
+ #selector(setter: FabricActionSheetView.shouldOpenOnLongPress),
64
+ #selector(getter: FabricActionSheetView.onPressAction),
65
+ #selector(setter: FabricActionSheetView.onPressAction),
66
+ #selector(getter: FabricActionSheetView.onCloseMenu),
67
+ #selector(setter: FabricActionSheetView.onCloseMenu),
68
+ #selector(getter: FabricActionSheetView.onOpenMenu),
69
+ #selector(setter: FabricActionSheetView.onOpenMenu),
70
+ ]
71
+
72
+ private let _protocol_hitSlopSelectors: [Selector] = [
73
+ #selector(getter: FabricViewImplementationProtocol.hitSlop),
74
+ #selector(setter: FabricViewImplementationProtocol.hitSlop),
75
+ ]
@@ -1,3 +1,9 @@
1
+ // biome-ignore-start lint/suspicious/noReactNativeDeepImports: this is a codegen spec file.
2
+ // React Native's codegen parses these imports directly and expects CodegenTypes and
3
+ // codegenNativeComponent on these exact paths. react-native/index.js does re-export
4
+ // codegenNativeComponent, but rewriting an import that codegen parses risks breaking native
5
+ // builds for no benefit -- see the note on this file in CLAUDE.md. Scoped to this import
6
+ // block rather than the whole file, so accidental deep imports below are still caught.
1
7
  import type {
2
8
  DirectEventHandler,
3
9
  Int32,
@@ -5,6 +11,7 @@ import type {
5
11
  } from "react-native/Libraries/Types/CodegenTypes";
6
12
  import type { HostComponent, ViewProps } from "react-native";
7
13
  import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
14
+ // biome-ignore-end lint/suspicious/noReactNativeDeepImports: end of the codegen import block.
8
15
 
9
16
  /*
10
17
  Caution, those below are not just typescript types.
@@ -1,4 +1,5 @@
1
1
  import {
2
+ codegenNativeCommands,
2
3
  findNodeHandle,
3
4
  type HostComponent,
4
5
  requireNativeComponent,
@@ -6,7 +7,6 @@ import {
6
7
  } from "react-native";
7
8
  import type { MenuComponentRef, NativeMenuComponentProps } from "./types";
8
9
  import { forwardRef, useImperativeHandle, useRef } from "react";
9
- import codegenNativeCommands from "react-native/Libraries/Utilities/codegenNativeCommands";
10
10
 
11
11
  const NativeMenuComponent = requireNativeComponent(
12
12
  "MenuView",