@react-native-menu/menu 0.9.1 → 1.0.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.
Files changed (72) hide show
  1. package/README.md +14 -2
  2. package/android/.project +11 -0
  3. package/android/build.gradle +69 -77
  4. package/android/gradle.properties +5 -4
  5. package/android/src/main/AndroidManifest.xml +0 -1
  6. package/android/src/main/AndroidManifestNew.xml +2 -0
  7. package/android/src/main/java/com/reactnativemenu/MenuPackage.kt +1 -1
  8. package/android/src/main/java/com/reactnativemenu/MenuViewManager.kt +3 -3
  9. package/android/src/newarch/MenuViewManagerSpec.kt +21 -0
  10. package/android/src/oldarch/MenuViewManagerSpec.kt +9 -0
  11. package/ios/Menu-Bridging-Header.h +0 -2
  12. package/ios/MenuViewManager.mm +64 -0
  13. package/ios/NewArch/FabricActionSheetView.swift +11 -0
  14. package/ios/NewArch/FabricMenuViewImplementation.swift +20 -0
  15. package/ios/NewArch/FabricViewImplementationProtocol.swift +6 -0
  16. package/ios/NewArch/MenuView.h +19 -0
  17. package/ios/NewArch/MenuView.mm +155 -0
  18. package/ios/OldArch/LegacyActionSheetView.swift +11 -0
  19. package/ios/OldArch/LegacyMenuViewImplementation.swift +13 -0
  20. package/ios/{ActionSheetView.swift → Shared/ActionSheetView.swift} +6 -8
  21. package/ios/{MenuView.swift → Shared/MenuViewImplementation.swift} +9 -11
  22. package/ios/{RCTMenuItem.swift → Shared/RCTMenuItem.swift} +9 -1
  23. package/lib/commonjs/NativeModuleSpecs/UIMenuNativeComponent.js +18 -0
  24. package/lib/commonjs/NativeModuleSpecs/UIMenuNativeComponent.js.map +1 -0
  25. package/lib/commonjs/UIMenuView.android.js +1 -4
  26. package/lib/commonjs/UIMenuView.android.js.map +1 -1
  27. package/lib/commonjs/UIMenuView.ios.js +3 -6
  28. package/lib/commonjs/UIMenuView.ios.js.map +1 -1
  29. package/lib/commonjs/UIMenuView.js +3 -10
  30. package/lib/commonjs/UIMenuView.js.map +1 -1
  31. package/lib/commonjs/index.js +12 -14
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/types.js.map +1 -1
  34. package/lib/commonjs/utils.js +31 -0
  35. package/lib/commonjs/utils.js.map +1 -0
  36. package/lib/module/NativeModuleSpecs/UIMenuNativeComponent.js +12 -0
  37. package/lib/module/NativeModuleSpecs/UIMenuNativeComponent.js.map +1 -0
  38. package/lib/module/UIMenuView.android.js.map +1 -1
  39. package/lib/module/UIMenuView.ios.js +2 -3
  40. package/lib/module/UIMenuView.ios.js.map +1 -1
  41. package/lib/module/UIMenuView.js +0 -2
  42. package/lib/module/UIMenuView.js.map +1 -1
  43. package/lib/module/index.js +10 -10
  44. package/lib/module/index.js.map +1 -1
  45. package/lib/module/types.js.map +1 -1
  46. package/lib/module/utils.js +25 -0
  47. package/lib/module/utils.js.map +1 -0
  48. package/lib/typescript/src/NativeModuleSpecs/UIMenuNativeComponent.d.ts +44 -0
  49. package/lib/typescript/src/NativeModuleSpecs/UIMenuNativeComponent.d.ts.map +1 -0
  50. package/lib/typescript/src/UIMenuView.android.d.ts +1 -0
  51. package/lib/typescript/src/UIMenuView.android.d.ts.map +1 -0
  52. package/lib/typescript/src/UIMenuView.d.ts +1 -0
  53. package/lib/typescript/src/UIMenuView.d.ts.map +1 -0
  54. package/lib/typescript/src/UIMenuView.ios.d.ts +3 -4
  55. package/lib/typescript/src/UIMenuView.ios.d.ts.map +1 -0
  56. package/lib/typescript/src/index.d.ts +1 -0
  57. package/lib/typescript/src/index.d.ts.map +1 -0
  58. package/lib/typescript/src/types.d.ts +2 -0
  59. package/lib/typescript/src/types.d.ts.map +1 -0
  60. package/lib/typescript/src/utils.d.ts +2 -0
  61. package/lib/typescript/src/utils.d.ts.map +1 -0
  62. package/package.json +23 -12
  63. package/react-native-menu.podspec +26 -4
  64. package/src/NativeModuleSpecs/UIMenuNativeComponent.ts +55 -0
  65. package/src/UIMenuView.ios.tsx +2 -7
  66. package/src/index.tsx +8 -2
  67. package/src/types.ts +2 -0
  68. package/src/utils.ts +24 -0
  69. package/ios/Menu.xcodeproj/project.pbxproj +0 -297
  70. package/ios/RCTUIMenuManager.m +0 -27
  71. package/ios/RCTUIMenuManager.swift +0 -19
  72. /package/ios/{RCTAlertAction.swift → Shared/RCTAlertAction.swift} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-menu/menu",
3
- "version": "0.9.1",
3
+ "version": "1.0.0",
4
4
  "description": "UIMenu component for react-native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -23,11 +23,12 @@
23
23
  "test": "jest",
24
24
  "typescript": "tsc --noEmit",
25
25
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
26
+ "format": "prettier --write \"**/*.{js,ts,tsx}\"",
26
27
  "prepare": "bob build",
27
28
  "release": "release-it",
28
29
  "example": "yarn --cwd example",
29
30
  "pods": "cd example && pod-install --quiet",
30
- "bootstrap": "yarn example && yarn && yarn pods"
31
+ "bootstrap": "yarn && yarn example && yarn pods"
31
32
  },
32
33
  "keywords": [
33
34
  "react-native",
@@ -42,21 +43,22 @@
42
43
  },
43
44
  "homepage": "https://github.com/react-native-menu/menu#readme",
44
45
  "devDependencies": {
45
- "@react-native-community/bob": "^0.17.1",
46
- "@react-native/eslint-config": "^0.72.2",
47
- "@release-it/conventional-changelog": "^3.0.1",
46
+ "@react-native/babel-preset": "^0.75.0-main",
47
+ "@react-native/eslint-config": "^0.74.0",
48
+ "@release-it/conventional-changelog": "^4.3.0",
48
49
  "@types/jest": "^29.1.2",
49
50
  "@types/react": "^18.2.2",
50
51
  "@types/react-native": "0.72.2",
51
- "eslint": "8.47.0",
52
- "eslint-config-prettier": "^9.0.0",
53
- "eslint-plugin-prettier": "^4.2.1",
52
+ "eslint": "8.57.0",
53
+ "eslint-config-prettier": "^9.1.0",
54
+ "eslint-plugin-ft-flow": "^3.0.0",
55
+ "eslint-plugin-prettier": "^5.1.2",
54
56
  "jest": "^29.1.2",
55
- "pod-install": "^0.1.0",
56
- "prettier": "^2.2.1",
57
+ "pod-install": "^0.2.0",
58
+ "prettier": "^3.1.1",
57
59
  "react": "18.2.0",
58
60
  "react-native": "0.72.2",
59
- "react-native-test-app": "^2.5.20",
61
+ "react-native-builder-bob": "^0.23.2",
60
62
  "release-it": "^14.10.0",
61
63
  "typescript": "4.8.4"
62
64
  },
@@ -117,7 +119,7 @@
117
119
  "trailingComma": "es5",
118
120
  "useTabs": false
119
121
  },
120
- "@react-native-community/bob": {
122
+ "react-native-builder-bob": {
121
123
  "source": "src",
122
124
  "output": "lib",
123
125
  "targets": [
@@ -128,5 +130,14 @@
128
130
  },
129
131
  "publishConfig": {
130
132
  "access": "public"
133
+ },
134
+ "volta": {
135
+ "node": "20.10.0",
136
+ "yarn": "1.22.21"
137
+ },
138
+ "codegenConfig": {
139
+ "name": "RNMenuViewSpec",
140
+ "type": "components",
141
+ "jsSrcsDir": "src"
131
142
  }
132
143
  }
@@ -1,6 +1,7 @@
1
1
  require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
4
5
 
5
6
  Pod::Spec.new do |s|
6
7
  s.name = "react-native-menu"
@@ -10,12 +11,33 @@ Pod::Spec.new do |s|
10
11
  s.license = package["license"]
11
12
  s.authors = package["author"]
12
13
 
13
- s.platforms = { :ios => "9.0" }
14
+ s.platforms = { :ios => "11.0" }
14
15
  s.source = { :git => "https://github.com/react-native-menu/menu.git", :tag => "#{s.version}" }
15
16
 
16
-
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
-
19
18
 
20
- s.dependency "React"
19
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then # new architecture
20
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
22
+ if respond_to?(:install_modules_dependencies, true)
23
+ install_modules_dependencies(s)
24
+ else
25
+ s.dependency "React-Core"
26
+ # Don't install the dependencies when we run `pod install` in the old architecture.
27
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
28
+ s.pod_target_xcconfig = {
29
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
30
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
31
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
32
+ }
33
+ s.dependency "React-RCTFabric"
34
+ s.dependency "React-Codegen"
35
+ s.dependency "RCT-Folly"
36
+ s.dependency "RCTRequired"
37
+ s.dependency "RCTTypeSafety"
38
+ s.dependency "ReactCommon/turbomodule/core"
39
+ end
40
+ else # old arch
41
+ s.dependency "React"
42
+ end
21
43
  end
@@ -0,0 +1,55 @@
1
+ import type {
2
+ DirectEventHandler,
3
+ Int32,
4
+ } from 'react-native/Libraries/Types/CodegenTypes';
5
+ import type { HostComponent, ViewProps } from 'react-native';
6
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ /*
8
+ Caution, those below are not just typescript types.
9
+ Codegen is using them to create the corresponding C++ data types.
10
+
11
+ Codegen doesn't play very well with reusing the same type within a type,
12
+ OR with extending types in an interface, so for now we'll just keep some duplicate
13
+ types here, to avoid issues while `pod install` takes place.
14
+ */
15
+ type SubAction = {
16
+ id?: string;
17
+ title: string;
18
+ titleColor?: Int32;
19
+ subtitle?: string;
20
+ state?: string;
21
+ image?: string;
22
+ imageColor?: Int32;
23
+ displayInline?: boolean;
24
+ attributes?: {
25
+ destructive?: boolean;
26
+ disabled?: boolean;
27
+ hidden?: boolean;
28
+ };
29
+ };
30
+ type MenuAction = {
31
+ id?: string;
32
+ title: string;
33
+ titleColor?: Int32;
34
+ subtitle?: string;
35
+ state?: string;
36
+ image?: string;
37
+ imageColor?: Int32;
38
+ displayInline?: boolean;
39
+ attributes?: {
40
+ destructive?: boolean;
41
+ disabled?: boolean;
42
+ hidden?: boolean;
43
+ };
44
+ subactions?: Array<SubAction>;
45
+ };
46
+ export interface NativeProps extends ViewProps {
47
+ onPressAction?: DirectEventHandler<{ event: string }>;
48
+ actions: Array<MenuAction>;
49
+ actionsHash: string; // just a workaround to make sure we don't have to manually compare MenuActions manually in C++ (since it's a struct and that's a pain)
50
+ title?: string;
51
+ }
52
+
53
+ export default codegenNativeComponent<NativeProps>(
54
+ 'MenuView'
55
+ ) as HostComponent<NativeProps>;
@@ -1,8 +1,3 @@
1
- import { HostComponent, requireNativeComponent } from 'react-native';
2
- import type { NativeMenuComponentProps } from './types';
1
+ import UIMenuNativeComponent from './NativeModuleSpecs/UIMenuNativeComponent';
3
2
 
4
- const MenuComponent = requireNativeComponent(
5
- 'RCTUIMenu'
6
- ) as HostComponent<NativeMenuComponentProps>;
7
-
8
- export default MenuComponent;
3
+ export default UIMenuNativeComponent;
package/src/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { processColor } from 'react-native';
3
3
 
4
4
  import UIMenuView from './UIMenuView';
@@ -8,6 +8,7 @@ import type {
8
8
  ProcessedMenuAction,
9
9
  NativeActionEvent,
10
10
  } from './types';
11
+ import { objectHash } from './utils';
11
12
 
12
13
  function processAction(action: MenuAction): ProcessedMenuAction {
13
14
  return {
@@ -22,7 +23,12 @@ const MenuView: React.FC<MenuComponentProps> = ({ actions, ...props }) => {
22
23
  const processedActions = actions.map<ProcessedMenuAction>((action) =>
23
24
  processAction(action)
24
25
  );
25
- return <UIMenuView {...props} actions={processedActions} />;
26
+ const hash = useMemo(() => {
27
+ return objectHash(processedActions);
28
+ }, [processedActions]);
29
+ return (
30
+ <UIMenuView {...props} actions={processedActions} actionsHash={hash} />
31
+ );
26
32
  };
27
33
 
28
34
  export { MenuView };
package/src/types.ts CHANGED
@@ -111,6 +111,7 @@ type MenuComponentPropsBase = {
111
111
  * The title of the menu.
112
112
  */
113
113
  title?: string;
114
+
114
115
  /**
115
116
  * (Android API 23+)
116
117
  * Boolean value determines whether popup menu should be anchored
@@ -149,5 +150,6 @@ export type NativeMenuComponentProps = {
149
150
  style?: StyleProp<ViewStyle>;
150
151
  onPressAction?: ({ nativeEvent }: NativeActionEvent) => void;
151
152
  actions: ProcessedMenuAction[];
153
+ actionsHash: string;
152
154
  title?: string;
153
155
  };
package/src/utils.ts ADDED
@@ -0,0 +1,24 @@
1
+ // Function to calculate a simple hash code for a string
2
+ function hashCode(str: string): number {
3
+ let hash = 0;
4
+ for (let i = 0; i < str.length; i++) {
5
+ const char = str.charCodeAt(i);
6
+ hash = (hash << 5) - hash + char;
7
+ }
8
+ return hash;
9
+ }
10
+
11
+ // Function to create a string hash from a TypeScript object
12
+ export function objectHash(obj: Record<string, any>): string {
13
+ if (!obj) {
14
+ return '';
15
+ }
16
+ // Convert the object to a JSON string
17
+ const jsonString = JSON.stringify(obj);
18
+
19
+ // Calculate the hash code of the JSON string
20
+ const hash = hashCode(jsonString);
21
+
22
+ // Convert the hash code to a string (optional)
23
+ return String(hash);
24
+ }
@@ -1,297 +0,0 @@
1
- // !$*UTF8*$!
2
- {
3
- archiveVersion = 1;
4
- classes = {
5
- };
6
- objectVersion = 46;
7
- objects = {
8
-
9
- /* Begin PBXBuildFile section */
10
-
11
-
12
- F4FF95D7245B92E800C19C63 /* Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* Menu.swift */; };
13
-
14
- 5E555C0D2413F4C50049A1A2 /* Menu.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* Menu.mm */; };
15
- /* End PBXBuildFile section */
16
-
17
- /* Begin PBXCopyFilesBuildPhase section */
18
- 58B511D91A9E6C8500147676 /* CopyFiles */ = {
19
- isa = PBXCopyFilesBuildPhase;
20
- buildActionMask = 2147483647;
21
- dstPath = "include/$(PRODUCT_NAME)";
22
- dstSubfolderSpec = 16;
23
- files = (
24
- );
25
- runOnlyForDeploymentPostprocessing = 0;
26
- };
27
- /* End PBXCopyFilesBuildPhase section */
28
-
29
- /* Begin PBXFileReference section */
30
- 134814201AA4EA6300B7C361 /* libMenu.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMenu.a; sourceTree = BUILT_PRODUCTS_DIR; };
31
-
32
-
33
- B3E7B5891CC2AC0600A0062D /* Menu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Menu.m; sourceTree = "<group>"; };
34
- F4FF95D5245B92E700C19C63 /* Menu-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Menu-Bridging-Header.h"; sourceTree = "<group>"; };
35
- F4FF95D6245B92E800C19C63 /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; };
36
-
37
- /* End PBXFileReference section */
38
-
39
- /* Begin PBXFrameworksBuildPhase section */
40
- 58B511D81A9E6C8500147676 /* Frameworks */ = {
41
- isa = PBXFrameworksBuildPhase;
42
- buildActionMask = 2147483647;
43
- files = (
44
- );
45
- runOnlyForDeploymentPostprocessing = 0;
46
- };
47
- /* End PBXFrameworksBuildPhase section */
48
-
49
- /* Begin PBXGroup section */
50
- 134814211AA4EA7D00B7C361 /* Products */ = {
51
- isa = PBXGroup;
52
- children = (
53
- 134814201AA4EA6300B7C361 /* libMenu.a */,
54
- );
55
- name = Products;
56
- sourceTree = "<group>";
57
- };
58
- 58B511D21A9E6C8500147676 = {
59
- isa = PBXGroup;
60
- children = (
61
-
62
-
63
- F4FF95D6245B92E800C19C63 /* Menu.swift */,
64
- B3E7B5891CC2AC0600A0062D /* Menu.m */,
65
- F4FF95D5245B92E700C19C63 /* Menu-Bridging-Header.h */,
66
-
67
- 134814211AA4EA7D00B7C361 /* Products */,
68
- );
69
- sourceTree = "<group>";
70
- };
71
- /* End PBXGroup section */
72
-
73
- /* Begin PBXNativeTarget section */
74
- 58B511DA1A9E6C8500147676 /* Menu */ = {
75
- isa = PBXNativeTarget;
76
- buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Menu" */;
77
- buildPhases = (
78
- 58B511D71A9E6C8500147676 /* Sources */,
79
- 58B511D81A9E6C8500147676 /* Frameworks */,
80
- 58B511D91A9E6C8500147676 /* CopyFiles */,
81
- );
82
- buildRules = (
83
- );
84
- dependencies = (
85
- );
86
- name = Menu;
87
- productName = RCTDataManager;
88
- productReference = 134814201AA4EA6300B7C361 /* libMenu.a */;
89
- productType = "com.apple.product-type.library.static";
90
- };
91
- /* End PBXNativeTarget section */
92
-
93
- /* Begin PBXProject section */
94
- 58B511D31A9E6C8500147676 /* Project object */ = {
95
- isa = PBXProject;
96
- attributes = {
97
- LastUpgradeCheck = 0920;
98
- ORGANIZATIONNAME = Facebook;
99
- TargetAttributes = {
100
- 58B511DA1A9E6C8500147676 = {
101
- CreatedOnToolsVersion = 6.1.1;
102
- };
103
- };
104
- };
105
- buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Menu" */;
106
- compatibilityVersion = "Xcode 3.2";
107
- developmentRegion = English;
108
- hasScannedForEncodings = 0;
109
- knownRegions = (
110
- English,
111
- en,
112
- );
113
- mainGroup = 58B511D21A9E6C8500147676;
114
- productRefGroup = 58B511D21A9E6C8500147676;
115
- projectDirPath = "";
116
- projectRoot = "";
117
- targets = (
118
- 58B511DA1A9E6C8500147676 /* Menu */,
119
- );
120
- };
121
- /* End PBXProject section */
122
-
123
- /* Begin PBXSourcesBuildPhase section */
124
- 58B511D71A9E6C8500147676 /* Sources */ = {
125
- isa = PBXSourcesBuildPhase;
126
- buildActionMask = 2147483647;
127
- files = (
128
-
129
-
130
- F4FF95D7245B92E800C19C63 /* Menu.swift in Sources */,
131
- B3E7B58A1CC2AC0600A0062D /* Menu.m in Sources */,
132
-
133
- );
134
- runOnlyForDeploymentPostprocessing = 0;
135
- };
136
- /* End PBXSourcesBuildPhase section */
137
-
138
- /* Begin XCBuildConfiguration section */
139
- 58B511ED1A9E6C8500147676 /* Debug */ = {
140
- isa = XCBuildConfiguration;
141
- buildSettings = {
142
- ALWAYS_SEARCH_USER_PATHS = NO;
143
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
144
- CLANG_CXX_LIBRARY = "libc++";
145
- CLANG_ENABLE_MODULES = YES;
146
- CLANG_ENABLE_OBJC_ARC = YES;
147
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
148
- CLANG_WARN_BOOL_CONVERSION = YES;
149
- CLANG_WARN_COMMA = YES;
150
- CLANG_WARN_CONSTANT_CONVERSION = YES;
151
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
152
- CLANG_WARN_EMPTY_BODY = YES;
153
- CLANG_WARN_ENUM_CONVERSION = YES;
154
- CLANG_WARN_INFINITE_RECURSION = YES;
155
- CLANG_WARN_INT_CONVERSION = YES;
156
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
157
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
158
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
159
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
160
- CLANG_WARN_STRICT_PROTOTYPES = YES;
161
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
162
- CLANG_WARN_UNREACHABLE_CODE = YES;
163
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
164
- COPY_PHASE_STRIP = NO;
165
- ENABLE_STRICT_OBJC_MSGSEND = YES;
166
- ENABLE_TESTABILITY = YES;
167
- GCC_C_LANGUAGE_STANDARD = gnu99;
168
- GCC_DYNAMIC_NO_PIC = NO;
169
- GCC_NO_COMMON_BLOCKS = YES;
170
- GCC_OPTIMIZATION_LEVEL = 0;
171
- GCC_PREPROCESSOR_DEFINITIONS = (
172
- "DEBUG=1",
173
- "$(inherited)",
174
- );
175
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
176
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
177
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
178
- GCC_WARN_UNDECLARED_SELECTOR = YES;
179
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
180
- GCC_WARN_UNUSED_FUNCTION = YES;
181
- GCC_WARN_UNUSED_VARIABLE = YES;
182
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
183
- MTL_ENABLE_DEBUG_INFO = YES;
184
- ONLY_ACTIVE_ARCH = YES;
185
- SDKROOT = iphoneos;
186
- };
187
- name = Debug;
188
- };
189
- 58B511EE1A9E6C8500147676 /* Release */ = {
190
- isa = XCBuildConfiguration;
191
- buildSettings = {
192
- ALWAYS_SEARCH_USER_PATHS = NO;
193
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194
- CLANG_CXX_LIBRARY = "libc++";
195
- CLANG_ENABLE_MODULES = YES;
196
- CLANG_ENABLE_OBJC_ARC = YES;
197
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
198
- CLANG_WARN_BOOL_CONVERSION = YES;
199
- CLANG_WARN_COMMA = YES;
200
- CLANG_WARN_CONSTANT_CONVERSION = YES;
201
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
202
- CLANG_WARN_EMPTY_BODY = YES;
203
- CLANG_WARN_ENUM_CONVERSION = YES;
204
- CLANG_WARN_INFINITE_RECURSION = YES;
205
- CLANG_WARN_INT_CONVERSION = YES;
206
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
207
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
208
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
209
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
210
- CLANG_WARN_STRICT_PROTOTYPES = YES;
211
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
212
- CLANG_WARN_UNREACHABLE_CODE = YES;
213
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
214
- COPY_PHASE_STRIP = YES;
215
- ENABLE_NS_ASSERTIONS = NO;
216
- ENABLE_STRICT_OBJC_MSGSEND = YES;
217
- GCC_C_LANGUAGE_STANDARD = gnu99;
218
- GCC_NO_COMMON_BLOCKS = YES;
219
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
220
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
221
- GCC_WARN_UNDECLARED_SELECTOR = YES;
222
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
223
- GCC_WARN_UNUSED_FUNCTION = YES;
224
- GCC_WARN_UNUSED_VARIABLE = YES;
225
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
226
- MTL_ENABLE_DEBUG_INFO = NO;
227
- SDKROOT = iphoneos;
228
- VALIDATE_PRODUCT = YES;
229
- };
230
- name = Release;
231
- };
232
- 58B511F01A9E6C8500147676 /* Debug */ = {
233
- isa = XCBuildConfiguration;
234
- buildSettings = {
235
- HEADER_SEARCH_PATHS = (
236
- "$(inherited)",
237
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
238
- "$(SRCROOT)/../../../React/**",
239
- "$(SRCROOT)/../../react-native/React/**",
240
- );
241
- LIBRARY_SEARCH_PATHS = "$(inherited)";
242
- OTHER_LDFLAGS = "-ObjC";
243
- PRODUCT_NAME = Menu;
244
- SKIP_INSTALL = YES;
245
-
246
- SWIFT_OBJC_BRIDGING_HEADER = "Menu-Bridging-Header.h";
247
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
248
- SWIFT_VERSION = 5.0;
249
-
250
- };
251
- name = Debug;
252
- };
253
- 58B511F11A9E6C8500147676 /* Release */ = {
254
- isa = XCBuildConfiguration;
255
- buildSettings = {
256
- HEADER_SEARCH_PATHS = (
257
- "$(inherited)",
258
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
259
- "$(SRCROOT)/../../../React/**",
260
- "$(SRCROOT)/../../react-native/React/**",
261
- );
262
- LIBRARY_SEARCH_PATHS = "$(inherited)";
263
- OTHER_LDFLAGS = "-ObjC";
264
- PRODUCT_NAME = Menu;
265
- SKIP_INSTALL = YES;
266
-
267
- SWIFT_OBJC_BRIDGING_HEADER = "Menu-Bridging-Header.h";
268
- SWIFT_VERSION = 5.0;
269
-
270
- };
271
- name = Release;
272
- };
273
- /* End XCBuildConfiguration section */
274
-
275
- /* Begin XCConfigurationList section */
276
- 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Menu" */ = {
277
- isa = XCConfigurationList;
278
- buildConfigurations = (
279
- 58B511ED1A9E6C8500147676 /* Debug */,
280
- 58B511EE1A9E6C8500147676 /* Release */,
281
- );
282
- defaultConfigurationIsVisible = 0;
283
- defaultConfigurationName = Release;
284
- };
285
- 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Menu" */ = {
286
- isa = XCConfigurationList;
287
- buildConfigurations = (
288
- 58B511F01A9E6C8500147676 /* Debug */,
289
- 58B511F11A9E6C8500147676 /* Release */,
290
- );
291
- defaultConfigurationIsVisible = 0;
292
- defaultConfigurationName = Release;
293
- };
294
- /* End XCConfigurationList section */
295
- };
296
- rootObject = 58B511D31A9E6C8500147676 /* Project object */;
297
- }
@@ -1,27 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
- #import <React/RCTViewManager.h>
3
-
4
- @interface RCT_EXTERN_MODULE(RCTUIMenu, RCTViewManager)
5
-
6
- /**
7
- * title: Short description to be displayed above the menu.
8
- */
9
- RCT_EXPORT_VIEW_PROPERTY(title, NSString);
10
- /**
11
- * actions: Array of actions that are included in the menu
12
- */
13
- RCT_EXPORT_VIEW_PROPERTY(actions, NSArray);
14
- /**
15
- * onPressAction: callback to be called once user selects an action
16
- */
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)
22
- /**
23
- * themeVariant: determines whether menu should use dark theme, light theme or system theme
24
- */
25
- RCT_EXPORT_VIEW_PROPERTY(themeVariant, NSString)
26
-
27
- @end
@@ -1,19 +0,0 @@
1
- @objc(RCTUIMenu)
2
- class RCTUIMenuManager: RCTViewManager {
3
-
4
- // @objc var item: json?;
5
- @objc var onPressMenuItem: RCTBubblingEventBlock?;
6
-
7
- override static func requiresMainQueueSetup() -> Bool {
8
- return true
9
- }
10
-
11
- override func view() -> UIView! {
12
- if #available(iOS 14.0, *) {
13
- return MenuView();
14
- } else {
15
- return ActionSheetView();
16
- }
17
- }
18
- }
19
-