@ng-native/components 0.29.0 → 0.30.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 (95) hide show
  1. package/README.md +2 -2
  2. package/dist/activity-indicator.js +3 -3
  3. package/dist/animated-style.js +3 -3
  4. package/dist/animations-web.js +3 -3
  5. package/dist/animations.js +3 -3
  6. package/dist/content-container.js +3 -3
  7. package/dist/context-menu.js +3 -3
  8. package/dist/drag-and-drop.js +6 -6
  9. package/dist/gestures-web.js +6 -6
  10. package/dist/gestures.js +6 -6
  11. package/dist/gradient-text.d.ts +1 -1
  12. package/dist/gradient-text.js +4 -4
  13. package/dist/gradient-text.js.map +1 -1
  14. package/dist/image-background.js +3 -3
  15. package/dist/image.js +3 -3
  16. package/dist/index.d.ts +2 -1
  17. package/dist/index.js +2 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/input-accessory-view.js +3 -3
  20. package/dist/keyboard-avoiding-view.js +3 -3
  21. package/dist/keyboard-dock.js +15 -15
  22. package/dist/markdown-blocks.d.ts +2 -1
  23. package/dist/markdown-blocks.js +22 -18
  24. package/dist/markdown-blocks.js.map +1 -1
  25. package/dist/markdown-columns.js +3 -3
  26. package/dist/markdown-stream.js +8 -5
  27. package/dist/markdown-stream.js.map +1 -1
  28. package/dist/markdown.js +5 -5
  29. package/dist/markdown.js.map +1 -1
  30. package/dist/menu.js +12 -12
  31. package/dist/modal.js +8 -3
  32. package/dist/modal.js.map +1 -1
  33. package/dist/native-button.js +3 -3
  34. package/dist/native-gesture.js +3 -3
  35. package/dist/native-ref.js +3 -3
  36. package/dist/press-menu.d.ts +17 -8
  37. package/dist/press-menu.js +39 -18
  38. package/dist/press-menu.js.map +1 -1
  39. package/dist/pressable.js +12 -12
  40. package/dist/reanimated-web.js +6 -6
  41. package/dist/reanimated.js +6 -6
  42. package/dist/refresh-control.js +3 -3
  43. package/dist/safe-area-provider.js +3 -3
  44. package/dist/safe-area-view.js +3 -3
  45. package/dist/scroll-view-props.js +3 -3
  46. package/dist/scroll-view.js +3 -3
  47. package/dist/section-list.d.ts +4 -4
  48. package/dist/section-list.js +37 -34
  49. package/dist/section-list.js.map +1 -1
  50. package/dist/shortcut.js +3 -3
  51. package/dist/sidebar-item.js +3 -3
  52. package/dist/sidebar-section.d.ts +12 -5
  53. package/dist/sidebar-section.js +32 -12
  54. package/dist/sidebar-section.js.map +1 -1
  55. package/dist/sidebar.d.ts +11 -3
  56. package/dist/sidebar.js +16 -7
  57. package/dist/sidebar.js.map +1 -1
  58. package/dist/split-view.js +6 -6
  59. package/dist/stand-ins/animations.js +3 -3
  60. package/dist/switch.js +3 -3
  61. package/dist/template-slot.js +3 -3
  62. package/dist/text-input.js +3 -3
  63. package/dist/text.js +3 -3
  64. package/dist/touchable-opacity.js +3 -3
  65. package/dist/tray-icon.js +3 -3
  66. package/dist/view-base.d.ts +18 -2
  67. package/dist/view-base.js +42 -10
  68. package/dist/view-base.js.map +1 -1
  69. package/dist/view.js +3 -3
  70. package/dist/virtual-list-layout.d.ts +5 -0
  71. package/dist/virtual-list-layout.js.map +1 -1
  72. package/dist/virtual-list-num-columns.d.ts +8 -4
  73. package/dist/virtual-list-num-columns.js +13 -5
  74. package/dist/virtual-list-num-columns.js.map +1 -1
  75. package/dist/virtual-list-sticky-level.js +3 -3
  76. package/dist/virtual-list.d.ts +48 -5
  77. package/dist/virtual-list.js +206 -46
  78. package/dist/virtual-list.js.map +1 -1
  79. package/dist/visual-effect.d.ts +37 -0
  80. package/dist/visual-effect.js +60 -0
  81. package/dist/visual-effect.js.map +1 -0
  82. package/dist/worklet-scroll.js +3 -3
  83. package/dist/worklet-style.js +3 -3
  84. package/dist/written-props.js +7 -0
  85. package/dist/written-props.js.map +1 -1
  86. package/ios/NgNativeComponents.podspec +2 -2
  87. package/ios/NgNativeKeyboardFocus.h +21 -0
  88. package/ios/NgNativeKeyboardFocus.mm +28 -0
  89. package/ios/NgNativeKeyboardFocusModule.mm +203 -0
  90. package/ios/NgNativeMenus.mm +20 -0
  91. package/ios/NgNativePressMenu.h +13 -5
  92. package/ios/NgNativePressMenu.mm +36 -2
  93. package/ios/NgNativeViewBinder.h +5 -0
  94. package/ios/NgNativeViewBinder.mm +31 -4
  95. package/package.json +6 -6
@@ -0,0 +1,37 @@
1
+ import { ViewBase } from './view-base.ts';
2
+ import * as i0 from "@angular/core";
3
+ /** One of AppKit's materials, by the name of its `NSVisualEffectMaterial` case. */
4
+ export type VisualEffectMaterial = 'sidebar' | 'window-background' | 'under-window-background' | 'content-background' | 'under-page-background' | 'header-view' | 'titlebar' | 'menu' | 'popover' | 'sheet' | 'hud-window' | 'full-screen-ui' | 'tooltip' | 'selection';
5
+ /** What the material blurs: the desktop and windows behind the window, or the window's own content. */
6
+ export type VisualEffectBlendingMode = 'behind-window' | 'within-window';
7
+ /** Whether the material looks active: as its window does, always, or never. */
8
+ export type VisualEffectState = 'follows-window' | 'active' | 'inactive';
9
+ /**
10
+ * A view in one of the system's translucent materials, behind its children:
11
+ *
12
+ * <visual-effect class="backdrop" material="sidebar">...</visual-effect>
13
+ *
14
+ * With `behind-window` blending, the default, macOS draws what is behind the window through it,
15
+ * blurred and tinted, as a source list's sidebar does, and with `within-window` the window's own
16
+ * content under it. It lays out and takes styles as a `<view>` does, and its `border-radius`
17
+ * rounds the material. Elsewhere it is a plain view: give it a `background-color` for Linux, iOS
18
+ * and Android.
19
+ */
20
+ export declare class VisualEffect extends ViewBase {
21
+ /**
22
+ * Whether the desktop host draws the material here, rather than a plain view. Where it does, an
23
+ * input left unset commits `null`, so one taken away goes back to the host's default rather than
24
+ * keeping the value it had; elsewhere none of them is committed.
25
+ */
26
+ protected readonly drawn: boolean;
27
+ /** The material. Defaults to `sidebar`. */
28
+ readonly material: import("@angular/core").InputSignal<VisualEffectMaterial | undefined>;
29
+ /** What the material blurs. Defaults to `behind-window`. */
30
+ readonly blendingMode: import("@angular/core").InputSignal<VisualEffectBlendingMode | undefined>;
31
+ /** Whether it looks active. Defaults to `follows-window`. */
32
+ readonly state: import("@angular/core").InputSignal<VisualEffectState | undefined>;
33
+ /** A selection material drawn in the accent colour, as a source list's focused selection is. */
34
+ readonly emphasized: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
35
+ static ɵfac: i0.ɵɵFactoryDeclaration<VisualEffect, never>;
36
+ static ɵdir: i0.ɵɵDirectiveDeclaration<VisualEffect, "visual-effect", never, { "material": { "alias": "material"; "required": false; "isSignal": true; }; "blendingMode": { "alias": "blendingMode"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "emphasized": { "alias": "emphasized"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
37
+ }
@@ -0,0 +1,60 @@
1
+ import { Directive, input } from '@angular/core';
2
+ import { registerViewName } from '@ng-native/fabric';
3
+ import { hostDraws } from "./split-view.js";
4
+ import { optionalBoolean } from "./transforms.js";
5
+ import { ViewBase } from "./view-base.js";
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * On macOS an NSVisualEffectView behind the element's children, drawn by the desktop host. On
9
+ * Linux, iOS and Android a plain view, whose own background shows.
10
+ */
11
+ registerViewName('visual-effect', {
12
+ ios: 'View',
13
+ android: 'View',
14
+ macos: 'NgNativeVisualEffect',
15
+ });
16
+ /**
17
+ * A view in one of the system's translucent materials, behind its children:
18
+ *
19
+ * <visual-effect class="backdrop" material="sidebar">...</visual-effect>
20
+ *
21
+ * With `behind-window` blending, the default, macOS draws what is behind the window through it,
22
+ * blurred and tinted, as a source list's sidebar does, and with `within-window` the window's own
23
+ * content under it. It lays out and takes styles as a `<view>` does, and its `border-radius`
24
+ * rounds the material. Elsewhere it is a plain view: give it a `background-color` for Linux, iOS
25
+ * and Android.
26
+ */
27
+ export class VisualEffect extends ViewBase {
28
+ /**
29
+ * Whether the desktop host draws the material here, rather than a plain view. Where it does, an
30
+ * input left unset commits `null`, so one taken away goes back to the host's default rather than
31
+ * keeping the value it had; elsewhere none of them is committed.
32
+ */
33
+ drawn = hostDraws('visual-effect');
34
+ /** The material. Defaults to `sidebar`. */
35
+ material = input(/* @ts-ignore */
36
+ ...(ngDevMode ? [undefined, { debugName: "material" }] : /* istanbul ignore next */ []));
37
+ /** What the material blurs. Defaults to `behind-window`. */
38
+ blendingMode = input(/* @ts-ignore */
39
+ ...(ngDevMode ? [undefined, { debugName: "blendingMode" }] : /* istanbul ignore next */ []));
40
+ /** Whether it looks active. Defaults to `follows-window`. */
41
+ state = input(/* @ts-ignore */
42
+ ...(ngDevMode ? [undefined, { debugName: "state" }] : /* istanbul ignore next */ []));
43
+ /** A selection material drawn in the accent colour, as a source list's focused selection is. */
44
+ emphasized = input(undefined, { ...(ngDevMode ? { debugName: "emphasized" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
45
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VisualEffect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
46
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: VisualEffect, isStandalone: true, selector: "visual-effect", inputs: { material: { classPropertyName: "material", publicName: "material", isSignal: true, isRequired: false, transformFunction: null }, blendingMode: { classPropertyName: "blendingMode", publicName: "blendingMode", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, emphasized: { classPropertyName: "emphasized", publicName: "emphasized", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "material": "drawn ? (material() ?? null) : undefined", "blendingMode": "drawn ? (blendingMode() ?? null) : undefined", "state": "drawn ? (state() ?? null) : undefined", "emphasized": "drawn ? (emphasized() ?? null) : undefined" } }, usesInheritance: true, ngImport: i0 });
47
+ }
48
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VisualEffect, decorators: [{
49
+ type: Directive,
50
+ args: [{
51
+ selector: 'visual-effect',
52
+ host: {
53
+ '[material]': 'drawn ? (material() ?? null) : undefined',
54
+ '[blendingMode]': 'drawn ? (blendingMode() ?? null) : undefined',
55
+ '[state]': 'drawn ? (state() ?? null) : undefined',
56
+ '[emphasized]': 'drawn ? (emphasized() ?? null) : undefined',
57
+ },
58
+ }]
59
+ }], propDecorators: { material: [{ type: i0.Input, args: [{ isSignal: true, alias: "material", required: false }] }], blendingMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "blendingMode", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], emphasized: [{ type: i0.Input, args: [{ isSignal: true, alias: "emphasized", required: false }] }] } });
60
+ //# sourceMappingURL=visual-effect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visual-effect.js","sourceRoot":"","sources":["../src/visual-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAE1C;;;GAGG;AACH,gBAAgB,CAAC,eAAe,EAAE;IAChC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,sBAAsB;CAC9B,CAAC,CAAC;AAyBH;;;;;;;;;;GAUG;AAUH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC;;;;OAIG;IACgB,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;IAEtD,2CAA2C;IAClC,QAAQ,GAAG,KAAK;4FAAwB,CAAC;IAClD,4DAA4D;IACnD,YAAY,GAAG,KAAK;gGAA4B,CAAC;IAC1D,6DAA6D;IACpD,KAAK,GAAG,KAAK;yFAAqB,CAAC;IAC5C,gGAAgG;IACvF,UAAU,GAAG,KAAK,CAAC,SAAS,kFAAI,SAAS,EAAE,eAAe,GAAG,CAAC;uGAf5D,YAAY;2FAAZ,YAAY;;2FAAZ,YAAY;kBATxB,SAAS;mBAAC;oBACT,QAAQ,EAAE,eAAe;oBACzB,IAAI,EAAE;wBACJ,YAAY,EAAE,0CAA0C;wBACxD,gBAAgB,EAAE,8CAA8C;wBAChE,SAAS,EAAE,uCAAuC;wBAClD,cAAc,EAAE,4CAA4C;qBAC7D;iBACF","sourcesContent":["import { Directive, input } from '@angular/core';\nimport { registerViewName } from '@ng-native/fabric';\nimport { hostDraws } from './split-view.ts';\nimport { optionalBoolean } from './transforms.ts';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * On macOS an NSVisualEffectView behind the element's children, drawn by the desktop host. On\n * Linux, iOS and Android a plain view, whose own background shows.\n */\nregisterViewName('visual-effect', {\n ios: 'View',\n android: 'View',\n macos: 'NgNativeVisualEffect',\n});\n\n/** One of AppKit's materials, by the name of its `NSVisualEffectMaterial` case. */\nexport type VisualEffectMaterial =\n | 'sidebar'\n | 'window-background'\n | 'under-window-background'\n | 'content-background'\n | 'under-page-background'\n | 'header-view'\n | 'titlebar'\n | 'menu'\n | 'popover'\n | 'sheet'\n | 'hud-window'\n | 'full-screen-ui'\n | 'tooltip'\n | 'selection';\n\n/** What the material blurs: the desktop and windows behind the window, or the window's own content. */\nexport type VisualEffectBlendingMode = 'behind-window' | 'within-window';\n\n/** Whether the material looks active: as its window does, always, or never. */\nexport type VisualEffectState = 'follows-window' | 'active' | 'inactive';\n\n/**\n * A view in one of the system's translucent materials, behind its children:\n *\n * <visual-effect class=\"backdrop\" material=\"sidebar\">...</visual-effect>\n *\n * With `behind-window` blending, the default, macOS draws what is behind the window through it,\n * blurred and tinted, as a source list's sidebar does, and with `within-window` the window's own\n * content under it. It lays out and takes styles as a `<view>` does, and its `border-radius`\n * rounds the material. Elsewhere it is a plain view: give it a `background-color` for Linux, iOS\n * and Android.\n */\n@Directive({\n selector: 'visual-effect',\n host: {\n '[material]': 'drawn ? (material() ?? null) : undefined',\n '[blendingMode]': 'drawn ? (blendingMode() ?? null) : undefined',\n '[state]': 'drawn ? (state() ?? null) : undefined',\n '[emphasized]': 'drawn ? (emphasized() ?? null) : undefined',\n },\n})\nexport class VisualEffect extends ViewBase {\n /**\n * Whether the desktop host draws the material here, rather than a plain view. Where it does, an\n * input left unset commits `null`, so one taken away goes back to the host's default rather than\n * keeping the value it had; elsewhere none of them is committed.\n */\n protected readonly drawn = hostDraws('visual-effect');\n\n /** The material. Defaults to `sidebar`. */\n readonly material = input<VisualEffectMaterial>();\n /** What the material blurs. Defaults to `behind-window`. */\n readonly blendingMode = input<VisualEffectBlendingMode>();\n /** Whether it looks active. Defaults to `follows-window`. */\n readonly state = input<VisualEffectState>();\n /** A selection material drawn in the accent colour, as a source list's focused selection is. */\n readonly emphasized = input(undefined, { transform: optionalBoolean });\n}\n"]}
@@ -39,10 +39,10 @@ export class WorkletScrollBase {
39
39
  }, { injector: this.injector });
40
40
  });
41
41
  }
42
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: WorkletScrollBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
43
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.0", type: WorkletScrollBase, isStandalone: true, selector: "[workletScroll]", inputs: { workletScroll: { classPropertyName: "workletScroll", publicName: "workletScroll", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
42
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletScrollBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
43
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: WorkletScrollBase, isStandalone: true, selector: "[workletScroll]", inputs: { workletScroll: { classPropertyName: "workletScroll", publicName: "workletScroll", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
44
44
  }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: WorkletScrollBase, decorators: [{
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletScrollBase, decorators: [{
46
46
  type: Directive,
47
47
  args: [{ selector: '[workletScroll]' }]
48
48
  }], ctorParameters: () => [], propDecorators: { workletScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "workletScroll", required: true }] }] } });
@@ -51,10 +51,10 @@ export class WorkletStyleBase {
51
51
  this.drawn = { ...this.drawn, ...props };
52
52
  this.engine.setUiThreadProps(this.node, this.drawn);
53
53
  }
54
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: WorkletStyleBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
55
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.0", type: WorkletStyleBase, isStandalone: true, selector: "[workletStyle]", inputs: { workletStyle: { classPropertyName: "workletStyle", publicName: "workletStyle", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
54
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletStyleBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
55
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: WorkletStyleBase, isStandalone: true, selector: "[workletStyle]", inputs: { workletStyle: { classPropertyName: "workletStyle", publicName: "workletStyle", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
56
56
  }
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: WorkletStyleBase, decorators: [{
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletStyleBase, decorators: [{
58
58
  type: Directive,
59
59
  args: [{ selector: '[workletStyle]' }]
60
60
  }], ctorParameters: () => [], propDecorators: { workletStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "workletStyle", required: true }] }] } });
@@ -196,6 +196,8 @@ export const WRITTEN_PROPS = [
196
196
  'tintColor',
197
197
  'title',
198
198
  'titleColor',
199
+ 'toggleButton',
200
+ 'tooltip',
199
201
  'trackColorForFalse',
200
202
  'trackColorForTrue',
201
203
  'trackTintColor',
@@ -206,5 +208,10 @@ export const WRITTEN_PROPS = [
206
208
  'visible',
207
209
  'zIndex',
208
210
  'zoomScale',
211
+ // <visual-effect>'s, on a desktop host.
212
+ 'blendingMode',
213
+ 'emphasized',
214
+ 'material',
215
+ 'state',
209
216
  ];
210
217
  //# sourceMappingURL=written-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"written-props.js","sourceRoot":"","sources":["../src/written-props.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Every prop the components send through a host binding or a write from code, under the native\n * view's own name, which is often not the name of any input. `native-props.test.ts` holds it to\n * the sources.\n */\nexport const WRITTEN_PROPS: readonly string[] = [\n 'accessibilityActions',\n 'accessibilityColumnCount',\n 'accessibilityDescribedBy',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityIgnoresInvertColors',\n 'accessibilityInvalid',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityLanguage',\n 'accessibilityLargeContentTitle',\n 'accessibilityLevel',\n 'accessibilityLiveRegion',\n 'accessibilityPosInSet',\n 'accessibilityRequired',\n 'accessibilityRespondsToUserInteraction',\n 'accessibilityRole',\n 'accessibilityRowCount',\n 'accessibilitySetSize',\n 'accessibilityShowsLargeContentViewer',\n 'accessibilityState',\n 'accessibilityValue',\n 'accessibilityViewIsModal',\n 'accessible',\n 'adjustsFontSizeToFit',\n 'allowFontScaling',\n 'allowSwipeDismissal',\n 'anchor',\n 'alwaysBounceHorizontal',\n 'alwaysBounceVertical',\n 'android_hyphenationFrequency',\n 'animating',\n 'animationType',\n 'autoCapitalize',\n 'autoComplete',\n 'autoCorrect',\n 'autoFocus',\n 'automaticallyAdjustContentInsets',\n 'automaticallyAdjustKeyboardInsets',\n 'automaticallyAdjustsScrollIndicatorInsets',\n 'autosaveName',\n 'backgroundColor',\n 'badge',\n 'blurRadius',\n 'bounces',\n 'bouncesZoom',\n 'canCancelContentTouches',\n 'capInsets',\n 'caretHidden',\n 'centerContent',\n 'clearButtonMode',\n 'clearTextOnFocus',\n 'collapsable',\n 'collapsableChildren',\n 'collapsed',\n 'collapsible',\n 'color',\n 'colors',\n 'contentInset',\n 'contentInsetAdjustmentBehavior',\n 'contentOffset',\n 'contentStyle',\n 'contextMenu',\n 'contextMenuHidden',\n 'controlSize',\n 'cursorColor',\n 'dataDetectorType',\n 'dataDetectorTypes',\n 'decelerationRate',\n 'defaultSource',\n 'directionalLockEnabled',\n 'disableFullscreenUI',\n 'disableIntervalMomentum',\n 'disabled',\n 'dragItem',\n 'drawable',\n 'dynamicTypeRamp',\n 'edges',\n 'editable',\n 'ellipsizeMode',\n 'enabled',\n 'enablesReturnKeyAutomatically',\n 'endFillColor',\n 'fadeDuration',\n 'fadingEdgeLength',\n 'fileDrop',\n 'flexDirection',\n 'focusable',\n 'hardwareAccelerated',\n 'hidesWhenStopped',\n 'hitSlop',\n 'horizontal',\n 'iconImage',\n 'importantForAutofill',\n 'indeterminate',\n 'indicatorStyle',\n 'inlineImageLeft',\n 'inlineImagePadding',\n 'inputAccessoryViewID',\n 'isHighlighted',\n 'isPressable',\n 'keyboardAppearance',\n 'keyboardDismissMode',\n 'keyboardType',\n 'kind',\n 'label',\n 'lineBreakStrategyIOS',\n 'loadingIndicatorSource',\n 'maintainVisibleContentPosition',\n 'maxFontSizeMultiplier',\n 'maxLength',\n 'maximumZoomScale',\n 'minimumFontScale',\n 'minimumZoomScale',\n 'mode',\n 'mostRecentEventCount',\n 'multiline',\n 'nativeBackgroundAndroid',\n 'nativeForegroundAndroid',\n 'nativeID',\n 'navigationBarTranslucent',\n 'needsOffscreenAlphaCompositing',\n 'nestedScrollEnabled',\n 'numberOfLines',\n 'on',\n 'onTintColor',\n 'overScrollMode',\n 'pagingEnabled',\n 'paneMaxWidth',\n 'paneMinWidth',\n 'passwordRules',\n 'persistentScrollbar',\n 'pinchGestureEnabled',\n 'placeholder',\n 'placeholderTextColor',\n 'pointerEvents',\n 'presentationStyle',\n 'progressBackgroundColor',\n 'progressViewOffset',\n 'progressiveRenderingEnabled',\n 'refreshing',\n 'removeClippedSubviews',\n 'renderToHardwareTextureAndroid',\n 'resizeMethod',\n 'resizeMode',\n 'resizeMultiplier',\n 'returnKeyType',\n 'role',\n 'rows',\n 'scrollEnabled',\n 'scrollEventThrottle',\n 'scrollIndicatorInsets',\n 'scrollToOverflowEnabled',\n 'scrollsToTop',\n 'secureTextEntry',\n 'selectTextOnFocus',\n 'selectable',\n 'selected',\n 'selection',\n 'selectionColor',\n 'selectionHandleColor',\n 'sendMomentumEvents',\n 'sfSymbol',\n 'shouldRasterizeIOS',\n 'showSoftInputOnFocus',\n 'showsHorizontalScrollIndicator',\n 'showsVerticalScrollIndicator',\n 'size',\n 'smartInsertDelete',\n 'smartQuotes',\n 'snapToAlignment',\n 'snapToEnd',\n 'snapToInterval',\n 'snapToOffsets',\n 'snapToStart',\n 'source',\n 'spellCheck',\n 'statusBarTranslucent',\n 'styleAttr',\n 'submitBehavior',\n 'supportedOrientations',\n 'svgIcon',\n 'testID',\n 'text',\n 'textAlign',\n 'textAlignVertical',\n 'textBreakStrategy',\n 'textContentType',\n 'thumbTintColor',\n 'tintColor',\n 'title',\n 'titleColor',\n 'trackColorForFalse',\n 'trackColorForTrue',\n 'trackTintColor',\n 'transform',\n 'transparent',\n 'underlineColorAndroid',\n 'value',\n 'visible',\n 'zIndex',\n 'zoomScale',\n];\n"]}
1
+ {"version":3,"file":"written-props.js","sourceRoot":"","sources":["../src/written-props.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Every prop the components send through a host binding or a write from code, under the native\n * view's own name, which is often not the name of any input. `native-props.test.ts` holds it to\n * the sources.\n */\nexport const WRITTEN_PROPS: readonly string[] = [\n 'accessibilityActions',\n 'accessibilityColumnCount',\n 'accessibilityDescribedBy',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityIgnoresInvertColors',\n 'accessibilityInvalid',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityLanguage',\n 'accessibilityLargeContentTitle',\n 'accessibilityLevel',\n 'accessibilityLiveRegion',\n 'accessibilityPosInSet',\n 'accessibilityRequired',\n 'accessibilityRespondsToUserInteraction',\n 'accessibilityRole',\n 'accessibilityRowCount',\n 'accessibilitySetSize',\n 'accessibilityShowsLargeContentViewer',\n 'accessibilityState',\n 'accessibilityValue',\n 'accessibilityViewIsModal',\n 'accessible',\n 'adjustsFontSizeToFit',\n 'allowFontScaling',\n 'allowSwipeDismissal',\n 'anchor',\n 'alwaysBounceHorizontal',\n 'alwaysBounceVertical',\n 'android_hyphenationFrequency',\n 'animating',\n 'animationType',\n 'autoCapitalize',\n 'autoComplete',\n 'autoCorrect',\n 'autoFocus',\n 'automaticallyAdjustContentInsets',\n 'automaticallyAdjustKeyboardInsets',\n 'automaticallyAdjustsScrollIndicatorInsets',\n 'autosaveName',\n 'backgroundColor',\n 'badge',\n 'blurRadius',\n 'bounces',\n 'bouncesZoom',\n 'canCancelContentTouches',\n 'capInsets',\n 'caretHidden',\n 'centerContent',\n 'clearButtonMode',\n 'clearTextOnFocus',\n 'collapsable',\n 'collapsableChildren',\n 'collapsed',\n 'collapsible',\n 'color',\n 'colors',\n 'contentInset',\n 'contentInsetAdjustmentBehavior',\n 'contentOffset',\n 'contentStyle',\n 'contextMenu',\n 'contextMenuHidden',\n 'controlSize',\n 'cursorColor',\n 'dataDetectorType',\n 'dataDetectorTypes',\n 'decelerationRate',\n 'defaultSource',\n 'directionalLockEnabled',\n 'disableFullscreenUI',\n 'disableIntervalMomentum',\n 'disabled',\n 'dragItem',\n 'drawable',\n 'dynamicTypeRamp',\n 'edges',\n 'editable',\n 'ellipsizeMode',\n 'enabled',\n 'enablesReturnKeyAutomatically',\n 'endFillColor',\n 'fadeDuration',\n 'fadingEdgeLength',\n 'fileDrop',\n 'flexDirection',\n 'focusable',\n 'hardwareAccelerated',\n 'hidesWhenStopped',\n 'hitSlop',\n 'horizontal',\n 'iconImage',\n 'importantForAutofill',\n 'indeterminate',\n 'indicatorStyle',\n 'inlineImageLeft',\n 'inlineImagePadding',\n 'inputAccessoryViewID',\n 'isHighlighted',\n 'isPressable',\n 'keyboardAppearance',\n 'keyboardDismissMode',\n 'keyboardType',\n 'kind',\n 'label',\n 'lineBreakStrategyIOS',\n 'loadingIndicatorSource',\n 'maintainVisibleContentPosition',\n 'maxFontSizeMultiplier',\n 'maxLength',\n 'maximumZoomScale',\n 'minimumFontScale',\n 'minimumZoomScale',\n 'mode',\n 'mostRecentEventCount',\n 'multiline',\n 'nativeBackgroundAndroid',\n 'nativeForegroundAndroid',\n 'nativeID',\n 'navigationBarTranslucent',\n 'needsOffscreenAlphaCompositing',\n 'nestedScrollEnabled',\n 'numberOfLines',\n 'on',\n 'onTintColor',\n 'overScrollMode',\n 'pagingEnabled',\n 'paneMaxWidth',\n 'paneMinWidth',\n 'passwordRules',\n 'persistentScrollbar',\n 'pinchGestureEnabled',\n 'placeholder',\n 'placeholderTextColor',\n 'pointerEvents',\n 'presentationStyle',\n 'progressBackgroundColor',\n 'progressViewOffset',\n 'progressiveRenderingEnabled',\n 'refreshing',\n 'removeClippedSubviews',\n 'renderToHardwareTextureAndroid',\n 'resizeMethod',\n 'resizeMode',\n 'resizeMultiplier',\n 'returnKeyType',\n 'role',\n 'rows',\n 'scrollEnabled',\n 'scrollEventThrottle',\n 'scrollIndicatorInsets',\n 'scrollToOverflowEnabled',\n 'scrollsToTop',\n 'secureTextEntry',\n 'selectTextOnFocus',\n 'selectable',\n 'selected',\n 'selection',\n 'selectionColor',\n 'selectionHandleColor',\n 'sendMomentumEvents',\n 'sfSymbol',\n 'shouldRasterizeIOS',\n 'showSoftInputOnFocus',\n 'showsHorizontalScrollIndicator',\n 'showsVerticalScrollIndicator',\n 'size',\n 'smartInsertDelete',\n 'smartQuotes',\n 'snapToAlignment',\n 'snapToEnd',\n 'snapToInterval',\n 'snapToOffsets',\n 'snapToStart',\n 'source',\n 'spellCheck',\n 'statusBarTranslucent',\n 'styleAttr',\n 'submitBehavior',\n 'supportedOrientations',\n 'svgIcon',\n 'testID',\n 'text',\n 'textAlign',\n 'textAlignVertical',\n 'textBreakStrategy',\n 'textContentType',\n 'thumbTintColor',\n 'tintColor',\n 'title',\n 'titleColor',\n 'toggleButton',\n 'tooltip',\n 'trackColorForFalse',\n 'trackColorForTrue',\n 'trackTintColor',\n 'transform',\n 'transparent',\n 'underlineColorAndroid',\n 'value',\n 'visible',\n 'zIndex',\n 'zoomScale',\n // <visual-effect>'s, on a desktop host.\n 'blendingMode',\n 'emphasized',\n 'material',\n 'state',\n];\n"]}
@@ -15,9 +15,9 @@ Pod::Spec.new do |s|
15
15
  s.description = package['description']
16
16
  s.license = package['license']
17
17
  s.author = 'Angular Native'
18
- s.homepage = 'https://github.com/ng-native/ng-native'
18
+ s.homepage = 'https://github.com/coralogix/ng-native'
19
19
  s.platforms = { :ios => '16.4' }
20
- s.source = { git: 'https://github.com/ng-native/ng-native.git' }
20
+ s.source = { git: 'https://github.com/coralogix/ng-native.git' }
21
21
  s.static_framework = true
22
22
 
23
23
  s.source_files = '**/*.{h,mm}'
@@ -0,0 +1,21 @@
1
+ // What an iPad's hardware keyboard can focus among React Native's views, which take no part in
2
+ // UIKit's focus system on their own: React Native's iOS props have no `focusable`. A view that
3
+ // commits `focusable: true` is reported by react tag (the NgNativeKeyboardFocus module); the hooks
4
+ // on RCTViewComponentView let it be focused, draw the focus halo, and press it on Space and Return
5
+ // with the touch a tap would send. The parts here run without React Native.
6
+ #pragma once
7
+
8
+ #import <UIKit/UIKit.h>
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ // Whether the view with react tag `tag` takes the keyboard's focus. Forgotten as React Native
13
+ // recycles the view. Main thread.
14
+ void NgNativeSetKeyboardFocusable(NSInteger tag, BOOL focusable);
15
+ BOOL NgNativeKeyboardFocusable(NSInteger tag);
16
+
17
+ // Whether `key`, with `modifiers` held, presses the focused view: Space, Return or the keypad's
18
+ // Enter, with nothing held but Caps Lock.
19
+ BOOL NgNativeKeyPresses(UIKeyboardHIDUsage key, UIKeyModifierFlags modifiers);
20
+
21
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,28 @@
1
+ #import "NgNativeKeyboardFocus.h"
2
+
3
+ static NSMutableSet<NSNumber *> *focusableTags(void)
4
+ {
5
+ static NSMutableSet<NSNumber *> *tags = [NSMutableSet set];
6
+ return tags;
7
+ }
8
+
9
+ void NgNativeSetKeyboardFocusable(NSInteger tag, BOOL focusable)
10
+ {
11
+ if (focusable) {
12
+ [focusableTags() addObject:@(tag)];
13
+ } else {
14
+ [focusableTags() removeObject:@(tag)];
15
+ }
16
+ }
17
+
18
+ BOOL NgNativeKeyboardFocusable(NSInteger tag)
19
+ {
20
+ return [focusableTags() containsObject:@(tag)];
21
+ }
22
+
23
+ BOOL NgNativeKeyPresses(UIKeyboardHIDUsage key, UIKeyModifierFlags modifiers)
24
+ {
25
+ BOOL pressing = key == UIKeyboardHIDUsageKeyboardSpacebar || key == UIKeyboardHIDUsageKeyboardReturnOrEnter ||
26
+ key == UIKeyboardHIDUsageKeypadEnter;
27
+ return pressing && (modifiers & ~(UIKeyModifierAlphaShift | UIKeyModifierNumericPad)) == 0;
28
+ }
@@ -0,0 +1,203 @@
1
+ /**
2
+ The iPad hardware keyboard's focus on React Native's views (NgNativeKeyboardFocus.h).
3
+
4
+ - `setFocusable(tag, focusable)`: the view with that react tag commits `focusable`. Sent by
5
+ `@ng-native/components` once the view is committed.
6
+
7
+ The first call installs hooks on RCTViewComponentView. A view reported focusable, shown, taking
8
+ touches and not disabled answers `canBecomeFocused`, draws UIKit's focus halo in its corners, and
9
+ while focused takes Space and Return: the press sends the touch start and end a tap at its middle
10
+ would, so whatever presses on a tap (a pressable, its press menu) presses here too. A recycled
11
+ view is forgotten.
12
+ */
13
+ #import <React/RCTBridgeModule.h>
14
+ #import <React/RCTConversions.h>
15
+ #import <React/RCTRootComponentView.h>
16
+ #import <React/RCTViewComponentView.h>
17
+
18
+ #import "NgNativeKeyboardFocus.h"
19
+ #import "NgNativeResponderHooks.h"
20
+
21
+ #include <react/renderer/components/view/TouchEvent.h>
22
+
23
+ using namespace facebook::react;
24
+
25
+ // The touch a keyboard press stands for, told apart from a finger's.
26
+ static const int kKeyboardTouch = 0x4b4559;
27
+
28
+ // The view a held Space or Return is pressing, and the key that started it, until that key is let go.
29
+ static __weak RCTViewComponentView *pressing;
30
+ static UIKeyboardHIDUsage pressingKey;
31
+
32
+ @interface RCTViewComponentView (NgNativeKeyboardFocus)
33
+ - (BOOL)ngn_takesKeyboardFocus;
34
+ - (void)ngn_sendKeyboardTouch:(int)phase;
35
+ @end
36
+
37
+ @implementation RCTViewComponentView (NgNativeKeyboardFocus)
38
+
39
+ - (BOOL)ngn_takesKeyboardFocus
40
+ {
41
+ if (!NgNativeKeyboardFocusable(self.tag) || self.hidden || !self.userInteractionEnabled) {
42
+ return NO;
43
+ }
44
+ return !(_props && _props->accessibilityState && _props->accessibilityState->disabled);
45
+ }
46
+
47
+ // 0 starts, 1 ends and 2 cancels the touch, at the view's middle.
48
+ - (void)ngn_sendKeyboardTouch:(int)phase
49
+ {
50
+ if (!_eventEmitter) {
51
+ return;
52
+ }
53
+ UIView *root = self;
54
+ while (root.superview != nil && ![root isKindOfClass:[RCTRootComponentView class]]) {
55
+ root = root.superview;
56
+ }
57
+ CGPoint middle = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
58
+ Touch touch{};
59
+ touch.offsetPoint = RCTPointFromCGPoint(middle);
60
+ touch.pagePoint = RCTPointFromCGPoint([self convertPoint:middle toView:root]);
61
+ touch.screenPoint = RCTPointFromCGPoint([self convertPoint:middle toView:nil]);
62
+ touch.identifier = kKeyboardTouch;
63
+ touch.target = (Tag)self.tag;
64
+ NSTimeInterval now = CACurrentMediaTime();
65
+ touch.timestamp = (Float)now;
66
+ touch.timeStamp = RCTHighResTimeStampFromSeconds(now);
67
+ TouchEvent event;
68
+ event.changedTouches.insert(touch);
69
+ if (phase == 0) {
70
+ event.touches.insert(touch);
71
+ event.targetTouches.insert(touch);
72
+ _eventEmitter->onTouchStart(event);
73
+ } else if (phase == 1) {
74
+ _eventEmitter->onTouchEnd(event);
75
+ } else {
76
+ _eventEmitter->onTouchCancel(event);
77
+ }
78
+ }
79
+
80
+ @end
81
+
82
+ // The key among `presses` that presses the focused view, or 0 for none.
83
+ static UIKeyboardHIDUsage keyPressingView(NSSet<UIPress *> *presses)
84
+ {
85
+ for (UIPress *press in presses) {
86
+ if (press.key != nil && NgNativeKeyPresses(press.key.keyCode, press.key.modifierFlags)) {
87
+ return press.key.keyCode;
88
+ }
89
+ }
90
+ return (UIKeyboardHIDUsage)0;
91
+ }
92
+
93
+ // Whether `presses` let go of `key`, whatever is held with it now.
94
+ static BOOL releases(NSSet<UIPress *> *presses, UIKeyboardHIDUsage key)
95
+ {
96
+ for (UIPress *press in presses) {
97
+ if (press.key != nil && press.key.keyCode == key) {
98
+ return YES;
99
+ }
100
+ }
101
+ return NO;
102
+ }
103
+
104
+ static void installHooks(void)
105
+ {
106
+ Class view = [RCTViewComponentView class];
107
+ NgNativeHook(view, @selector(canBecomeFocused), "B@:", ^id(IMP previous) {
108
+ return ^BOOL(RCTViewComponentView *self) {
109
+ if ([self ngn_takesKeyboardFocus]) {
110
+ return YES;
111
+ }
112
+ return previous != NULL && ((BOOL (*)(id, SEL))previous)(self, @selector(canBecomeFocused));
113
+ };
114
+ });
115
+ NgNativeHook(view, @selector(focusEffect), "@@:", ^id(IMP previous) {
116
+ return ^UIFocusEffect *(RCTViewComponentView *self) {
117
+ if ([self ngn_takesKeyboardFocus]) {
118
+ return [UIFocusHaloEffect effectWithRoundedRect:self.bounds
119
+ cornerRadius:self.layer.cornerRadius
120
+ curve:kCACornerCurveContinuous];
121
+ }
122
+ return previous != NULL ? ((UIFocusEffect * (*)(id, SEL)) previous)(self, @selector(focusEffect)) : nil;
123
+ };
124
+ });
125
+ NgNativeHook(view, @selector(pressesBegan:withEvent:), "v@:@@", ^id(IMP previous) {
126
+ return ^(RCTViewComponentView *self, NSSet<UIPress *> *presses, UIPressesEvent *event) {
127
+ UIKeyboardHIDUsage key = keyPressingView(presses);
128
+ if (pressing == nil && key != (UIKeyboardHIDUsage)0 && self.isFocused && [self ngn_takesKeyboardFocus]) {
129
+ pressing = self;
130
+ pressingKey = key;
131
+ [self ngn_sendKeyboardTouch:0];
132
+ return;
133
+ }
134
+ if (previous != NULL) {
135
+ ((void (*)(id, SEL, id, id))previous)(self, @selector(pressesBegan:withEvent:), presses, event);
136
+ }
137
+ };
138
+ });
139
+ NgNativeHook(view, @selector(pressesEnded:withEvent:), "v@:@@", ^id(IMP previous) {
140
+ return ^(RCTViewComponentView *self, NSSet<UIPress *> *presses, UIPressesEvent *event) {
141
+ // Only the key that started the press ends it: another one let go while it is held does not.
142
+ if (pressing == self && releases(presses, pressingKey)) {
143
+ pressing = nil;
144
+ [self ngn_sendKeyboardTouch:1];
145
+ return;
146
+ }
147
+ if (previous != NULL) {
148
+ ((void (*)(id, SEL, id, id))previous)(self, @selector(pressesEnded:withEvent:), presses, event);
149
+ }
150
+ };
151
+ });
152
+ NgNativeHook(view, @selector(pressesCancelled:withEvent:), "v@:@@", ^id(IMP previous) {
153
+ return ^(RCTViewComponentView *self, NSSet<UIPress *> *presses, UIPressesEvent *event) {
154
+ if (pressing == self && releases(presses, pressingKey)) {
155
+ pressing = nil;
156
+ [self ngn_sendKeyboardTouch:2];
157
+ return;
158
+ }
159
+ if (previous != NULL) {
160
+ ((void (*)(id, SEL, id, id))previous)(self, @selector(pressesCancelled:withEvent:), presses, event);
161
+ }
162
+ };
163
+ });
164
+ NgNativeHook(view, @selector(prepareForRecycle), "v@:", ^id(IMP previous) {
165
+ return ^(RCTViewComponentView *self) {
166
+ NgNativeSetKeyboardFocusable(self.tag, NO);
167
+ if (pressing == self) {
168
+ pressing = nil;
169
+ }
170
+ if (previous != NULL) {
171
+ ((void (*)(id, SEL))previous)(self, @selector(prepareForRecycle));
172
+ }
173
+ };
174
+ });
175
+ }
176
+
177
+ @interface NgNativeKeyboardFocus : NSObject <RCTBridgeModule>
178
+ @end
179
+
180
+ @implementation NgNativeKeyboardFocus
181
+
182
+ RCT_EXPORT_MODULE()
183
+
184
+ + (BOOL)requiresMainQueueSetup
185
+ {
186
+ return YES;
187
+ }
188
+
189
+ - (dispatch_queue_t)methodQueue
190
+ {
191
+ return dispatch_get_main_queue();
192
+ }
193
+
194
+ RCT_EXPORT_METHOD(setFocusable : (double)tag focusable : (BOOL)focusable)
195
+ {
196
+ static dispatch_once_t once;
197
+ dispatch_once(&once, ^{
198
+ installHooks();
199
+ });
200
+ NgNativeSetKeyboardFocusable((NSInteger)tag, focusable);
201
+ }
202
+
203
+ @end
@@ -193,12 +193,22 @@ RCT_EXPORT_MODULE()
193
193
  });
194
194
  }
195
195
 
196
+ /** Whether a press menu opens from code, by `openPressMenu`: iOS 17.4 and later. */
197
+ static BOOL opensPressMenus(void)
198
+ {
199
+ if (@available(iOS 17.4, *)) {
200
+ return YES;
201
+ }
202
+ return NO;
203
+ }
204
+
196
205
  - (NSDictionary *)constantsToExport
197
206
  {
198
207
  NSDictionary *info = NSBundle.mainBundle.infoDictionary;
199
208
  return @{
200
209
  @"menuBar" : @(UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad),
201
210
  @"appName" : info[@"CFBundleDisplayName"] ?: info[@"CFBundleName"] ?: @"",
211
+ @"opensPressMenus" : @(opensPressMenus()),
202
212
  };
203
213
  }
204
214
 
@@ -263,6 +273,16 @@ RCT_EXPORT_METHOD(setPressMenu : (NSString *)nativeID entries : (nullable NSArra
263
273
  }
264
274
  }
265
275
 
276
+ RCT_EXPORT_METHOD(openPressMenu : (NSString *)nativeID)
277
+ {
278
+ if (![nativeID isKindOfClass:[NSString class]] || _pressMenus[nativeID] == nil) {
279
+ return;
280
+ }
281
+ // The view was pressed or is on screen, so it is mounted and in a window, even where the binder
282
+ // has not looked for it again yet. A menu the button's own touch opened is showing, and stays.
283
+ NgNativeOpenPressMenu([_pressMenuViews tokenFindingNow:nativeID]);
284
+ }
285
+
266
286
  RCT_EXPORT_METHOD(setTakesLongPress : (NSString *)nativeID takes : (BOOL)takes)
267
287
  {
268
288
  if (![nativeID isKindOfClass:[NSString class]] || nativeID.length == 0) {
@@ -1,8 +1,9 @@
1
- // A menu a press opens on React Native's view. UIKit opens a menu on a touch only from a control
2
- // of its own, so a clear button with `showsMenuAsPrimaryAction` is laid over the whole view, in the
3
- // view that holds its children and above them. A touch then opens the menu, and VoiceOver's
4
- // activation of the view, which taps its middle, opens it too. UIKit has no way to open it from
5
- // code.
1
+ // A menu a press opens on React Native's view. UIKit opens a menu as a primary action only from a
2
+ // control of its own, so a clear button with `showsMenuAsPrimaryAction` is laid over the whole view,
3
+ // in the view that holds its children and above them. A touch then opens the menu as it goes down,
4
+ // as SwiftUI's `Menu` does, and a long press is the menu's too. From iOS 17.4,
5
+ // `NgNativeOpenPressMenu` opens it from code: for the app, and for a tap the view took before the
6
+ // button was laid.
6
7
  #pragma once
7
8
 
8
9
  #import <UIKit/UIKit.h>
@@ -19,10 +20,17 @@ NS_ASSUME_NONNULL_BEGIN
19
20
 
20
21
  // The menu, as the app sends it; setting it makes the button's menu again.
21
22
  @property (nonatomic, copy) NSArray *entries;
23
+ // Whether the menu is showing.
24
+ @property (nonatomic, readonly) BOOL showing;
22
25
 
23
26
  @end
24
27
 
25
28
  // A press menu button with `entries` laid over `view`, whose choice runs `choose`.
26
29
  NgNativePressMenuButton *NgNativeAddPressMenu(UIView *view, NSArray *entries, NgNativeMenuChoose choose);
27
30
 
31
+ // Open `button`'s menu now, unless it is showing: a touch on the button opens it, and React
32
+ // Native's own press on the view can follow. Answers whether it asked UIKit to open it. iOS 17.4 and
33
+ // later; does nothing before.
34
+ BOOL NgNativeOpenPressMenu(NgNativePressMenuButton *_Nullable button);
35
+
28
36
  NS_ASSUME_NONNULL_END
@@ -7,6 +7,8 @@
7
7
 
8
8
  @implementation NgNativePressMenuButton {
9
9
  NgNativeMenuChoose _choose;
10
+ // Whether the menu is showing, from UIKit's display until its dismissal.
11
+ BOOL _showing;
10
12
  }
11
13
 
12
14
  - (instancetype)initWithChoose:(NgNativeMenuChoose)choose
@@ -17,13 +19,33 @@
17
19
  self.backgroundColor = UIColor.clearColor;
18
20
  self.showsMenuAsPrimaryAction = YES;
19
21
  self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
20
- // React Native's view is the accessibility element, with the app's label, role and state;
21
- // VoiceOver's activation of it taps its middle, which lands here.
22
+ // React Native's view is the accessibility element, with the app's label, role and state.
22
23
  self.isAccessibilityElement = NO;
23
24
  }
24
25
  return self;
25
26
  }
26
27
 
28
+ - (void)contextMenuInteraction:(UIContextMenuInteraction *)interaction
29
+ willDisplayMenuForConfiguration:(UIContextMenuConfiguration *)configuration
30
+ animator:(id<UIContextMenuInteractionAnimating>)animator
31
+ {
32
+ [super contextMenuInteraction:interaction willDisplayMenuForConfiguration:configuration animator:animator];
33
+ _showing = YES;
34
+ }
35
+
36
+ - (void)contextMenuInteraction:(UIContextMenuInteraction *)interaction
37
+ willEndForConfiguration:(UIContextMenuConfiguration *)configuration
38
+ animator:(id<UIContextMenuInteractionAnimating>)animator
39
+ {
40
+ [super contextMenuInteraction:interaction willEndForConfiguration:configuration animator:animator];
41
+ _showing = NO;
42
+ }
43
+
44
+ - (BOOL)showing
45
+ {
46
+ return _showing;
47
+ }
48
+
27
49
  - (void)setEntries:(NSArray *)entries
28
50
  {
29
51
  _entries = [entries copy];
@@ -43,3 +65,15 @@ NgNativePressMenuButton *NgNativeAddPressMenu(UIView *view, NSArray *entries, Ng
43
65
  [holder addSubview:button];
44
66
  return button;
45
67
  }
68
+
69
+ BOOL NgNativeOpenPressMenu(NgNativePressMenuButton *button)
70
+ {
71
+ if (button == nil || button.showing) {
72
+ return NO;
73
+ }
74
+ if (@available(iOS 17.4, *)) {
75
+ [button performPrimaryAction];
76
+ return YES;
77
+ }
78
+ return NO;
79
+ }
@@ -36,6 +36,11 @@ typedef void (^NgNativeViewDetach)(UIView *view, id token);
36
36
  // answers its own, so a caller can tell the binding it started with from a later one of the same
37
37
  // name. Main thread.
38
38
  - (nullable id)tokenFor:(NSString *)nativeID;
39
+ // What attaching the view bound to `nativeID` answered, looking for that view now if it has not
40
+ // been found, however long the binder would otherwise wait: for a view the user has just touched,
41
+ // which is mounted and in a window. Nil when `nativeID` is not bound, or no view has it. Main
42
+ // thread.
43
+ - (nullable id)tokenFindingNow:(NSString *)nativeID;
39
44
  // Detach every view. Main thread.
40
45
  - (void)unbindAll;
41
46
  // Check each view still is the one with its `nativeID`, and look for the ones not found yet. Main