@symbiote-native/angular 0.6.2 → 0.8.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/README.md +3 -3
- package/bin/symbiote-angular-dev.cjs +20 -19
- package/build/angular/anchor-host-registry.js +2 -2
- package/build/angular/anchor-host-registry.js.map +1 -1
- package/build/angular/bootstrap.js +1 -1
- package/build/angular/bootstrap.js.map +1 -1
- package/build/angular/components/activity-indicator/index.android.d.ts +2 -1
- package/build/angular/components/activity-indicator/index.android.js +12 -4
- package/build/angular/components/activity-indicator/index.android.js.map +1 -1
- package/build/angular/components/activity-indicator/index.ios.d.ts +2 -1
- package/build/angular/components/activity-indicator/index.ios.js +8 -3
- package/build/angular/components/activity-indicator/index.ios.js.map +1 -1
- package/build/angular/components/activity-indicator/shared.d.ts +1 -1
- package/build/angular/components/activity-indicator/shared.js +4 -4
- package/build/angular/components/activity-indicator/shared.js.map +1 -1
- package/build/angular/components/button.d.ts +4 -2
- package/build/angular/components/button.js +41 -22
- package/build/angular/components/button.js.map +1 -1
- package/build/angular/components/flat-list/index.d.ts +6 -4
- package/build/angular/components/flat-list/index.js +80 -50
- package/build/angular/components/flat-list/index.js.map +1 -1
- package/build/angular/components/image/index.android.d.ts +8 -3
- package/build/angular/components/image/index.android.js +42 -10
- package/build/angular/components/image/index.android.js.map +1 -1
- package/build/angular/components/image/index.ios.d.ts +8 -3
- package/build/angular/components/image/index.ios.js +42 -10
- package/build/angular/components/image/index.ios.js.map +1 -1
- package/build/angular/components/image/shared.d.ts +4 -1
- package/build/angular/components/image/shared.js +51 -8
- package/build/angular/components/image/shared.js.map +1 -1
- package/build/angular/components/image-background.d.ts +2 -1
- package/build/angular/components/image-background.js +26 -10
- package/build/angular/components/image-background.js.map +1 -1
- package/build/angular/components/input-accessory-view/index.d.ts +9 -4
- package/build/angular/components/input-accessory-view/index.js +49 -10
- package/build/angular/components/input-accessory-view/index.js.map +1 -1
- package/build/angular/components/keyboard-avoiding-view/index.d.ts +3 -1
- package/build/angular/components/keyboard-avoiding-view/index.js +44 -12
- package/build/angular/components/keyboard-avoiding-view/index.js.map +1 -1
- package/build/angular/components/modal/index.d.ts +11 -8
- package/build/angular/components/modal/index.js +51 -29
- package/build/angular/components/modal/index.js.map +1 -1
- package/build/angular/components/pressable/index.d.ts +12 -6
- package/build/angular/components/pressable/index.js +66 -13
- package/build/angular/components/pressable/index.js.map +1 -1
- package/build/angular/components/refresh-control/index.d.ts +8 -4
- package/build/angular/components/refresh-control/index.js +54 -16
- package/build/angular/components/refresh-control/index.js.map +1 -1
- package/build/angular/components/safe-area-view/index.d.ts +9 -4
- package/build/angular/components/safe-area-view/index.js +48 -9
- package/build/angular/components/safe-area-view/index.js.map +1 -1
- package/build/angular/components/scroll-view/index.android.d.ts +2 -3
- package/build/angular/components/scroll-view/index.android.js +88 -61
- package/build/angular/components/scroll-view/index.android.js.map +1 -1
- package/build/angular/components/scroll-view/index.ios.d.ts +2 -3
- package/build/angular/components/scroll-view/index.ios.js +24 -18
- package/build/angular/components/scroll-view/index.ios.js.map +1 -1
- package/build/angular/components/scroll-view/projection.d.ts +35 -0
- package/build/angular/components/scroll-view/projection.js +279 -53
- package/build/angular/components/scroll-view/projection.js.map +1 -1
- package/build/angular/components/scroll-view/shared.d.ts +14 -5
- package/build/angular/components/scroll-view/shared.js +225 -75
- package/build/angular/components/scroll-view/shared.js.map +1 -1
- package/build/angular/components/scroll-view/sticky-header.js +21 -22
- package/build/angular/components/scroll-view/sticky-header.js.map +1 -1
- package/build/angular/components/section-list/index.d.ts +7 -1
- package/build/angular/components/section-list/index.js +91 -54
- package/build/angular/components/section-list/index.js.map +1 -1
- package/build/angular/components/switch/index.android.d.ts +7 -3
- package/build/angular/components/switch/index.android.js +52 -10
- package/build/angular/components/switch/index.android.js.map +1 -1
- package/build/angular/components/switch/index.ios.d.ts +7 -3
- package/build/angular/components/switch/index.ios.js +52 -10
- package/build/angular/components/switch/index.ios.js.map +1 -1
- package/build/angular/components/switch/shared.d.ts +13 -4
- package/build/angular/components/switch/shared.js +71 -7
- package/build/angular/components/switch/shared.js.map +1 -1
- package/build/angular/components/text-input.d.ts +11 -3
- package/build/angular/components/text-input.js +68 -8
- package/build/angular/components/text-input.js.map +1 -1
- package/build/angular/components/touchable/index.d.ts +40 -9
- package/build/angular/components/touchable/index.js +303 -67
- package/build/angular/components/touchable/index.js.map +1 -1
- package/build/angular/components/touchable-native-feedback/index.d.ts +6 -3
- package/build/angular/components/touchable-native-feedback/index.js +63 -27
- package/build/angular/components/touchable-native-feedback/index.js.map +1 -1
- package/build/angular/components/virtualized-list/directives.js +22 -18
- package/build/angular/components/virtualized-list/directives.js.map +1 -1
- package/build/angular/components/virtualized-list/index.d.ts +15 -4
- package/build/angular/components/virtualized-list/index.js +326 -94
- package/build/angular/components/virtualized-list/index.js.map +1 -1
- package/build/angular/components/virtualized-section-list/directives.js +12 -12
- package/build/angular/components/virtualized-section-list/directives.js.map +1 -1
- package/build/angular/components/virtualized-section-list/index.d.ts +19 -1
- package/build/angular/components/virtualized-section-list/index.js +93 -22
- package/build/angular/components/virtualized-section-list/index.js.map +1 -1
- package/build/angular/components.d.ts +2 -2
- package/build/angular/components.js +5 -0
- package/build/angular/components.js.map +1 -1
- package/build/angular/create-portal/index.js +34 -36
- package/build/angular/create-portal/index.js.map +1 -1
- package/build/angular/create-tunnel/index.js +19 -22
- package/build/angular/create-tunnel/index.js.map +1 -1
- package/build/angular/descriptor-to-angular/index.js +6 -4
- package/build/angular/descriptor-to-angular/index.js.map +1 -1
- package/build/angular/diagnostics.d.ts +33 -0
- package/build/angular/diagnostics.js +82 -0
- package/build/angular/diagnostics.js.map +1 -0
- package/build/angular/host-instance/index.js +1 -1
- package/build/angular/host-instance/index.js.map +1 -1
- package/build/angular/index.d.ts +9 -4
- package/build/angular/index.js +17 -3
- package/build/angular/index.js.map +1 -1
- package/build/angular/modules/animated/animated-leaf-binder.d.ts +1 -7
- package/build/angular/modules/animated/animated-leaf-binder.js +22 -72
- package/build/angular/modules/animated/animated-leaf-binder.js.map +1 -1
- package/build/angular/modules/animated/create-animated-component.d.ts +11 -6
- package/build/angular/modules/animated/create-animated-component.js +106 -55
- package/build/angular/modules/animated/create-animated-component.js.map +1 -1
- package/build/angular/modules/status-bar/index.js +4 -4
- package/build/angular/modules/status-bar/index.js.map +1 -1
- package/build/angular/primitives/index.d.ts +20 -3
- package/build/angular/primitives/index.js +84 -48
- package/build/angular/primitives/index.js.map +1 -1
- package/build/angular/primitives/shared.d.ts +48 -2
- package/build/angular/primitives/shared.js +158 -11
- package/build/angular/primitives/shared.js.map +1 -1
- package/build/angular/render/index.js +69 -38
- package/build/angular/render/index.js.map +1 -1
- package/build/angular/renderer/index.d.ts +1 -0
- package/build/angular/renderer/index.js +37 -2
- package/build/angular/renderer/index.js.map +1 -1
- package/build/angular/services/color-scheme.service.js +3 -3
- package/build/angular/services/color-scheme.service.js.map +1 -1
- package/build/angular/services/window-dimensions.service.js +4 -4
- package/build/angular/services/window-dimensions.service.js.map +1 -1
- package/package.json +10 -8
- package/src/anchor-host-registry.ts +2 -2
- package/src/bootstrap.ts +4 -1
- package/src/components/activity-indicator/index.android.ts +8 -1
- package/src/components/activity-indicator/index.ios.ts +4 -0
- package/src/components/activity-indicator/shared.ts +32 -13
- package/src/components/button.ts +46 -19
- package/src/components/flat-list/index.ts +122 -62
- package/src/components/image/index.android.ts +58 -7
- package/src/components/image/index.ios.ts +58 -7
- package/src/components/image/shared.ts +92 -21
- package/src/components/image-background.ts +29 -9
- package/src/components/input-accessory-view/index.ts +67 -12
- package/src/components/keyboard-avoiding-view/index.ts +61 -15
- package/src/components/modal/index.ts +72 -33
- package/src/components/pressable/index.ts +117 -28
- package/src/components/refresh-control/index.ts +74 -18
- package/src/components/safe-area-view/index.ts +64 -10
- package/src/components/scroll-view/index.android.ts +62 -47
- package/src/components/scroll-view/index.ios.ts +19 -17
- package/src/components/scroll-view/projection.ts +363 -64
- package/src/components/scroll-view/shared.ts +312 -90
- package/src/components/scroll-view/sticky-header.ts +36 -24
- package/src/components/section-list/index.ts +86 -53
- package/src/components/switch/index.android.ts +60 -8
- package/src/components/switch/index.ios.ts +60 -8
- package/src/components/switch/shared.ts +93 -6
- package/src/components/text-input.ts +95 -13
- package/src/components/touchable/index.ts +348 -64
- package/src/components/touchable-native-feedback/index.ts +94 -31
- package/src/components/virtualized-list/directives.ts +19 -5
- package/src/components/virtualized-list/index.ts +380 -85
- package/src/components/virtualized-section-list/directives.ts +6 -3
- package/src/components/virtualized-section-list/index.ts +146 -33
- package/src/components.ts +9 -1
- package/src/create-portal/index.ts +31 -31
- package/src/create-tunnel/index.ts +16 -17
- package/src/descriptor-to-angular/index.ts +29 -8
- package/src/diagnostics.ts +138 -0
- package/src/host-instance/index.ts +9 -3
- package/src/index.ts +61 -3
- package/src/modules/animated/animated-leaf-binder.ts +28 -77
- package/src/modules/animated/create-animated-component.ts +115 -47
- package/src/modules/app-registry/index.ts +9 -9
- package/src/modules/status-bar/index.ts +13 -4
- package/src/primitives/index.ts +47 -2
- package/src/primitives/shared.ts +170 -10
- package/src/render/index.ts +77 -39
- package/src/renderer/index.ts +76 -14
- package/src/services/color-scheme.service.ts +3 -1
- package/src/services/window-dimensions.service.ts +11 -4
- package/build/angular/modules/animated/animated-leaf-binder/index.d.ts +0 -14
- package/build/angular/modules/animated/animated-leaf-binder/index.js +0 -91
- package/build/angular/modules/animated/animated-leaf-binder/index.js.map +0 -1
- package/src/modules/animated/animated-leaf-binder/index.ts +0 -101
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { DestroyRef, inject, Injectable, signal } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Dimensions,
|
|
4
|
+
type IDimensionsSet,
|
|
5
|
+
type IDisplayMetrics,
|
|
6
|
+
} from '@symbiote-native/engine';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* Angular twin of React's `useWindowDimensions` and Vue's `useWindowDimensions` composable. The
|
|
@@ -28,9 +32,12 @@ export class WindowDimensionsService {
|
|
|
28
32
|
}
|
|
29
33
|
};
|
|
30
34
|
|
|
31
|
-
const subscription = Dimensions.addEventListener(
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
const subscription = Dimensions.addEventListener(
|
|
36
|
+
'change',
|
|
37
|
+
(set: IDimensionsSet) => {
|
|
38
|
+
handleChange(set.window);
|
|
39
|
+
},
|
|
40
|
+
);
|
|
34
41
|
// Re-check once after subscribing to close the gap between construction and the listener.
|
|
35
42
|
handleChange(Dimensions.get('window'));
|
|
36
43
|
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ISymbioteNode } from '@symbiote-native/engine';
|
|
2
|
-
export declare class AnimatedLeafBinder {
|
|
3
|
-
private readonly resolveNode;
|
|
4
|
-
private readonly label;
|
|
5
|
-
private attached;
|
|
6
|
-
private cancelBind;
|
|
7
|
-
private eventDetachers;
|
|
8
|
-
constructor(resolveNode: () => ISymbioteNode | null, label: string);
|
|
9
|
-
reconcile(props: Record<string, unknown>, wantsNative: boolean): void;
|
|
10
|
-
private bindNode;
|
|
11
|
-
private attachEvents;
|
|
12
|
-
private detachEvents;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Pure Fabrication (GRASP): the leaf-lifecycle orchestration shared by every Animated*
|
|
2
|
-
// wrapper, extracted out of AnimatedComponentBase so AnimatedImage — which cannot extend
|
|
3
|
-
// AnimatedComponentBase, since it must extend ImageBase for TS's-native image handling —
|
|
4
|
-
// gets the SAME logic via composition instead of copy-pasting it. Framework-thin on
|
|
5
|
-
// purpose: it knows nothing about Angular (@ViewChild, DI, change detection), only the
|
|
6
|
-
// engine's Animated leaf + commit primitives, so it stays testable without any Angular
|
|
7
|
-
// bootstrap. NOTE: react/vue drive this same dance through their own runtime HOC
|
|
8
|
-
// (createAnimatedComponent) rather than a class, so there is no cross-adapter dedup
|
|
9
|
-
// opportunity here yet — this Pure Fabrication is local to the angular adapter.
|
|
10
|
-
import { AnimatedProps, attachNativeEventHandler, dlog, whenCommitted, } from '@symbiote-native/engine';
|
|
11
|
-
export class AnimatedLeafBinder {
|
|
12
|
-
resolveNode;
|
|
13
|
-
label;
|
|
14
|
-
// The leaf currently wired into the value graph. Null until the first reconcile.
|
|
15
|
-
attached = null;
|
|
16
|
-
// The whenCommitted waiter for the current leaf's node binding, cancelled before the next.
|
|
17
|
-
cancelBind;
|
|
18
|
-
// Detachers for any Animated.event prop bound natively to the committed node (JS path: none).
|
|
19
|
-
eventDetachers = [];
|
|
20
|
-
// `resolveNode` stays a caller-supplied resolver (not a constructor-captured node) so this
|
|
21
|
-
// class never needs to know HOW the host node is found — AnimatedComponentBase and
|
|
22
|
-
// AnimatedImage both resolve it the same way (resolveHostNode + isSymbioteNode over their
|
|
23
|
-
// own @ViewChild), but that's Angular DI state this binder has no business touching.
|
|
24
|
-
// `label` is purely diagnostic (dlog), mirroring the constructor.name the pre-extraction
|
|
25
|
-
// dlog call used.
|
|
26
|
-
constructor(resolveNode, label) {
|
|
27
|
-
this.resolveNode = resolveNode;
|
|
28
|
-
this.label = label;
|
|
29
|
-
}
|
|
30
|
-
// Build a fresh AnimatedProps leaf from the current props (the React/Vue per-render
|
|
31
|
-
// useMemo(rest)), wire it into the graph, and swap the previous one out. Attach the NEW leaf
|
|
32
|
-
// BEFORE detaching the OLD one: a shared Value self-detaches (dropping its native node) the
|
|
33
|
-
// instant its child count hits zero, so detaching first would kill a running native animation
|
|
34
|
-
// on any unrelated re-render (mirrors RN's AnimatedComponent._attachProps). Then bind the
|
|
35
|
-
// committed node, go native if wanted, and rebind native events.
|
|
36
|
-
reconcile(props, wantsNative) {
|
|
37
|
-
dlog(`${this.label} reconcile`);
|
|
38
|
-
const newLeaf = new AnimatedProps(props);
|
|
39
|
-
newLeaf.__attach();
|
|
40
|
-
if (this.attached !== null && this.attached !== newLeaf)
|
|
41
|
-
this.attached.__detach();
|
|
42
|
-
this.attached = newLeaf;
|
|
43
|
-
this.bindNode(newLeaf, props, wantsNative);
|
|
44
|
-
}
|
|
45
|
-
// Bind the leaf to the host's Fabric node THROUGH whenCommitted: under Angular's zoneless
|
|
46
|
-
// batched change detection the inner host's tag does not exist yet at ngAfterViewInit time
|
|
47
|
-
// (the same async-commit gotcha Vue documents), so binding eagerly would no-op. whenCommitted
|
|
48
|
-
// runs the action now if already committed, else after the commit that assigns the tag.
|
|
49
|
-
bindNode(leaf, props, wantsNative) {
|
|
50
|
-
this.cancelBind?.();
|
|
51
|
-
this.cancelBind = undefined;
|
|
52
|
-
const node = this.resolveNode();
|
|
53
|
-
if (node === null)
|
|
54
|
-
return;
|
|
55
|
-
this.cancelBind = whenCommitted(node, () => {
|
|
56
|
-
leaf.setNativeView(node);
|
|
57
|
-
if (wantsNative)
|
|
58
|
-
leaf.__makeNative();
|
|
59
|
-
this.attachEvents(node, props);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
// Native-attach any Animated.event prop (e.g. onScroll={Animated.event(…,{useNativeDriver:true})})
|
|
63
|
-
// to the committed node. attachNativeEventHandler no-ops (returns undefined) unless the prop is a
|
|
64
|
-
// native event handler with a committed tag, so the JS path stays the fallback. Rebound each
|
|
65
|
-
// reconcile so a new inline event re-attaches; detached first to avoid leaking the prior binding.
|
|
66
|
-
attachEvents(node, props) {
|
|
67
|
-
this.detachEvents();
|
|
68
|
-
for (const key of Object.keys(props)) {
|
|
69
|
-
const attachment = attachNativeEventHandler(node, key, props[key]);
|
|
70
|
-
if (attachment !== undefined)
|
|
71
|
-
this.eventDetachers.push(attachment.detach);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
detachEvents() {
|
|
75
|
-
for (const detach of this.eventDetachers)
|
|
76
|
-
detach();
|
|
77
|
-
this.eventDetachers = [];
|
|
78
|
-
}
|
|
79
|
-
// Tear down everything: cancel a still-pending bind, drop native event listeners, detach the
|
|
80
|
-
// current leaf from the value graph. Safe to call even if reconcile() was never called.
|
|
81
|
-
destroy() {
|
|
82
|
-
this.cancelBind?.();
|
|
83
|
-
this.cancelBind = undefined;
|
|
84
|
-
this.detachEvents();
|
|
85
|
-
if (this.attached !== null) {
|
|
86
|
-
this.attached.__detach();
|
|
87
|
-
this.attached = null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/animated/animated-leaf-binder/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// Pure Fabrication (GRASP): the leaf-lifecycle orchestration shared by every Animated*
|
|
2
|
-
// wrapper, extracted out of AnimatedComponentBase so AnimatedImage — which cannot extend
|
|
3
|
-
// AnimatedComponentBase, since it must extend ImageBase for TS's-native image handling —
|
|
4
|
-
// gets the SAME logic via composition instead of copy-pasting it. Framework-thin on
|
|
5
|
-
// purpose: it knows nothing about Angular (@ViewChild, DI, change detection), only the
|
|
6
|
-
// engine's Animated leaf + commit primitives, so it stays testable without any Angular
|
|
7
|
-
// bootstrap. NOTE: react/vue drive this same dance through their own runtime HOC
|
|
8
|
-
// (createAnimatedComponent) rather than a class, so there is no cross-adapter dedup
|
|
9
|
-
// opportunity here yet — this Pure Fabrication is local to the angular adapter.
|
|
10
|
-
import {
|
|
11
|
-
AnimatedProps,
|
|
12
|
-
attachNativeEventHandler,
|
|
13
|
-
dlog,
|
|
14
|
-
whenCommitted,
|
|
15
|
-
type ISymbioteNode,
|
|
16
|
-
} from '@symbiote-native/engine';
|
|
17
|
-
|
|
18
|
-
export class AnimatedLeafBinder {
|
|
19
|
-
// The leaf currently wired into the value graph. Null until the first reconcile.
|
|
20
|
-
private attached: AnimatedProps | null = null;
|
|
21
|
-
// The whenCommitted waiter for the current leaf's node binding, cancelled before the next.
|
|
22
|
-
private cancelBind: (() => void) | undefined;
|
|
23
|
-
// Detachers for any Animated.event prop bound natively to the committed node (JS path: none).
|
|
24
|
-
private eventDetachers: Array<() => void> = [];
|
|
25
|
-
|
|
26
|
-
// `resolveNode` stays a caller-supplied resolver (not a constructor-captured node) so this
|
|
27
|
-
// class never needs to know HOW the host node is found — AnimatedComponentBase and
|
|
28
|
-
// AnimatedImage both resolve it the same way (resolveHostNode + isSymbioteNode over their
|
|
29
|
-
// own @ViewChild), but that's Angular DI state this binder has no business touching.
|
|
30
|
-
// `label` is purely diagnostic (dlog), mirroring the constructor.name the pre-extraction
|
|
31
|
-
// dlog call used.
|
|
32
|
-
constructor(
|
|
33
|
-
private readonly resolveNode: () => ISymbioteNode | null,
|
|
34
|
-
private readonly label: string,
|
|
35
|
-
) {}
|
|
36
|
-
|
|
37
|
-
// Build a fresh AnimatedProps leaf from the current props (the React/Vue per-render
|
|
38
|
-
// useMemo(rest)), wire it into the graph, and swap the previous one out. Attach the NEW leaf
|
|
39
|
-
// BEFORE detaching the OLD one: a shared Value self-detaches (dropping its native node) the
|
|
40
|
-
// instant its child count hits zero, so detaching first would kill a running native animation
|
|
41
|
-
// on any unrelated re-render (mirrors RN's AnimatedComponent._attachProps). Then bind the
|
|
42
|
-
// committed node, go native if wanted, and rebind native events.
|
|
43
|
-
reconcile(props: Record<string, unknown>, wantsNative: boolean): void {
|
|
44
|
-
dlog(`${this.label} reconcile`);
|
|
45
|
-
const newLeaf = new AnimatedProps(props);
|
|
46
|
-
newLeaf.__attach();
|
|
47
|
-
if (this.attached !== null && this.attached !== newLeaf) this.attached.__detach();
|
|
48
|
-
this.attached = newLeaf;
|
|
49
|
-
|
|
50
|
-
this.bindNode(newLeaf, props, wantsNative);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Bind the leaf to the host's Fabric node THROUGH whenCommitted: under Angular's zoneless
|
|
54
|
-
// batched change detection the inner host's tag does not exist yet at ngAfterViewInit time
|
|
55
|
-
// (the same async-commit gotcha Vue documents), so binding eagerly would no-op. whenCommitted
|
|
56
|
-
// runs the action now if already committed, else after the commit that assigns the tag.
|
|
57
|
-
private bindNode(
|
|
58
|
-
leaf: AnimatedProps,
|
|
59
|
-
props: Record<string, unknown>,
|
|
60
|
-
wantsNative: boolean,
|
|
61
|
-
): void {
|
|
62
|
-
this.cancelBind?.();
|
|
63
|
-
this.cancelBind = undefined;
|
|
64
|
-
const node = this.resolveNode();
|
|
65
|
-
if (node === null) return;
|
|
66
|
-
this.cancelBind = whenCommitted(node, () => {
|
|
67
|
-
leaf.setNativeView(node);
|
|
68
|
-
if (wantsNative) leaf.__makeNative();
|
|
69
|
-
this.attachEvents(node, props);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Native-attach any Animated.event prop (e.g. onScroll={Animated.event(…,{useNativeDriver:true})})
|
|
74
|
-
// to the committed node. attachNativeEventHandler no-ops (returns undefined) unless the prop is a
|
|
75
|
-
// native event handler with a committed tag, so the JS path stays the fallback. Rebound each
|
|
76
|
-
// reconcile so a new inline event re-attaches; detached first to avoid leaking the prior binding.
|
|
77
|
-
private attachEvents(node: ISymbioteNode, props: Record<string, unknown>): void {
|
|
78
|
-
this.detachEvents();
|
|
79
|
-
for (const key of Object.keys(props)) {
|
|
80
|
-
const attachment = attachNativeEventHandler(node, key, props[key]);
|
|
81
|
-
if (attachment !== undefined) this.eventDetachers.push(attachment.detach);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private detachEvents(): void {
|
|
86
|
-
for (const detach of this.eventDetachers) detach();
|
|
87
|
-
this.eventDetachers = [];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Tear down everything: cancel a still-pending bind, drop native event listeners, detach the
|
|
91
|
-
// current leaf from the value graph. Safe to call even if reconcile() was never called.
|
|
92
|
-
destroy(): void {
|
|
93
|
-
this.cancelBind?.();
|
|
94
|
-
this.cancelBind = undefined;
|
|
95
|
-
this.detachEvents();
|
|
96
|
-
if (this.attached !== null) {
|
|
97
|
-
this.attached.__detach();
|
|
98
|
-
this.attached = null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|