@react-native-ohos/react-native-context-menu-view 1.19.1-rc.2 → 1.19.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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Use these variables when you tailor your ArkTS code. They must be of the const type.
3
3
  */
4
- export const HAR_VERSION = '1.19.1-rc.1';
4
+ export const HAR_VERSION = '1.19.1';
5
5
  export const BUILD_MODE_NAME = 'debug';
6
6
  export const DEBUG = true;
7
7
  export const TARGET_NAME = 'default';
@@ -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-rc.2',
5
+ version: '1.19.1',
6
6
  description: '',
7
7
  main: 'index.ets',
8
8
  type: 'module',
@@ -228,7 +228,7 @@ export struct ContextMenuLongPress {
228
228
  labelInfo: item.subtitle,
229
229
  })
230
230
  .contentFont({
231
- family : this.menuFontName
231
+ family: this.menuFontName
232
232
  })
233
233
  .selected(item.selected)
234
234
  .selectIcon(new SymbolGlyphModifier($r('sys.symbol.checkmark')).fontSize('24vp'))
@@ -268,7 +268,7 @@ export struct ContextMenuLongPress {
268
268
  labelInfo: item.subtitle,
269
269
  })
270
270
  .contentFont({
271
- family : this.menuFontName
271
+ family: this.menuFontName
272
272
  })
273
273
  .selected(item.selected)
274
274
  .selectIcon(new SymbolGlyphModifier($r('sys.symbol.checkmark')).fontSize('24vp'))
@@ -310,7 +310,7 @@ export struct ContextMenuLongPress {
310
310
  labelInfo: item.subtitle,
311
311
  })
312
312
  .contentFont({
313
- family : this.menuFontName
313
+ family: this.menuFontName
314
314
  })
315
315
  .selected(item.selected)
316
316
  .selectIcon(new SymbolGlyphModifier($r('sys.symbol.checkmark')).fontSize('24vp'))
@@ -349,7 +349,7 @@ export struct ContextMenuLongPress {
349
349
  labelInfo: item.subtitle,
350
350
  })
351
351
  .contentFont({
352
- family : this.menuFontName
352
+ family: this.menuFontName
353
353
  })
354
354
  .selected(item.selected)
355
355
  .selectIcon(new SymbolGlyphModifier($r('sys.symbol.checkmark')).fontSize('24vp'))
@@ -387,7 +387,7 @@ export struct ContextMenuLongPress {
387
387
  }.backgroundColor('white')
388
388
  }
389
389
  .onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => {
390
- writeResult(newValue.width, newValue.height)
390
+ writeResult(newValue)
391
391
  })
392
392
  .onDisAppear(() => {
393
393
  this.menuCtx.rnInstance.postMessageToCpp('contextMenu::onCancel', {
@@ -369,7 +369,7 @@ export struct ContextMenuLongPressWithNoSelect {
369
369
  }.backgroundColor('white')
370
370
  }
371
371
  .onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => {
372
- writeResult(newValue.width, newValue.height)
372
+ writeResult(newValue)
373
373
  })
374
374
  .onDisAppear(() => {
375
375
  this.menuCtx.rnInstance.postMessageToCpp('contextMenu::onCancel', {
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { TurboModule, TurboModuleContext } from "@rnoh/react-native-openharmony/ts";
26
- import { ComponentContent, window } from '@kit.ArkUI';
26
+ import { ComponentContent, PromptAction, window } from '@kit.ArkUI';
27
27
  import { ContextMenuLongPress } from './ContextMenuLongPress';
28
28
  import { RNOHContext } from '@rnoh/react-native-openharmony';
29
29
  import { ContextMenuLongPressWithNoSelect } from './ContextMenuLongPressWithNoSelect';
@@ -41,19 +41,20 @@ function buildContextMenuWithNoSelect(realViewPoint: ESObject) {
41
41
  }
42
42
 
43
43
 
44
- let uiContext = null;
45
- let promptAction = null;
46
- let contentNode = null;
44
+ let uiContext: UIContext | null = null;
45
+ let promptAction: PromptAction | null = null;
46
+ let contentNode: ComponentContent<Object> | null = null;
47
47
 
48
48
  let realViewPointX = 0;
49
49
  let realViewPointY = 0;
50
50
  let windowWidth: number = 0;
51
51
  let windowHeight: number = 0;
52
+ let rnOHContext: RNOHContext;
52
53
 
53
- export function writeResult(width: Length, height: Length) {
54
+ export function writeResult(newValue: SizeOptions) {
54
55
  try {
55
- let x = realViewPointX + (width as number);
56
- let y = realViewPointY + (height as number);
56
+ let x = realViewPointX + (newValue.width as number);
57
+ let y = realViewPointY + (newValue.height as number);
57
58
 
58
59
  if (x > windowWidth) {
59
60
  realViewPointX = realViewPointX - (x - windowWidth) - 10;
@@ -69,8 +70,7 @@ export function writeResult(width: Length, height: Length) {
69
70
  dy: realViewPointY,
70
71
  }
71
72
  })
72
- this.menuHeight = 0;
73
- this.ctx.rnInstance.cppEventEmitter.subscribe("RNGH::CLOSE_MENU", () => {
73
+ rnOHContext.rnInstance.cppEventEmitter.subscribe("RNGH::CLOSE_MENU", () => {
74
74
  promptAction?.closeCustomDialog(contentNode);
75
75
  })
76
76
  } catch (error) {
@@ -141,12 +141,14 @@ export class ContextMenuTurboModule extends TurboModule {
141
141
 
142
142
  constructor(ctx: TurboModuleContext) {
143
143
  super(ctx)
144
+ rnOHContext = ctx;
144
145
  if (this.ctx.rnInstance.getArchitecture() === "C_API") {
145
146
  //e为C层拦截的ArkUI_UIInputEvent
146
147
  this.ctx.rnInstance.cppEventEmitter.subscribe("RNGH::TOUCH_EVENT", (e: ESObject) => {
147
148
  //获取view坐标
148
149
  console.log('ContextMenu:在ArkTs侧获取到了点击事件!TOUCH_EVENT,touchableViews:' +
149
- JSON.stringify(e.touchableViews) + '最后点击的节点为View:' + JSON.stringify(e.touchableViews[e.touchableViews.length-1]));
150
+ JSON.stringify(e.touchableViews) + '最后点击的节点为View:' +
151
+ JSON.stringify(e.touchableViews[e.touchableViews.length-1]));
150
152
  //e.action进行获取点击事件的次数,进行判定
151
153
  switch (e.action) {
152
154
  case 1:
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-rc.2",
3
+ "version": "1.19.1",
4
4
  "description": "Use native context menu views from React Native",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,26 +0,0 @@
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
-