@ng-native/components 0.27.0 → 0.29.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/android/src/main/java/dev/ngnative/components/ColorSchemeModule.kt +116 -11
- package/android/src/main/java/dev/ngnative/components/ContextMenuPopup.kt +61 -19
- package/android/src/main/java/dev/ngnative/components/MenusModule.kt +22 -0
- package/android/src/main/java/dev/ngnative/components/Shortcut.kt +13 -4
- package/dist/context-menu.d.ts +14 -6
- package/dist/context-menu.js +30 -28
- package/dist/context-menu.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/menu.d.ts +17 -8
- package/dist/menu.js +22 -36
- package/dist/menu.js.map +1 -1
- package/dist/modal.d.ts +6 -2
- package/dist/modal.js.map +1 -1
- package/dist/native-button.d.ts +31 -2
- package/dist/native-button.js +104 -6
- package/dist/native-button.js.map +1 -1
- package/dist/press-menu.d.ts +60 -0
- package/dist/press-menu.js +116 -0
- package/dist/press-menu.js.map +1 -0
- package/dist/pressable.d.ts +3 -0
- package/dist/pressable.js +7 -1
- package/dist/pressable.js.map +1 -1
- package/dist/reanimated.js +27 -3
- package/dist/reanimated.js.map +1 -1
- package/dist/scroll-view.d.ts +3 -1
- package/dist/scroll-view.js +7 -2
- package/dist/scroll-view.js.map +1 -1
- package/dist/settled-updates.d.ts +55 -0
- package/dist/settled-updates.js +77 -0
- package/dist/settled-updates.js.map +1 -0
- package/dist/sidebar-item.d.ts +18 -3
- package/dist/sidebar-item.js +29 -3
- package/dist/sidebar-item.js.map +1 -1
- package/dist/sidebar.js +4 -3
- package/dist/sidebar.js.map +1 -1
- package/dist/split-view.d.ts +23 -2
- package/dist/split-view.js +32 -5
- package/dist/split-view.js.map +1 -1
- package/dist/stand-ins/reanimated.d.ts +5 -0
- package/dist/stand-ins/reanimated.js +7 -0
- package/dist/stand-ins/reanimated.js.map +1 -1
- package/dist/sticky-headers.d.ts +19 -0
- package/dist/sticky-headers.js +67 -10
- package/dist/sticky-headers.js.map +1 -1
- package/dist/sticky-rows.d.ts +123 -26
- package/dist/sticky-rows.js +285 -71
- package/dist/sticky-rows.js.map +1 -1
- package/dist/svg-icon.d.ts +23 -0
- package/dist/svg-icon.js +53 -0
- package/dist/svg-icon.js.map +1 -0
- package/dist/tray-icon.d.ts +7 -1
- package/dist/tray-icon.js +15 -3
- package/dist/tray-icon.js.map +1 -1
- package/dist/virtual-list-sticky-level.d.ts +33 -0
- package/dist/virtual-list-sticky-level.js +58 -0
- package/dist/virtual-list-sticky-level.js.map +1 -0
- package/dist/virtual-list-sticky.d.ts +19 -0
- package/dist/virtual-list-sticky.js +13 -0
- package/dist/virtual-list-sticky.js.map +1 -0
- package/dist/virtual-list.d.ts +29 -7
- package/dist/virtual-list.js +127 -59
- package/dist/virtual-list.js.map +1 -1
- package/dist/worklet-style.d.ts +11 -0
- package/dist/worklet-style.js +15 -1
- package/dist/worklet-style.js.map +1 -1
- package/dist/worklets.d.ts +5 -1
- package/dist/worklets.js.map +1 -1
- package/dist/written-props.js +3 -0
- package/dist/written-props.js.map +1 -1
- package/ios/NgNativeButtonComponentView.mm +8 -4
- package/ios/NgNativeButtonMetrics.h +9 -2
- package/ios/NgNativeButtonMetrics.mm +33 -4
- package/ios/NgNativeButtonShadowNode.h +2 -0
- package/ios/NgNativeButtonShadowNode.mm +5 -1
- package/ios/NgNativeMenus.mm +42 -2
- package/ios/NgNativePressMenu.h +28 -0
- package/ios/NgNativePressMenu.mm +45 -0
- package/package.json +3 -3
package/dist/worklet-style.d.ts
CHANGED
|
@@ -7,7 +7,18 @@ export declare class WorkletStyleBase {
|
|
|
7
7
|
private readonly worklets;
|
|
8
8
|
private readonly injector;
|
|
9
9
|
readonly workletStyle: import("@angular/core").InputSignal<WorkletStyleSpec>;
|
|
10
|
+
/**
|
|
11
|
+
* What the UI thread has drawn the node with and let go of, from every style bound so far: a
|
|
12
|
+
* replaced style leaves what the one before drew, as Reanimated leaves it on the view.
|
|
13
|
+
*/
|
|
14
|
+
private drawn;
|
|
10
15
|
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Commit what the UI thread settled on with the node, which is what lets Reanimated stop
|
|
18
|
+
* applying the view to every commit. The commit is the next one the engine makes, for every view
|
|
19
|
+
* that settled together.
|
|
20
|
+
*/
|
|
21
|
+
private keepDrawn;
|
|
11
22
|
static ɵfac: i0.ɵɵFactoryDeclaration<WorkletStyleBase, never>;
|
|
12
23
|
static ɵdir: i0.ɵɵDirectiveDeclaration<WorkletStyleBase, "[workletStyle]", never, { "workletStyle": { "alias": "workletStyle"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
13
24
|
}
|
package/dist/worklet-style.js
CHANGED
|
@@ -23,6 +23,11 @@ export class WorkletStyleBase {
|
|
|
23
23
|
injector = inject(Injector);
|
|
24
24
|
workletStyle = input.required(/* @ts-ignore */
|
|
25
25
|
...(ngDevMode ? [{ debugName: "workletStyle" }] : /* istanbul ignore next */ []));
|
|
26
|
+
/**
|
|
27
|
+
* What the UI thread has drawn the node with and let go of, from every style bound so far: a
|
|
28
|
+
* replaced style leaves what the one before drew, as Reanimated leaves it on the view.
|
|
29
|
+
*/
|
|
30
|
+
drawn = {};
|
|
26
31
|
constructor() {
|
|
27
32
|
// A node has neither a react tag nor a shadow node until it has been committed once, and
|
|
28
33
|
// there is nothing for the UI thread to write to before then.
|
|
@@ -33,10 +38,19 @@ export class WorkletStyleBase {
|
|
|
33
38
|
const shadowNode = this.engine.shadowNodeOf(this.node);
|
|
34
39
|
if (tag === null || shadowNode === null)
|
|
35
40
|
return;
|
|
36
|
-
onCleanup(this.worklets.bind({ tag, shadowNode }, style));
|
|
41
|
+
onCleanup(this.worklets.bind({ tag, shadowNode }, style, (props) => this.keepDrawn(props)));
|
|
37
42
|
}, { injector: this.injector });
|
|
38
43
|
});
|
|
39
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Commit what the UI thread settled on with the node, which is what lets Reanimated stop
|
|
47
|
+
* applying the view to every commit. The commit is the next one the engine makes, for every view
|
|
48
|
+
* that settled together.
|
|
49
|
+
*/
|
|
50
|
+
keepDrawn(props) {
|
|
51
|
+
this.drawn = { ...this.drawn, ...props };
|
|
52
|
+
this.engine.setUiThreadProps(this.node, this.drawn);
|
|
53
|
+
}
|
|
40
54
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: WorkletStyleBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
41
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 });
|
|
42
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worklet-style.js","sourceRoot":"","sources":["../src/worklet-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,eAAe,EACf,MAAM,EACN,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAyB,MAAM,eAAe,CAAC;;AAEhE,2FAA2F;AAE3F,MAAM,OAAO,gBAAgB;IACV,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,aAA2B,CAAC;IACtD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5B,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEpC,YAAY,GAAG,KAAK,CAAC,QAAQ;qFAAoB,CAAC;IAE3D;QACE,yFAAyF;QACzF,8DAA8D;QAC9D,eAA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GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACvD,IAAI,GAAG,KAAK,IAAI,IAAI,UAAU,KAAK,IAAI;oBAAE,OAAO;gBAChD,SAAS,CACP,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CACjF,CAAC;YACJ,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACK,SAAS,CAAC,KAAwC;QACxD,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;uGAzCU,gBAAgB;2FAAhB,gBAAgB;;2FAAhB,gBAAgB;kBAD5B,SAAS;mBAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE","sourcesContent":["/**\n * A style computed on the UI thread, by a Reanimated worklet.\n *\n * The difference from `AnimatedStyle` is where the work happens. An animated style advances in\n * JavaScript unless the native driver can take the whole animation over, and the native driver\n * only understands the animations React Native itself can express. A worklet is arbitrary code\n * running on a second JavaScript runtime that lives on the UI thread, so anything computable per\n * frame - a gesture following a finger, a value derived from three others - keeps its frame rate\n * with the JavaScript thread busy.\n *\n * `WorkletStyle` in `../reanimated.ts` is the one apps import: same selector, and it supplies the\n * real runtime itself.\n */\nimport {\n Directive,\n ElementRef,\n Injector,\n afterNextRender,\n effect,\n inject,\n input,\n} from '@angular/core';\nimport { Engine, type EngineNode } from '@ng-native/fabric';\nimport { WORKLETS, type WorkletStyleSpec } from './worklets.ts';\n\n/** The behaviour, with the runtime left as a dependency so a test can drive a fake one. */\n@Directive({ selector: '[workletStyle]' })\nexport class WorkletStyleBase {\n private readonly node = inject(ElementRef).nativeElement as EngineNode;\n private readonly engine = inject(Engine);\n private readonly worklets = inject(WORKLETS);\n private readonly injector = inject(Injector);\n\n readonly workletStyle = input.required<WorkletStyleSpec>();\n\n /**\n * What the UI thread has drawn the node with and let go of, from every style bound so far: a\n * replaced style leaves what the one before drew, as Reanimated leaves it on the view.\n */\n private drawn: Readonly<Record<string, unknown>> = {};\n\n constructor() {\n // A node has neither a react tag nor a shadow node until it has been committed once, and\n // there is nothing for the UI thread to write to before then.\n afterNextRender(() => {\n effect(\n (onCleanup) => {\n const style = this.workletStyle();\n const tag = this.engine.tagOf(this.node);\n const shadowNode = this.engine.shadowNodeOf(this.node);\n if (tag === null || shadowNode === null) return;\n onCleanup(\n this.worklets.bind({ tag, shadowNode }, style, (props) => this.keepDrawn(props)),\n );\n },\n { injector: this.injector },\n );\n });\n }\n\n /**\n * Commit what the UI thread settled on with the node, which is what lets Reanimated stop\n * applying the view to every commit. The commit is the next one the engine makes, for every view\n * that settled together.\n */\n private keepDrawn(props: Readonly<Record<string, unknown>>): void {\n this.drawn = { ...this.drawn, ...props };\n this.engine.setUiThreadProps(this.node, this.drawn);\n }\n}\n"]}
|
package/dist/worklets.d.ts
CHANGED
|
@@ -89,8 +89,12 @@ export interface WorkletBackend {
|
|
|
89
89
|
/**
|
|
90
90
|
* Run `style.updater` on the UI runtime whenever one of its values changes, writing what it
|
|
91
91
|
* returns onto `target`. Returns the function that stops it.
|
|
92
|
+
*
|
|
93
|
+
* `settled` is handed the props the UI thread has drawn `target` with once they stop changing,
|
|
94
|
+
* as React Native styles them, for the view's commits to carry: Reanimated lets the view go
|
|
95
|
+
* once they do. Every prop it has drawn the view with, from this style and any before it.
|
|
92
96
|
*/
|
|
93
|
-
bind(target: WorkletTarget, style: WorkletStyleSpec): () => void;
|
|
97
|
+
bind(target: WorkletTarget, style: WorkletStyleSpec, settled: (props: Readonly<Record<string, unknown>>) => void): () => void;
|
|
94
98
|
/**
|
|
95
99
|
* Run `spec.handler` on the UI runtime for every scroll event `target` emits. Returns the
|
|
96
100
|
* function that stops it.
|
package/dist/worklets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worklets.js","sourceRoot":"","sources":["../src/worklets.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAwC/C;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAS,EACT,OAAkD;IAElD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AAcD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAS,EACT,OAAqD;IAErD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"worklets.js","sourceRoot":"","sources":["../src/worklets.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAwC/C;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAS,EACT,OAAkD;IAElD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AAcD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAS,EACT,OAAqD;IAErD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AA8BD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAiB,yBAAyB,CAAC,CAAC","sourcesContent":["/**\n * Platform capability: Reanimated's worklets, and the UI-thread runtime they run on.\n *\n * Injected rather than imported for the same reason the animation graph is: `react-native-worklets`\n * reaches React Native's Flow source, which Node cannot parse, and the components package has to\n * stay loadable in the test suite. `WorkletStyle` in `../reanimated.ts` carries the real backend\n * as its own provider, so importing the directive is the whole setup, and a test provides a fake\n * runtime instead of needing a device.\n */\nimport { InjectionToken } from '@angular/core';\nimport type { ScrollPayload } from './events.ts';\n\n/** A Reanimated shared value. During an animation only the UI runtime reads one. */\nexport interface SharedValue<T = number> {\n value: T;\n}\n\n/**\n * Reanimated's public `SharedValue` surface, which code outside a worklet reads and writes. Written\n * out rather than imported, so that a type naming one resolves where Reanimated is not installed.\n */\nexport interface MutableValue<T> extends SharedValue<T> {\n get(): T;\n set(value: T | ((value: T) => T)): void;\n modify(modifier?: (value: T) => T, forceUpdate?: boolean): void;\n addListener(id: number, listener: (value: T) => void): void;\n removeListener(id: number): void;\n}\n\n/**\n * A style, and the shared values it is computed from.\n *\n * The values are arguments to the worklet rather than things it captures, and that is the whole\n * reason this is a function of its inputs. A worklet captures its free variables by value when it\n * is created, so one written inside a component that reads `this.x` would capture the component -\n * every signal, the injector, the view - and try to serialise all of it onto the other runtime.\n * Taking the values as arguments makes that impossible to write by accident, and makes the\n * dependency list the thing the UI runtime is subscribed to rather than a guess.\n */\nexport interface WorkletStyleSpec {\n readonly values: readonly unknown[];\n /**\n * Called with `values`. Declared as a method rather than a property so that a spec built from\n * a known tuple of shared values is still a `WorkletStyleSpec`: the parameter types are checked\n * in the factory below, against the values it was handed, and widen on the way in.\n */\n updater(...values: readonly unknown[]): Record<string, unknown>;\n}\n\n/**\n * Bind a style to the shared values it reads.\n *\n * ```ts\n * protected readonly slide = workletStyle([this.offset], (offset) => {\n * 'worklet';\n * return { transform: [{ translateX: offset.value }] };\n * });\n * ```\n */\nexport function workletStyle<const T extends readonly SharedValue<unknown>[]>(\n values: T,\n updater: (...values: T) => Record<string, unknown>,\n): WorkletStyleSpec {\n return { values, updater };\n}\n\n/** A worklet run on every scroll frame, and the shared values it is given. */\nexport interface WorkletScrollSpec {\n readonly values: readonly unknown[];\n /**\n * Called on the UI runtime with the event and `values`. See `WorkletStyleSpec.updater`.\n *\n * The payload rather than the wrapped event a listener gets: Reanimated hands a worklet what\n * native put in the event, with no `nativeEvent` around it.\n */\n handler(event: ScrollPayload, ...values: readonly unknown[]): void;\n}\n\n/**\n * Bind a worklet to a scroll view's scrolling.\n *\n * ```ts\n * protected readonly parallax = workletScroll([this.offset], (event, offset) => {\n * 'worklet';\n * offset.value = event.contentOffset.y;\n * });\n * ```\n *\n * The point of it is where it runs: native delivers the scroll to the UI runtime, the worklet\n * writes a shared value there, and a `[workletStyle]` reads it there - so a header that shrinks\n * with the scroll never involves the JavaScript thread at all, and cannot fall behind it.\n */\nexport function workletScroll<const T extends readonly SharedValue<unknown>[]>(\n values: T,\n handler: (event: ScrollPayload, ...values: T) => void,\n): WorkletScrollSpec {\n return { values, handler };\n}\n\n/** What the UI runtime writes to: a node's react tag and the shadow node behind it. */\nexport interface WorkletTarget {\n readonly tag: number;\n readonly shadowNode: unknown;\n}\n\nexport interface WorkletBackend {\n /**\n * Run `style.updater` on the UI runtime whenever one of its values changes, writing what it\n * returns onto `target`. Returns the function that stops it.\n *\n * `settled` is handed the props the UI thread has drawn `target` with once they stop changing,\n * as React Native styles them, for the view's commits to carry: Reanimated lets the view go\n * once they do. Every prop it has drawn the view with, from this style and any before it.\n */\n bind(\n target: WorkletTarget,\n style: WorkletStyleSpec,\n settled: (props: Readonly<Record<string, unknown>>) => void,\n ): () => void;\n\n /**\n * Run `spec.handler` on the UI runtime for every scroll event `target` emits. Returns the\n * function that stops it.\n */\n scroll(target: WorkletTarget, spec: WorkletScrollSpec): () => void;\n}\n\nexport const WORKLETS = new InjectionToken<WorkletBackend>('angular-native.worklets');\n"]}
|
package/dist/written-props.js
CHANGED
|
@@ -65,6 +65,7 @@ export const WRITTEN_PROPS = [
|
|
|
65
65
|
'contentInset',
|
|
66
66
|
'contentInsetAdjustmentBehavior',
|
|
67
67
|
'contentOffset',
|
|
68
|
+
'contentStyle',
|
|
68
69
|
'contextMenu',
|
|
69
70
|
'contextMenuHidden',
|
|
70
71
|
'controlSize',
|
|
@@ -95,6 +96,7 @@ export const WRITTEN_PROPS = [
|
|
|
95
96
|
'hidesWhenStopped',
|
|
96
97
|
'hitSlop',
|
|
97
98
|
'horizontal',
|
|
99
|
+
'iconImage',
|
|
98
100
|
'importantForAutofill',
|
|
99
101
|
'indeterminate',
|
|
100
102
|
'indicatorStyle',
|
|
@@ -183,6 +185,7 @@ export const WRITTEN_PROPS = [
|
|
|
183
185
|
'styleAttr',
|
|
184
186
|
'submitBehavior',
|
|
185
187
|
'supportedOrientations',
|
|
188
|
+
'svgIcon',
|
|
186
189
|
'testID',
|
|
187
190
|
'text',
|
|
188
191
|
'textAlign',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"written-props.js","sourceRoot":"","sources":["../src/written-props.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,sBAAsB;IACtB,0BAA0B;IAC1B,0BAA0B;IAC1B,6BAA6B;IAC7B,mBAAmB;IACnB,kCAAkC;IAClC,sBAAsB;IACtB,oBAAoB;IACpB,yBAAyB;IACzB,uBAAuB;IACvB,gCAAgC;IAChC,oBAAoB;IACpB,yBAAyB;IACzB,uBAAuB;IACvB,uBAAuB;IACvB,wCAAwC;IACxC,mBAAmB;IACnB,uBAAuB;IACvB,sBAAsB;IACtB,sCAAsC;IACtC,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAC1B,YAAY;IACZ,sBAAsB;IACtB,kBAAkB;IAClB,qBAAqB;IACrB,QAAQ;IACR,wBAAwB;IACxB,sBAAsB;IACtB,8BAA8B;IAC9B,WAAW;IACX,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,WAAW;IACX,kCAAkC;IAClC,mCAAmC;IACnC,2CAA2C;IAC3C,cAAc;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AY;IACZ,uBAAuB;IACvB,gCAAgC;IAChC,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,eAAe;IACf,MAAM;IACN,MAAM;IACN,eAAe;IACf,qBAAqB;IACrB,uBAAuB;IACvB,yBAAyB;IACzB,cAAc;IACd,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,oBAAoB;IACpB,UAAU;IACV,oBAAoB;IACpB,sBAAsB;IACtB,gCAAgC;IAChC,8BAA8B;IAC9B,MAAM;IACN,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,sBAAsB;IACtB,WAAW;IACX,gBAAgB;IAChB,uBAAuB;IACvB,QAAQ;IACR,MAAM;IACN,WAAW;IACX,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,OAAO;IACP,YAAY;IACZ,oBAAoB;IACpB,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,uBAAuB;IACvB,OAAO;IACP,SAAS;IACT,QAAQ;IACR,WAAW;CACZ,CAAC","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 '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 '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 '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":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,sBAAsB;IACtB,0BAA0B;IAC1B,0BAA0B;IAC1B,6BAA6B;IAC7B,mBAAmB;IACnB,kCAAkC;IAClC,sBAAsB;IACtB,oBAAoB;IACpB,yBAAyB;IACzB,uBAAuB;IACvB,gCAAgC;IAChC,oBAAoB;IACpB,yBAAyB;IACzB,uBAAuB;IACvB,uBAAuB;IACvB,wCAAwC;IACxC,mBAAmB;IACnB,uBAAuB;IACvB,sBAAsB;IACtB,sCAAsC;IACtC,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAC1B,YAAY;IACZ,sBAAsB;IACtB,kBAAkB;IAClB,qBAAqB;IACrB,QAAQ;IACR,wBAAwB;IACxB,sBAAsB;IACtB,8BAA8B;IAC9B,WAAW;IACX,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,WAAW;IACX,kCAAkC;IAClC,mCAAmC;IACnC,2CAA2C;IAC3C,cAAc;IACd,iBAAiB;IACjB,OAAO;IACP,YAAY;IACZ,SAAS;IACT,aAAa;IACb,yBAAyB;IACzB,WAAW;IACX,aAAa;IACb,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,aAAa;IACb,qBAAqB;IACrB,WAAW;IACX,aAAa;IACb,OAAO;IACP,QAAQ;IACR,cAAc;IACd,gCAAgC;IAChC,eAAe;IACf,cAAc;IACd,aAAa;IACb,mBAAmB;IACnB,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,wBAAwB;IACxB,qBAAqB;IACrB,yBAAyB;IACzB,UAAU;IACV,UAAU;IACV,UAAU;IACV,iBAAiB;IACjB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eAAe;IACf,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,sBAAsB;IACtB,WAAW;IACX,gBAAgB;IAChB,uBAAuB;IACvB,SAAS;IACT,QAAQ;IACR,MAAM;IACN,WAAW;IACX,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,OAAO;IACP,YAAY;IACZ,oBAAoB;IACpB,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,uBAAuB;IACvB,OAAO;IACP,SAAS;IACT,QAAQ;IACR,WAAW;CACZ,CAAC","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"]}
|
|
@@ -11,8 +11,10 @@ using namespace facebook::react;
|
|
|
11
11
|
`<native-button>` on iOS: a UIButton drawn from a button configuration, the glass ones on iOS 26
|
|
12
12
|
and later. `kind` picks the style (`default` the prominent one, `destructive` in red, `plain`
|
|
13
13
|
borderless, anything else the plain push button), `controlSize` UIButton's own size with the
|
|
14
|
-
metrics the shadow node measures with, and a tap sends `topButtonPress`. The
|
|
15
|
-
|
|
14
|
+
metrics the shadow node measures with, and a tap sends `topButtonPress`. The picture before the
|
|
15
|
+
title is the SF Symbol, or else `iconImage`, an icon's SVG markup drawn as a PNG, tinted as the
|
|
16
|
+
title is. The title follows the user's text size: the button is configured again as it changes,
|
|
17
|
+
and React Native measures it again.
|
|
16
18
|
Return and Escape press no button on iOS: `default` and `cancel` are only styles there.
|
|
17
19
|
*/
|
|
18
20
|
@interface NgNativeButtonComponentView : RCTViewComponentView
|
|
@@ -78,7 +80,8 @@ static UIButtonConfiguration *configurationForKind(NSString *kind)
|
|
|
78
80
|
const auto &newProps = static_cast<const NgNativeButtonProps &>(*props);
|
|
79
81
|
const auto &previous = static_cast<const NgNativeButtonProps &>(*_props);
|
|
80
82
|
BOOL changed = newProps.title != previous.title || newProps.kind != previous.kind ||
|
|
81
|
-
newProps.controlSize != previous.controlSize || newProps.sfSymbol != previous.sfSymbol
|
|
83
|
+
newProps.controlSize != previous.controlSize || newProps.sfSymbol != previous.sfSymbol ||
|
|
84
|
+
newProps.iconImage != previous.iconImage;
|
|
82
85
|
[super updateProps:props oldProps:oldProps];
|
|
83
86
|
if (changed) {
|
|
84
87
|
[self ngn_configureWith:newProps];
|
|
@@ -95,7 +98,8 @@ static UIButtonConfiguration *configurationForKind(NSString *kind)
|
|
|
95
98
|
configuration.contentInsets = NgNativeButtonInsets(controlSize);
|
|
96
99
|
configuration.title = string(props.title);
|
|
97
100
|
configuration.titleLineBreakMode = NSLineBreakByTruncatingTail;
|
|
98
|
-
configuration.image = NgNativeButtonSymbol(string(props.sfSymbol), controlSize)
|
|
101
|
+
configuration.image = NgNativeButtonSymbol(string(props.sfSymbol), controlSize)
|
|
102
|
+
?: NgNativeButtonImage(string(props.iconImage), controlSize);
|
|
99
103
|
configuration.imagePadding = NgNativeButtonImagePadding;
|
|
100
104
|
UIFont *font = NgNativeButtonFont(controlSize);
|
|
101
105
|
configuration.titleTextAttributesTransformer = ^NSDictionary<NSAttributedStringKey, id> *(
|
|
@@ -22,7 +22,14 @@ extern const CGFloat NgNativeButtonImagePadding;
|
|
|
22
22
|
// The symbol drawn beside the title, or nil for none or a name the OS lacks.
|
|
23
23
|
UIImage *_Nullable NgNativeButtonSymbol(NSString *sfSymbol, NSString *controlSize);
|
|
24
24
|
|
|
25
|
-
// The
|
|
26
|
-
|
|
25
|
+
// The side of an icon image drawn beside the title, in points: a symbol's height in the title's font.
|
|
26
|
+
CGFloat NgNativeButtonImageSide(NSString *controlSize);
|
|
27
|
+
|
|
28
|
+
// An icon image from a PNG `data:` URI, a template image `NgNativeButtonImageSide` square that the
|
|
29
|
+
// button tints as it does a symbol, or nil for none or data that is no image.
|
|
30
|
+
UIImage *_Nullable NgNativeButtonImage(NSString *uri, NSString *controlSize);
|
|
31
|
+
|
|
32
|
+
// The button's natural size: one line of title, the symbol or else an icon image, and the insets.
|
|
33
|
+
CGSize NgNativeButtonNaturalSize(NSString *title, NSString *controlSize, NSString *sfSymbol, BOOL hasImage);
|
|
27
34
|
|
|
28
35
|
NS_ASSUME_NONNULL_END
|
|
@@ -52,16 +52,45 @@ UIImage *_Nullable NgNativeButtonSymbol(NSString *sfSymbol, NSString *controlSiz
|
|
|
52
52
|
return [UIImage systemImageNamed:sfSymbol withConfiguration:configuration];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
CGFloat NgNativeButtonImageSide(NSString *controlSize)
|
|
56
|
+
{
|
|
57
|
+
return round(NgNativeButtonFont(controlSize).pointSize * 1.2);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
UIImage *_Nullable NgNativeButtonImage(NSString *uri, NSString *controlSize)
|
|
61
|
+
{
|
|
62
|
+
NSRange comma = [uri rangeOfString:@";base64,"];
|
|
63
|
+
if (![uri hasPrefix:@"data:"] || comma.location == NSNotFound) {
|
|
64
|
+
return nil;
|
|
65
|
+
}
|
|
66
|
+
NSData *data = [[NSData alloc] initWithBase64EncodedString:[uri substringFromIndex:NSMaxRange(comma)]
|
|
67
|
+
options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
|
68
|
+
UIImage *decoded = data != nil ? [UIImage imageWithData:data] : nil;
|
|
69
|
+
CGImageRef pixels = decoded.CGImage;
|
|
70
|
+
if (pixels == NULL) {
|
|
71
|
+
return nil;
|
|
72
|
+
}
|
|
73
|
+
// Its pixels to a point chosen so that it is the side square, whatever size it was drawn at.
|
|
74
|
+
CGFloat longest = MAX(CGImageGetWidth(pixels), CGImageGetHeight(pixels));
|
|
75
|
+
UIImage *sized = [UIImage imageWithCGImage:pixels
|
|
76
|
+
scale:longest / NgNativeButtonImageSide(controlSize)
|
|
77
|
+
orientation:UIImageOrientationUp];
|
|
78
|
+
return [sized imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
CGSize NgNativeButtonNaturalSize(NSString *title, NSString *controlSize, NSString *sfSymbol, BOOL hasImage)
|
|
56
82
|
{
|
|
57
83
|
UIFont *font = NgNativeButtonFont(controlSize);
|
|
58
84
|
CGSize text = title.length > 0 ? [title sizeWithAttributes:@{NSFontAttributeName : font}] : CGSizeZero;
|
|
59
85
|
CGFloat width = ceil(text.width);
|
|
60
86
|
CGFloat height = ceil(MAX(text.height, font.lineHeight));
|
|
61
87
|
UIImage *symbol = NgNativeButtonSymbol(sfSymbol, controlSize);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
CGSize picture = symbol != nil ? symbol.size
|
|
89
|
+
: hasImage ? CGSizeMake(NgNativeButtonImageSide(controlSize), NgNativeButtonImageSide(controlSize))
|
|
90
|
+
: CGSizeZero;
|
|
91
|
+
if (picture.width > 0) {
|
|
92
|
+
width += ceil(picture.width) + (title.length > 0 ? NgNativeButtonImagePadding : 0);
|
|
93
|
+
height = MAX(height, ceil(picture.height));
|
|
65
94
|
}
|
|
66
95
|
NSDirectionalEdgeInsets insets = NgNativeButtonInsets(controlSize);
|
|
67
96
|
return CGSizeMake(width + insets.leading + insets.trailing, height + insets.top + insets.bottom);
|
|
@@ -30,6 +30,8 @@ class NgNativeButtonProps final : public ViewProps {
|
|
|
30
30
|
// `mini`, `small`, `regular` or `large`; empty is `regular`.
|
|
31
31
|
std::string controlSize{};
|
|
32
32
|
std::string sfSymbol{};
|
|
33
|
+
// An icon's SVG markup drawn as a PNG, as a `data:` URI, which a symbol wins over.
|
|
34
|
+
std::string iconImage{};
|
|
33
35
|
bool enabled{true};
|
|
34
36
|
};
|
|
35
37
|
|
|
@@ -18,6 +18,7 @@ NgNativeButtonProps::NgNativeButtonProps(
|
|
|
18
18
|
kind(convertRawProp(context, rawProps, "kind", sourceProps.kind, {})),
|
|
19
19
|
controlSize(convertRawProp(context, rawProps, "controlSize", sourceProps.controlSize, {})),
|
|
20
20
|
sfSymbol(convertRawProp(context, rawProps, "sfSymbol", sourceProps.sfSymbol, {})),
|
|
21
|
+
iconImage(convertRawProp(context, rawProps, "iconImage", sourceProps.iconImage, {})),
|
|
21
22
|
enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, true))
|
|
22
23
|
{
|
|
23
24
|
}
|
|
@@ -32,7 +33,10 @@ Size NgNativeButtonShadowNode::measureContent(
|
|
|
32
33
|
const LayoutConstraints &layoutConstraints) const
|
|
33
34
|
{
|
|
34
35
|
const auto &props = getConcreteProps();
|
|
35
|
-
|
|
36
|
+
NSString *controlSize = string(props.controlSize);
|
|
37
|
+
// Room is kept for an image only when the button can decode it, as NgNativeButtonComponentView does.
|
|
38
|
+
BOOL hasImage = !props.iconImage.empty() && NgNativeButtonImage(string(props.iconImage), controlSize) != nil;
|
|
39
|
+
CGSize size = NgNativeButtonNaturalSize(string(props.title), controlSize, string(props.sfSymbol), hasImage);
|
|
36
40
|
// A narrower box truncates the title rather than wrapping it.
|
|
37
41
|
return layoutConstraints.clamp({.width = (Float)size.width, .height = (Float)size.height});
|
|
38
42
|
}
|
package/ios/NgNativeMenus.mm
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#import <UIKit/UIKit.h>
|
|
4
4
|
|
|
5
5
|
#import "NgNativeMenuBuilding.h"
|
|
6
|
+
#import "NgNativePressMenu.h"
|
|
6
7
|
#import "NgNativeResponderHooks.h"
|
|
7
8
|
#import "NgNativeViewBinder.h"
|
|
8
9
|
|
|
@@ -21,9 +22,14 @@
|
|
|
21
22
|
that `nativeID`, added once the view is mounted, its menu read as it opens, and removed with
|
|
22
23
|
null, or as the view is unmounted, recycled or renamed. A long press opens it, and a secondary
|
|
23
24
|
click from an iPad pointer.
|
|
25
|
+
- `setPressMenu(nativeID, entries)`: a menu a press opens on React Native's view with that
|
|
26
|
+
`nativeID`, as a clear button over the view (NgNativePressMenu.h), added once the view is
|
|
27
|
+
mounted, its menu made again as the entries change, and removed with null, or as the view is
|
|
28
|
+
unmounted, recycled or renamed.
|
|
24
29
|
- Events on `ngNativeMenus`: `menuSelect` for a menu bar item, `shortcut` with
|
|
25
|
-
`textInputFocused`, `navigate` for the Back and Forward roles, and `contextMenuSelect`
|
|
26
|
-
view's `nativeID` and the item's `id`, since React Native's view sends
|
|
30
|
+
`textInputFocused`, `navigate` for the Back and Forward roles, and `contextMenuSelect` and
|
|
31
|
+
`pressMenuSelect` with the view's `nativeID` and the item's `id`, since React Native's view sends
|
|
32
|
+
no event it does not know.
|
|
27
33
|
- `menuBar` is true on an iPad and false on an iPhone; `appName` is the bundle's display name.
|
|
28
34
|
*/
|
|
29
35
|
@interface NgNativeMenus : NSObject <RCTBridgeModule, RCTInvalidating, NgNativeMenusHost>
|
|
@@ -106,6 +112,8 @@ static UIMenuIdentifier standardMenu(NSString *role)
|
|
|
106
112
|
NSArray<UIKeyCommand *> *_shortcuts;
|
|
107
113
|
NSMutableDictionary<NSString *, NSArray *> *_contextMenus;
|
|
108
114
|
NgNativeViewBinder *_contextMenuViews;
|
|
115
|
+
NSMutableDictionary<NSString *, NSArray *> *_pressMenus;
|
|
116
|
+
NgNativeViewBinder *_pressMenuViews;
|
|
109
117
|
// The views inside a context menu's that take a long press themselves, by `nativeID`.
|
|
110
118
|
NSMutableSet<NSString *> *_longPressTakers;
|
|
111
119
|
}
|
|
@@ -146,6 +154,21 @@ RCT_EXPORT_MODULE()
|
|
|
146
154
|
detach:^(UIView *view, NgNativeContextMenuTarget *target) {
|
|
147
155
|
[view removeInteraction:target.interaction];
|
|
148
156
|
}];
|
|
157
|
+
_pressMenus = [NSMutableDictionary dictionary];
|
|
158
|
+
_pressMenuViews = [[NgNativeViewBinder alloc]
|
|
159
|
+
initWithAttach:^id(UIView *view, NSString *nativeID) {
|
|
160
|
+
NgNativeMenus *module = weakSelf;
|
|
161
|
+
NSArray *entries = module == nil ? nil : module->_pressMenus[nativeID];
|
|
162
|
+
if (entries == nil) {
|
|
163
|
+
return nil;
|
|
164
|
+
}
|
|
165
|
+
return NgNativeAddPressMenu(view, entries, ^(NSString *itemId) {
|
|
166
|
+
[weakSelf send:@{@"type" : @"pressMenuSelect", @"nativeID" : nativeID, @"id" : itemId}];
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
detach:^(UIView *view, NgNativePressMenuButton *button) {
|
|
170
|
+
[button removeFromSuperview];
|
|
171
|
+
}];
|
|
149
172
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
150
173
|
NgNativeInstallResponderHooks();
|
|
151
174
|
NgNativeSetMenusHost(self);
|
|
@@ -161,6 +184,8 @@ RCT_EXPORT_MODULE()
|
|
|
161
184
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
162
185
|
[self->_contextMenuViews unbindAll];
|
|
163
186
|
[self->_contextMenus removeAllObjects];
|
|
187
|
+
[self->_pressMenuViews unbindAll];
|
|
188
|
+
[self->_pressMenus removeAllObjects];
|
|
164
189
|
[self->_longPressTakers removeAllObjects];
|
|
165
190
|
self->_menuBar = @[];
|
|
166
191
|
self->_shortcuts = @[];
|
|
@@ -223,6 +248,21 @@ RCT_EXPORT_METHOD(setContextMenu : (NSString *)nativeID entries : (nullable NSAr
|
|
|
223
248
|
}
|
|
224
249
|
}
|
|
225
250
|
|
|
251
|
+
RCT_EXPORT_METHOD(setPressMenu : (NSString *)nativeID entries : (nullable NSArray *)entries)
|
|
252
|
+
{
|
|
253
|
+
if (![nativeID isKindOfClass:[NSString class]] || nativeID.length == 0) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if ([entries isKindOfClass:[NSArray class]] && entries.count > 0) {
|
|
257
|
+
_pressMenus[nativeID] = entries;
|
|
258
|
+
((NgNativePressMenuButton *)[_pressMenuViews tokenFor:nativeID]).entries = entries;
|
|
259
|
+
[_pressMenuViews bind:nativeID];
|
|
260
|
+
} else {
|
|
261
|
+
[_pressMenus removeObjectForKey:nativeID];
|
|
262
|
+
[_pressMenuViews unbind:nativeID];
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
226
266
|
RCT_EXPORT_METHOD(setTakesLongPress : (NSString *)nativeID takes : (BOOL)takes)
|
|
227
267
|
{
|
|
228
268
|
if (![nativeID isKindOfClass:[NSString class]] || nativeID.length == 0) {
|
|
@@ -0,0 +1,28 @@
|
|
|
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.
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#import <UIKit/UIKit.h>
|
|
9
|
+
|
|
10
|
+
#import "NgNativeMenuBuilding.h"
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface NgNativePressMenuButton : UIButton
|
|
15
|
+
|
|
16
|
+
- (instancetype)initWithChoose:(NgNativeMenuChoose)choose;
|
|
17
|
+
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
|
|
18
|
+
- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
|
|
19
|
+
|
|
20
|
+
// The menu, as the app sends it; setting it makes the button's menu again.
|
|
21
|
+
@property (nonatomic, copy) NSArray *entries;
|
|
22
|
+
|
|
23
|
+
@end
|
|
24
|
+
|
|
25
|
+
// A press menu button with `entries` laid over `view`, whose choice runs `choose`.
|
|
26
|
+
NgNativePressMenuButton *NgNativeAddPressMenu(UIView *view, NSArray *entries, NgNativeMenuChoose choose);
|
|
27
|
+
|
|
28
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#import "NgNativePressMenu.h"
|
|
2
|
+
|
|
3
|
+
/** React Native's view holds its children in a view of its own while its style clips overflow ink. */
|
|
4
|
+
@interface UIView (NgNativeContainerView)
|
|
5
|
+
- (UIView *)currentContainerView;
|
|
6
|
+
@end
|
|
7
|
+
|
|
8
|
+
@implementation NgNativePressMenuButton {
|
|
9
|
+
NgNativeMenuChoose _choose;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
- (instancetype)initWithChoose:(NgNativeMenuChoose)choose
|
|
13
|
+
{
|
|
14
|
+
if (self = [super initWithFrame:CGRectZero]) {
|
|
15
|
+
_choose = [choose copy];
|
|
16
|
+
_entries = @[];
|
|
17
|
+
self.backgroundColor = UIColor.clearColor;
|
|
18
|
+
self.showsMenuAsPrimaryAction = YES;
|
|
19
|
+
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
|
+
self.isAccessibilityElement = NO;
|
|
23
|
+
}
|
|
24
|
+
return self;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
- (void)setEntries:(NSArray *)entries
|
|
28
|
+
{
|
|
29
|
+
_entries = [entries copy];
|
|
30
|
+
self.menu = [UIMenu menuWithTitle:@"" children:NgNativeMenuElements(_entries, _choose, NULL)];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
NgNativePressMenuButton *NgNativeAddPressMenu(UIView *view, NSArray *entries, NgNativeMenuChoose choose)
|
|
36
|
+
{
|
|
37
|
+
// React Native hit-tests only the children of the view that holds them, and moves every child
|
|
38
|
+
// with it as that view comes and goes, so the button stays in it, last.
|
|
39
|
+
UIView *holder = [view respondsToSelector:@selector(currentContainerView)] ? view.currentContainerView : view;
|
|
40
|
+
NgNativePressMenuButton *button = [[NgNativePressMenuButton alloc] initWithChoose:choose];
|
|
41
|
+
button.entries = entries;
|
|
42
|
+
button.frame = holder.bounds;
|
|
43
|
+
[holder addSubview:button];
|
|
44
|
+
return button;
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-native/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Angular Native's core components: view, text, image, pressable, scroll-view, virtual-list, text-input and the rest of React Native's set.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@ng-native/device": "0.
|
|
65
|
-
"@ng-native/fabric": "0.
|
|
64
|
+
"@ng-native/device": "0.29.0",
|
|
65
|
+
"@ng-native/fabric": "0.29.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@angular/core": "^22.0.0",
|