@react-native-ohos/react-native-context-menu-view 1.19.1 → 1.20.0-beta.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.OpenSource CHANGED
@@ -2,10 +2,10 @@
2
2
  {
3
3
  "Name": "react-native-context-menu-view",
4
4
  "License": "MIT License",
5
- "License File": "https://github.com/mpiannucci/react-native-context-menu-view/blob/v1.19.0/LICENSE",
6
- "Version Number": "1.19.0",
5
+ "License File": "https://github.com/mpiannucci/react-native-context-menu-view/blob/v1.21.0/LICENSE",
6
+ "Version Number": "1.21.0",
7
7
  "Owner" : "xiafeng@huawei.com",
8
- "Upstream URL": "https://github.com/mpiannucci/react-native-context-menu-view/tree/v1.19.0",
8
+ "Upstream URL": "https://github.com/mpiannucci/react-native-context-menu-view/tree/v1.21.0",
9
9
  "Description": "Use native context menus in React Native"
10
10
  }
11
11
  ]
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # @react-native-ohos/react-native-context-menu-view
2
2
 
3
- This project is based on [react-native-context-menu-view@v1.19.0](https://github.com/mpiannucci/react-native-context-menu-view/tree/v1.19.0)
3
+ This project is based on [react-native-context-menu-view@v1.21.0](https://github.com/mpiannucci/react-native-context-menu-view/tree/v1.21.0)
4
4
 
5
5
  ## Documentation
6
6
 
7
- - [中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-context-menu-view.md)
7
+ - [中文](https://gitcode.com/OpenHarmony-RN/usage-docs/blob/master/zh-cn/react-native-context-menu-view.md)
8
8
 
9
- - [English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-context-menu-view.md)
9
+ - [English](https://gitcode.com/OpenHarmony-RN/usage-docs/blob/master/en/react-native-context-menu-view.md)
10
10
 
11
11
  ## License
12
12
 
13
- This library is licensed under [The MIT License (MIT)](https://github.com/mpiannucci/react-native-context-menu-view/blob/v1.19.0/LICENSE)
13
+ This library is licensed under [The MIT License (MIT)](https://github.com/mpiannucci/react-native-context-menu-view/blob/v1.21.0/LICENSE)
@@ -1,17 +1,17 @@
1
- /**
2
- * Use these variables when you tailor your ArkTS code. They must be of the const type.
3
- */
4
- export const HAR_VERSION = '1.19.1';
5
- export const BUILD_MODE_NAME = 'debug';
6
- export const DEBUG = true;
7
- export const TARGET_NAME = 'default';
8
-
9
- /**
10
- * BuildProfile Class is used only for compatibility purposes.
11
- */
12
- export default class BuildProfile {
13
- static readonly HAR_VERSION = HAR_VERSION;
14
- static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
15
- static readonly DEBUG = DEBUG;
16
- static readonly TARGET_NAME = TARGET_NAME;
1
+ /**
2
+ * Use these variables when you tailor your ArkTS code. They must be of the const type.
3
+ */
4
+ export const HAR_VERSION = '1.20.0-beta.2';
5
+ export const BUILD_MODE_NAME = 'debug';
6
+ export const DEBUG = true;
7
+ export const TARGET_NAME = 'default';
8
+
9
+ /**
10
+ * BuildProfile Class is used only for compatibility purposes.
11
+ */
12
+ export default class BuildProfile {
13
+ static readonly HAR_VERSION = HAR_VERSION;
14
+ static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
15
+ static readonly DEBUG = DEBUG;
16
+ static readonly TARGET_NAME = TARGET_NAME;
17
17
  }
@@ -22,5 +22,6 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import {ContextMenuPackage} from './src/main/ets/ContextMenuPackage'
25
26
  export * from './ts'
26
- export * from './src/main/ets/ContextMenuLongPress'
27
+ export default ContextMenuPackage;
@@ -2,7 +2,7 @@
2
2
  license: 'ISC',
3
3
  types: '',
4
4
  name: "@react-native-ohos/react-native-context-menu-view",
5
- version: '1.19.1',
5
+ version: '1.20.0-beta.2',
6
6
  description: '',
7
7
  main: 'index.ets',
8
8
  type: 'module',
@@ -236,6 +236,9 @@ export struct ContextMenuLongPress {
236
236
  .enabled(item.disabled)
237
237
  .contentFontColor(item.titleColor)
238
238
  .onClick(() => {
239
+ // fix 二级菜单不能连续点击
240
+ this.isTouch = false;
241
+ this.isTouchWithNoSelect = false;
239
242
  //当item.inlineChildren默认为false,表示以二级目录展示
240
243
  //true的时候,以同目录展示
241
244
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -276,6 +279,9 @@ export struct ContextMenuLongPress {
276
279
  .enabled(item.disabled)
277
280
  .contentFontColor(item.titleColor)
278
281
  .onClick(() => {
282
+ // fix 二级菜单不能连续点击
283
+ this.isTouch = false;
284
+ this.isTouchWithNoSelect = false;
279
285
  //当item.inlineChildren默认为false,表示以二级目录展示
280
286
  //true的时候,以同目录展示
281
287
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -318,6 +324,9 @@ export struct ContextMenuLongPress {
318
324
  .enabled(item.disabled)
319
325
  .contentFontColor(item.titleColor)
320
326
  .onClick(() => {
327
+ // fix 二级菜单不能连续点击
328
+ this.isTouch = false;
329
+ this.isTouchWithNoSelect = false;
321
330
  //当item.inlineChildren默认为false,表示以二级目录展示
322
331
  //true的时候,以同目录展示
323
332
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -357,6 +366,9 @@ export struct ContextMenuLongPress {
357
366
  .enabled(item.disabled)
358
367
  .contentFontColor(item.titleColor)
359
368
  .onClick(() => {
369
+ // fix 二级菜单不能连续点击
370
+ this.isTouch = false;
371
+ this.isTouchWithNoSelect = false;
360
372
  //当item.inlineChildren默认为false,表示以二级目录展示
361
373
  //true的时候,以同目录展示
362
374
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -237,6 +237,9 @@ export struct ContextMenuLongPressWithNoSelect {
237
237
  .enabled(item.disabled)
238
238
  .contentFontColor(item.titleColor)
239
239
  .onClick(() => {
240
+ // fix 二级菜单不能连续点击
241
+ this.isTouch = false;
242
+ this.isTouchWithNoSelect = false;
240
243
  //当item.inlineChildren默认为false,表示以二级目录展示
241
244
  //true的时候,以同目录展示
242
245
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -272,6 +275,9 @@ export struct ContextMenuLongPressWithNoSelect {
272
275
  .enabled(item.disabled)
273
276
  .contentFontColor(item.titleColor)
274
277
  .onClick(() => {
278
+ // fix 二级菜单不能连续点击
279
+ this.isTouch = false;
280
+ this.isTouchWithNoSelect = false;
275
281
  //当item.inlineChildren默认为false,表示以二级目录展示
276
282
  //true的时候,以同目录展示
277
283
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -309,6 +315,9 @@ export struct ContextMenuLongPressWithNoSelect {
309
315
  .enabled(item.disabled)
310
316
  .contentFontColor(item.titleColor)
311
317
  .onClick(() => {
318
+ // fix 二级菜单不能连续点击
319
+ this.isTouch = false;
320
+ this.isTouchWithNoSelect = false;
312
321
  //当item.inlineChildren默认为false,表示以二级目录展示
313
322
  //true的时候,以同目录展示
314
323
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -342,6 +351,9 @@ export struct ContextMenuLongPressWithNoSelect {
342
351
  .enabled(item.disabled)
343
352
  .contentFontColor(item.titleColor)
344
353
  .onClick(() => {
354
+ // fix 二级菜单不能连续点击
355
+ this.isTouch = false;
356
+ this.isTouchWithNoSelect = false;
345
357
  //当item.inlineChildren默认为false,表示以二级目录展示
346
358
  //true的时候,以同目录展示
347
359
  this.isTouch = true && (!item.inlineChildren) && (item.d_childActions !== undefined);
@@ -22,7 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import {RNPackage, TurboModulesFactory} from '@rnoh/react-native-openharmony/ts';
25
+ import {TurboModulesFactory} from '@rnoh/react-native-openharmony/ts';
26
+ import { RNOHPackage } from '@rnoh/react-native-openharmony';
26
27
  import type {TurboModule, TurboModuleContext} from '@rnoh/react-native-openharmony/ts';
27
28
  import { ContextMenuTurboModule } from './ContextMenuTurboModule';
28
29
 
@@ -40,7 +41,7 @@ class ContextMenuTurboModulesFactory extends TurboModulesFactory {
40
41
  }
41
42
  }
42
43
 
43
- export class ContextMenuPackage extends RNPackage {
44
+ export class ContextMenuPackage extends RNOHPackage {
44
45
  createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
45
46
  return new ContextMenuTurboModulesFactory(ctx);
46
47
  }
@@ -93,7 +93,7 @@ export struct ContextMenuThreeMenu {
93
93
  this.menuTag = this.menuTag;
94
94
  Logger.info('2024-3menu:' + JSON.stringify(this.longPress))
95
95
  //menu的大标题
96
- this.listDate = this.longPress;
96
+ this.listDate = JSON.parse(JSON.stringify(this.longPress));
97
97
  Logger.info('2024-3menu,this.listDate:' + JSON.stringify(this.listDate))
98
98
  for (let i = 0; i < this.listDate.length; i++) {
99
99
  if (this.listDate[i] !== null && this.listDate[i] !== undefined) {
@@ -93,7 +93,7 @@ export struct ContextMenuThreeMenuWithNoSelect {
93
93
  this.menuTag = this.menuTag;
94
94
  Logger.info('2024-3menu:' + JSON.stringify(this.longPress))
95
95
  //menu的大标题
96
- this.listDate = this.longPress;
96
+ this.listDate = JSON.parse(JSON.stringify(this.longPress));
97
97
  Logger.info('2024-3menu,this.listDate:' + JSON.stringify(this.listDate))
98
98
  for (let i = 0; i < this.listDate.length; i++) {
99
99
  if (this.listDate[i] !== null && this.listDate[i] !== undefined) {
@@ -169,6 +169,10 @@ export class ContextMenuTurboModule extends TurboModule {
169
169
  this.longPressTimestamp = e.timestamp / Math.pow(10, 6);
170
170
  this.longResult = this.longPressTimestamp - this.downTimestamp
171
171
  if (e.touchableViews[e.touchableViews.length-1] && !(e.dropdownMenuMode) && this.longResult >= 500) {
172
+ // fix 外层disabled不生效
173
+ if (e.disabled) {
174
+ return;
175
+ }
172
176
  //2024.12.06 fix:当处于多层嵌套外层情况下,tag值会错误
173
177
  this.realViewPoint.tag = e.rootTag;
174
178
  this.realViewPoint.x = e.touchableViews[e.touchableViews.length-1].x;
@@ -228,6 +232,10 @@ export class ContextMenuTurboModule extends TurboModule {
228
232
  //当点击外部的stack区域时候,获取的view只有两个,主屏幕和contextmenu容器,逻辑上是点击view才会触发menu
229
233
  // dropdownMenuMode-->true---->onTouch(),如果此时点击的事件大于500ms则不触发点击事件,如果小于500ms则触发点击效果
230
234
  if (e.touchableViews[e.touchableViews.length-1] && e.dropdownMenuMode && this.result < 500) {
235
+ // fix 外层disabled不生效
236
+ if (e.disabled) {
237
+ return;
238
+ }
231
239
  this.realViewPoint.tag = e.rootTag;
232
240
  this.realViewPoint.x = e.touchableViews[e.touchableViews.length-1].x;
233
241
  this.realViewPoint.y = e.touchableViews[e.touchableViews.length-1].y;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-context-menu-view",
3
- "version": "1.19.1",
3
+ "version": "1.20.0-beta.2",
4
4
  "description": "Use native context menu views from React Native",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -14,7 +14,8 @@
14
14
  "!ios/build",
15
15
  "!**/__tests__",
16
16
  "!**/__fixtures__",
17
- "!**/__mocks__"
17
+ "!**/__mocks__",
18
+ "!build"
18
19
  ],
19
20
  "keywords": [
20
21
  "react-native",
@@ -34,6 +35,12 @@
34
35
  "react-native": "*"
35
36
  },
36
37
  "harmony": {
37
- "alias": "react-native-context-menu-view"
38
+ "alias": "react-native-context-menu-view",
39
+ "autolinking": {
40
+ "etsPackageClassName":"ContextMenuPackage",
41
+ "cppPackageClassName":"ContextMenuPackage",
42
+ "cmakeLibraryTargetName": "rnoh_context_menu",
43
+ "ohPackageName": "@react-native-ohos/react-native-context-menu-view"
44
+ }
38
45
  }
39
46
  }
@@ -0,0 +1,26 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-context-menu-view"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.description = <<-DESC
10
+ react-native-context-menu-view
11
+ DESC
12
+ s.homepage = "https://github.com/mpiannucci/react-native-context-menu-view"
13
+ s.license = "MIT"
14
+ # s.license = { :type => "MIT", :file => "FILE_LICENSE" }
15
+ s.authors = { "Matthew Iannucci" => "mpiannucci@gmail.com" }
16
+ s.platforms = { :ios => "9.0" }
17
+ s.source = { :git => "https://github.com/mpiannucci/react-native-context-menu-view.git", :tag => "#{s.version}" }
18
+
19
+ s.source_files = "ios/**/*.{h,m,swift}"
20
+ s.requires_arc = true
21
+
22
+ s.dependency "React"
23
+ # ...
24
+ # s.dependency "..."
25
+ end
26
+