@ng-native/components 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +78 -1
- package/dist/activity-indicator.d.ts +41 -0
- package/dist/activity-indicator.js +66 -0
- package/dist/activity-indicator.js.map +1 -0
- package/dist/animated-style.d.ts +31 -0
- package/dist/animated-style.js +102 -0
- package/dist/animated-style.js.map +1 -0
- package/dist/animated.d.ts +125 -0
- package/dist/animated.js +538 -0
- package/dist/animated.js.map +1 -0
- package/dist/animation.d.ts +40 -0
- package/dist/animation.js +20 -0
- package/dist/animation.js.map +1 -0
- package/dist/animations-web.d.ts +8 -0
- package/dist/animations-web.js +31 -0
- package/dist/animations-web.js.map +1 -0
- package/dist/animations.d.ts +7 -0
- package/dist/animations.js +58 -0
- package/dist/animations.js.map +1 -0
- package/dist/controlled-model.d.ts +33 -0
- package/dist/controlled-model.js +47 -0
- package/dist/controlled-model.js.map +1 -0
- package/dist/easing.d.ts +21 -0
- package/dist/easing.js +50 -0
- package/dist/easing.js.map +1 -0
- package/dist/events.d.ts +169 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/gesture-backend.d.ts +26 -0
- package/dist/gesture-backend.js +14 -0
- package/dist/gesture-backend.js.map +1 -0
- package/dist/gesture-dispatch.d.ts +67 -0
- package/dist/gesture-dispatch.js +106 -0
- package/dist/gesture-dispatch.js.map +1 -0
- package/dist/gestures.d.ts +23 -0
- package/dist/gestures.js +164 -0
- package/dist/gestures.js.map +1 -0
- package/dist/height-index.d.ts +31 -0
- package/dist/height-index.js +80 -0
- package/dist/height-index.js.map +1 -0
- package/dist/image-background.d.ts +32 -0
- package/dist/image-background.js +80 -0
- package/dist/image-background.js.map +1 -0
- package/dist/image.d.ts +79 -0
- package/dist/image.js +155 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/input-accessory-view.d.ts +16 -0
- package/dist/input-accessory-view.js +29 -0
- package/dist/input-accessory-view.js.map +1 -0
- package/dist/keyboard-avoiding-view.d.ts +79 -0
- package/dist/keyboard-avoiding-view.js +172 -0
- package/dist/keyboard-avoiding-view.js.map +1 -0
- package/dist/keyboard-dock.d.ts +126 -0
- package/dist/keyboard-dock.js +327 -0
- package/dist/keyboard-dock.js.map +1 -0
- package/dist/keyboard-taps.d.ts +12 -0
- package/dist/keyboard-taps.js +51 -0
- package/dist/keyboard-taps.js.map +1 -0
- package/dist/modal.d.ts +56 -0
- package/dist/modal.js +102 -0
- package/dist/modal.js.map +1 -0
- package/dist/native-gesture.d.ts +21 -0
- package/dist/native-gesture.js +56 -0
- package/dist/native-gesture.js.map +1 -0
- package/dist/native-ref.d.ts +7 -0
- package/dist/native-ref.js +13 -0
- package/dist/native-ref.js.map +1 -0
- package/dist/pressable.d.ts +220 -0
- package/dist/pressable.js +484 -0
- package/dist/pressable.js.map +1 -0
- package/dist/reanimated.d.ts +19 -0
- package/dist/reanimated.js +111 -0
- package/dist/reanimated.js.map +1 -0
- package/dist/refresh-control.d.ts +50 -0
- package/dist/refresh-control.js +103 -0
- package/dist/refresh-control.js.map +1 -0
- package/dist/safe-area-provider.d.ts +11 -0
- package/dist/safe-area-provider.js +70 -0
- package/dist/safe-area-provider.js.map +1 -0
- package/dist/safe-area-view.d.ts +22 -0
- package/dist/safe-area-view.js +77 -0
- package/dist/safe-area-view.js.map +1 -0
- package/dist/safe-area.d.ts +12 -0
- package/dist/safe-area.js +27 -0
- package/dist/safe-area.js.map +1 -0
- package/dist/scroll-view-props.d.ts +89 -0
- package/dist/scroll-view-props.js +153 -0
- package/dist/scroll-view-props.js.map +1 -0
- package/dist/scroll-view.d.ts +95 -0
- package/dist/scroll-view.js +181 -0
- package/dist/scroll-view.js.map +1 -0
- package/dist/section-list.d.ts +146 -0
- package/dist/section-list.js +300 -0
- package/dist/section-list.js.map +1 -0
- package/dist/sticky-headers.d.ts +41 -0
- package/dist/sticky-headers.js +118 -0
- package/dist/sticky-headers.js.map +1 -0
- package/dist/swipe-refresh-layout.d.ts +51 -0
- package/dist/swipe-refresh-layout.js +162 -0
- package/dist/swipe-refresh-layout.js.map +1 -0
- package/dist/switch.d.ts +54 -0
- package/dist/switch.js +110 -0
- package/dist/switch.js.map +1 -0
- package/dist/template-slot.d.ts +18 -0
- package/dist/template-slot.js +30 -0
- package/dist/template-slot.js.map +1 -0
- package/dist/text-input.d.ts +168 -0
- package/dist/text-input.js +312 -0
- package/dist/text-input.js.map +1 -0
- package/dist/text.d.ts +70 -0
- package/dist/text.js +111 -0
- package/dist/text.js.map +1 -0
- package/dist/touchable-opacity.d.ts +36 -0
- package/dist/touchable-opacity.js +76 -0
- package/dist/touchable-opacity.js.map +1 -0
- package/dist/transforms.d.ts +2 -0
- package/dist/transforms.js +17 -0
- package/dist/transforms.js.map +1 -0
- package/dist/view-base.d.ts +332 -0
- package/dist/view-base.js +534 -0
- package/dist/view-base.js.map +1 -0
- package/dist/view.d.ts +12 -0
- package/dist/view.js +18 -0
- package/dist/view.js.map +1 -0
- package/dist/virtual-list.d.ts +530 -0
- package/dist/virtual-list.js +1150 -0
- package/dist/virtual-list.js.map +1 -0
- package/dist/worklet-scroll.d.ts +13 -0
- package/dist/worklet-scroll.js +49 -0
- package/dist/worklet-scroll.js.map +1 -0
- package/dist/worklet-style.d.ts +13 -0
- package/dist/worklet-style.js +47 -0
- package/dist/worklet-style.js.map +1 -0
- package/dist/worklets.d.ts +89 -0
- package/dist/worklets.js +42 -0
- package/dist/worklets.js.map +1 -0
- package/dist/written-props.d.ts +6 -0
- package/dist/written-props.js +180 -0
- package/dist/written-props.js.map +1 -0
- package/package.json +88 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Insets } from './events.ts';
|
|
2
|
+
import { ViewBase } from './view-base.ts';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* The native scroll view's own props, as typed inputs, for everything that commits as one:
|
|
6
|
+
* `<scroll-view>` and `<virtual-list>`, as `FlatList` takes every `ScrollView` prop.
|
|
7
|
+
*
|
|
8
|
+
* Only the props that mean the same on both are here. `horizontal`, `contentOffset`,
|
|
9
|
+
* `maintainVisibleContentPosition`, `nestedScrollEnabled` and the scroll event throttle each
|
|
10
|
+
* mean something more to a windowed list, which declares its own.
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class ScrollViewProps extends ViewBase {
|
|
13
|
+
/** Whether the content scrolls along x, which decides the axis the defaults bounce on. */
|
|
14
|
+
abstract readonly horizontal: () => boolean | undefined;
|
|
15
|
+
/** Set to false to freeze the scroll position. */
|
|
16
|
+
readonly scrollEnabled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
17
|
+
readonly showsHorizontalScrollIndicator: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
18
|
+
readonly showsVerticalScrollIndicator: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
19
|
+
/** Stop at multiples of the scroll view's own size. */
|
|
20
|
+
readonly pagingEnabled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
21
|
+
/** How quickly a fling slows: `normal`, `fast`, or a factor below 1. */
|
|
22
|
+
readonly decelerationRate: import("@angular/core").InputSignal<number | "normal" | "fast" | undefined>;
|
|
23
|
+
/** Stop at multiples of this many points. */
|
|
24
|
+
readonly snapToInterval: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
25
|
+
/** Stop only at these offsets. */
|
|
26
|
+
readonly snapToOffsets: import("@angular/core").InputSignal<readonly number[] | undefined>;
|
|
27
|
+
/** Where a snap point sits in the viewport. */
|
|
28
|
+
readonly snapToAlignment: import("@angular/core").InputSignal<"center" | "start" | "end" | undefined>;
|
|
29
|
+
/** Whether the start of the content is a snap point. Defaults to true. */
|
|
30
|
+
readonly snapToStart: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
31
|
+
/** Whether the end of the content is a snap point. Defaults to true. */
|
|
32
|
+
readonly snapToEnd: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
33
|
+
/** With snapping, stop at the next snap point rather than flinging past several. */
|
|
34
|
+
readonly disableIntervalMomentum: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
35
|
+
/** Milliseconds between `(scroll)` events; 16 or less means every frame. */
|
|
36
|
+
readonly scrollEventThrottle: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
37
|
+
/** iOS: padding inside the scroll view that the content can scroll into. */
|
|
38
|
+
readonly contentInset: import("@angular/core").InputSignal<Insets | undefined>;
|
|
39
|
+
/** iOS: insets for the scroll indicators. */
|
|
40
|
+
readonly scrollIndicatorInsets: import("@angular/core").InputSignal<Insets | undefined>;
|
|
41
|
+
/** iOS: rubber-band at the ends. Defaults to true. */
|
|
42
|
+
readonly bounces: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
43
|
+
/** iOS: bounce sideways even when the content fits. */
|
|
44
|
+
readonly alwaysBounceHorizontal: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
45
|
+
/** iOS: bounce vertically even when the content fits. */
|
|
46
|
+
readonly alwaysBounceVertical: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
47
|
+
protected readonly resolvedAlwaysBounceHorizontal: import("@angular/core").Signal<boolean>;
|
|
48
|
+
protected readonly resolvedAlwaysBounceVertical: import("@angular/core").Signal<boolean>;
|
|
49
|
+
/** iOS: rubber-band past the zoom limits. */
|
|
50
|
+
readonly bouncesZoom: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
51
|
+
/** iOS: once a drag starts on one axis, ignore the other. */
|
|
52
|
+
readonly directionalLockEnabled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
53
|
+
/** iOS: whether a drag that started on a child can become a scroll. Defaults to true. */
|
|
54
|
+
readonly canCancelContentTouches: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
55
|
+
/** iOS: centre content smaller than the viewport. */
|
|
56
|
+
readonly centerContent: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
57
|
+
/** iOS: adjust the insets for the navigation bar and status bar automatically. */
|
|
58
|
+
readonly automaticallyAdjustContentInsets: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
59
|
+
/** iOS: add a bottom inset while the keyboard is up. */
|
|
60
|
+
readonly automaticallyAdjustKeyboardInsets: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
61
|
+
/** iOS: keep the indicator insets in step with the content insets. Defaults to true. */
|
|
62
|
+
readonly automaticallyAdjustsScrollIndicatorInsets: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
63
|
+
/** iOS: how the safe area affects the content insets. */
|
|
64
|
+
readonly contentInsetAdjustmentBehavior: import("@angular/core").InputSignal<"never" | "always" | "automatic" | "scrollableAxes" | undefined>;
|
|
65
|
+
/** iOS: allow pinch-to-zoom. Defaults to true. */
|
|
66
|
+
readonly pinchGestureEnabled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
67
|
+
readonly maximumZoomScale: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
68
|
+
readonly minimumZoomScale: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
69
|
+
readonly zoomScale: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
70
|
+
/** iOS: the scroll indicator's colour. */
|
|
71
|
+
readonly indicatorStyle: import("@angular/core").InputSignal<"default" | "white" | "black" | undefined>;
|
|
72
|
+
/** iOS: tapping the status bar scrolls to the top. Defaults to true. */
|
|
73
|
+
readonly scrollsToTop: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
74
|
+
/** iOS: allow scrolling past the content programmatically. */
|
|
75
|
+
readonly scrollToOverflowEnabled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
76
|
+
/** Dismiss the keyboard when a drag starts, or interactively as the drag moves. */
|
|
77
|
+
readonly keyboardDismissMode: import("@angular/core").InputSignal<"none" | "on-drag" | "interactive" | undefined>;
|
|
78
|
+
/** Android: the over-scroll glow. */
|
|
79
|
+
readonly overScrollMode: import("@angular/core").InputSignal<"auto" | "never" | "always" | undefined>;
|
|
80
|
+
/** Android: keep the scrollbar visible. */
|
|
81
|
+
readonly persistentScrollbar: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
82
|
+
/** Android: fade the content at the edges over this many points. */
|
|
83
|
+
readonly fadingEdgeLength: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
84
|
+
/** Android: the colour drawn past the end of short content. */
|
|
85
|
+
readonly endFillColor: import("@angular/core").InputSignal<string | undefined>;
|
|
86
|
+
protected readonly resolvedDecelerationRate: import("@angular/core").Signal<number | undefined>;
|
|
87
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollViewProps, never>;
|
|
88
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollViewProps, never, never, { "scrollEnabled": { "alias": "scrollEnabled"; "required": false; "isSignal": true; }; "showsHorizontalScrollIndicator": { "alias": "showsHorizontalScrollIndicator"; "required": false; "isSignal": true; }; "showsVerticalScrollIndicator": { "alias": "showsVerticalScrollIndicator"; "required": false; "isSignal": true; }; "pagingEnabled": { "alias": "pagingEnabled"; "required": false; "isSignal": true; }; "decelerationRate": { "alias": "decelerationRate"; "required": false; "isSignal": true; }; "snapToInterval": { "alias": "snapToInterval"; "required": false; "isSignal": true; }; "snapToOffsets": { "alias": "snapToOffsets"; "required": false; "isSignal": true; }; "snapToAlignment": { "alias": "snapToAlignment"; "required": false; "isSignal": true; }; "snapToStart": { "alias": "snapToStart"; "required": false; "isSignal": true; }; "snapToEnd": { "alias": "snapToEnd"; "required": false; "isSignal": true; }; "disableIntervalMomentum": { "alias": "disableIntervalMomentum"; "required": false; "isSignal": true; }; "scrollEventThrottle": { "alias": "scrollEventThrottle"; "required": false; "isSignal": true; }; "contentInset": { "alias": "contentInset"; "required": false; "isSignal": true; }; "scrollIndicatorInsets": { "alias": "scrollIndicatorInsets"; "required": false; "isSignal": true; }; "bounces": { "alias": "bounces"; "required": false; "isSignal": true; }; "alwaysBounceHorizontal": { "alias": "alwaysBounceHorizontal"; "required": false; "isSignal": true; }; "alwaysBounceVertical": { "alias": "alwaysBounceVertical"; "required": false; "isSignal": true; }; "bouncesZoom": { "alias": "bouncesZoom"; "required": false; "isSignal": true; }; "directionalLockEnabled": { "alias": "directionalLockEnabled"; "required": false; "isSignal": true; }; "canCancelContentTouches": { "alias": "canCancelContentTouches"; "required": false; "isSignal": true; }; "centerContent": { "alias": "centerContent"; "required": false; "isSignal": true; }; "automaticallyAdjustContentInsets": { "alias": "automaticallyAdjustContentInsets"; "required": false; "isSignal": true; }; "automaticallyAdjustKeyboardInsets": { "alias": "automaticallyAdjustKeyboardInsets"; "required": false; "isSignal": true; }; "automaticallyAdjustsScrollIndicatorInsets": { "alias": "automaticallyAdjustsScrollIndicatorInsets"; "required": false; "isSignal": true; }; "contentInsetAdjustmentBehavior": { "alias": "contentInsetAdjustmentBehavior"; "required": false; "isSignal": true; }; "pinchGestureEnabled": { "alias": "pinchGestureEnabled"; "required": false; "isSignal": true; }; "maximumZoomScale": { "alias": "maximumZoomScale"; "required": false; "isSignal": true; }; "minimumZoomScale": { "alias": "minimumZoomScale"; "required": false; "isSignal": true; }; "zoomScale": { "alias": "zoomScale"; "required": false; "isSignal": true; }; "indicatorStyle": { "alias": "indicatorStyle"; "required": false; "isSignal": true; }; "scrollsToTop": { "alias": "scrollsToTop"; "required": false; "isSignal": true; }; "scrollToOverflowEnabled": { "alias": "scrollToOverflowEnabled"; "required": false; "isSignal": true; }; "keyboardDismissMode": { "alias": "keyboardDismissMode"; "required": false; "isSignal": true; }; "overScrollMode": { "alias": "overScrollMode"; "required": false; "isSignal": true; }; "persistentScrollbar": { "alias": "persistentScrollbar"; "required": false; "isSignal": true; }; "fadingEdgeLength": { "alias": "fadingEdgeLength"; "required": false; "isSignal": true; }; "endFillColor": { "alias": "endFillColor"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
89
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Directive, computed, input } from '@angular/core';
|
|
2
|
+
import { optionalBoolean, optionalNumber } from "./transforms.js";
|
|
3
|
+
import { ViewBase } from "./view-base.js";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/** RN's `processDecelerationRate`: the named rates, as UIKit and Android define them. */
|
|
6
|
+
const DECELERATION = { normal: 0.998, fast: 0.99 };
|
|
7
|
+
/**
|
|
8
|
+
* The native scroll view's own props, as typed inputs, for everything that commits as one:
|
|
9
|
+
* `<scroll-view>` and `<virtual-list>`, as `FlatList` takes every `ScrollView` prop.
|
|
10
|
+
*
|
|
11
|
+
* Only the props that mean the same on both are here. `horizontal`, `contentOffset`,
|
|
12
|
+
* `maintainVisibleContentPosition`, `nestedScrollEnabled` and the scroll event throttle each
|
|
13
|
+
* mean something more to a windowed list, which declares its own.
|
|
14
|
+
*/
|
|
15
|
+
export class ScrollViewProps extends ViewBase {
|
|
16
|
+
/** Set to false to freeze the scroll position. */
|
|
17
|
+
scrollEnabled = input(undefined, { ...(ngDevMode ? { debugName: "scrollEnabled" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
18
|
+
showsHorizontalScrollIndicator = input(undefined, { ...(ngDevMode ? { debugName: "showsHorizontalScrollIndicator" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
19
|
+
showsVerticalScrollIndicator = input(undefined, { ...(ngDevMode ? { debugName: "showsVerticalScrollIndicator" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
20
|
+
/** Stop at multiples of the scroll view's own size. */
|
|
21
|
+
pagingEnabled = input(undefined, { ...(ngDevMode ? { debugName: "pagingEnabled" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
22
|
+
/** How quickly a fling slows: `normal`, `fast`, or a factor below 1. */
|
|
23
|
+
decelerationRate = input(/* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [undefined, { debugName: "decelerationRate" }] : /* istanbul ignore next */ []));
|
|
25
|
+
/** Stop at multiples of this many points. */
|
|
26
|
+
snapToInterval = input(undefined, { ...(ngDevMode ? { debugName: "snapToInterval" } : /* istanbul ignore next */ {}), transform: optionalNumber });
|
|
27
|
+
/** Stop only at these offsets. */
|
|
28
|
+
snapToOffsets = input(/* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [undefined, { debugName: "snapToOffsets" }] : /* istanbul ignore next */ []));
|
|
30
|
+
/** Where a snap point sits in the viewport. */
|
|
31
|
+
snapToAlignment = input(/* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [undefined, { debugName: "snapToAlignment" }] : /* istanbul ignore next */ []));
|
|
33
|
+
/** Whether the start of the content is a snap point. Defaults to true. */
|
|
34
|
+
snapToStart = input(undefined, { ...(ngDevMode ? { debugName: "snapToStart" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
35
|
+
/** Whether the end of the content is a snap point. Defaults to true. */
|
|
36
|
+
snapToEnd = input(undefined, { ...(ngDevMode ? { debugName: "snapToEnd" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
37
|
+
/** With snapping, stop at the next snap point rather than flinging past several. */
|
|
38
|
+
disableIntervalMomentum = input(undefined, { ...(ngDevMode ? { debugName: "disableIntervalMomentum" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
39
|
+
/** Milliseconds between `(scroll)` events; 16 or less means every frame. */
|
|
40
|
+
scrollEventThrottle = input(undefined, { ...(ngDevMode ? { debugName: "scrollEventThrottle" } : /* istanbul ignore next */ {}), transform: optionalNumber });
|
|
41
|
+
/** iOS: padding inside the scroll view that the content can scroll into. */
|
|
42
|
+
contentInset = input(/* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [undefined, { debugName: "contentInset" }] : /* istanbul ignore next */ []));
|
|
44
|
+
/** iOS: insets for the scroll indicators. */
|
|
45
|
+
scrollIndicatorInsets = input(/* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [undefined, { debugName: "scrollIndicatorInsets" }] : /* istanbul ignore next */ []));
|
|
47
|
+
/** iOS: rubber-band at the ends. Defaults to true. */
|
|
48
|
+
bounces = input(undefined, { ...(ngDevMode ? { debugName: "bounces" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
49
|
+
/** iOS: bounce sideways even when the content fits. */
|
|
50
|
+
alwaysBounceHorizontal = input(undefined, { ...(ngDevMode ? { debugName: "alwaysBounceHorizontal" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
51
|
+
/** iOS: bounce vertically even when the content fits. */
|
|
52
|
+
alwaysBounceVertical = input(undefined, { ...(ngDevMode ? { debugName: "alwaysBounceVertical" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
53
|
+
// Match React Native ScrollView's axis defaults. Passing neither prop through leaves UIKit's
|
|
54
|
+
// false default in place, which makes short vertical pages feel fixed instead of rubber-banding.
|
|
55
|
+
resolvedAlwaysBounceHorizontal = computed(() => this.alwaysBounceHorizontal() ?? !!this.horizontal(), /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "resolvedAlwaysBounceHorizontal" }] : /* istanbul ignore next */ []));
|
|
57
|
+
resolvedAlwaysBounceVertical = computed(() => this.alwaysBounceVertical() ?? !this.horizontal(), /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "resolvedAlwaysBounceVertical" }] : /* istanbul ignore next */ []));
|
|
59
|
+
/** iOS: rubber-band past the zoom limits. */
|
|
60
|
+
bouncesZoom = input(undefined, { ...(ngDevMode ? { debugName: "bouncesZoom" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
61
|
+
/** iOS: once a drag starts on one axis, ignore the other. */
|
|
62
|
+
directionalLockEnabled = input(undefined, { ...(ngDevMode ? { debugName: "directionalLockEnabled" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
63
|
+
/** iOS: whether a drag that started on a child can become a scroll. Defaults to true. */
|
|
64
|
+
canCancelContentTouches = input(undefined, { ...(ngDevMode ? { debugName: "canCancelContentTouches" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
65
|
+
/** iOS: centre content smaller than the viewport. */
|
|
66
|
+
centerContent = input(undefined, { ...(ngDevMode ? { debugName: "centerContent" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
67
|
+
/** iOS: adjust the insets for the navigation bar and status bar automatically. */
|
|
68
|
+
automaticallyAdjustContentInsets = input(undefined, { ...(ngDevMode ? { debugName: "automaticallyAdjustContentInsets" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
69
|
+
/** iOS: add a bottom inset while the keyboard is up. */
|
|
70
|
+
automaticallyAdjustKeyboardInsets = input(undefined, { ...(ngDevMode ? { debugName: "automaticallyAdjustKeyboardInsets" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
71
|
+
/** iOS: keep the indicator insets in step with the content insets. Defaults to true. */
|
|
72
|
+
automaticallyAdjustsScrollIndicatorInsets = input(undefined, { ...(ngDevMode ? { debugName: "automaticallyAdjustsScrollIndicatorInsets" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
73
|
+
/** iOS: how the safe area affects the content insets. */
|
|
74
|
+
contentInsetAdjustmentBehavior = input(/* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [undefined, { debugName: "contentInsetAdjustmentBehavior" }] : /* istanbul ignore next */ []));
|
|
76
|
+
/** iOS: allow pinch-to-zoom. Defaults to true. */
|
|
77
|
+
pinchGestureEnabled = input(undefined, { ...(ngDevMode ? { debugName: "pinchGestureEnabled" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
78
|
+
maximumZoomScale = input(undefined, { ...(ngDevMode ? { debugName: "maximumZoomScale" } : /* istanbul ignore next */ {}), transform: optionalNumber });
|
|
79
|
+
minimumZoomScale = input(undefined, { ...(ngDevMode ? { debugName: "minimumZoomScale" } : /* istanbul ignore next */ {}), transform: optionalNumber });
|
|
80
|
+
zoomScale = input(undefined, { ...(ngDevMode ? { debugName: "zoomScale" } : /* istanbul ignore next */ {}), transform: optionalNumber });
|
|
81
|
+
/** iOS: the scroll indicator's colour. */
|
|
82
|
+
indicatorStyle = input(/* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [undefined, { debugName: "indicatorStyle" }] : /* istanbul ignore next */ []));
|
|
84
|
+
/** iOS: tapping the status bar scrolls to the top. Defaults to true. */
|
|
85
|
+
scrollsToTop = input(undefined, { ...(ngDevMode ? { debugName: "scrollsToTop" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
86
|
+
/** iOS: allow scrolling past the content programmatically. */
|
|
87
|
+
scrollToOverflowEnabled = input(undefined, { ...(ngDevMode ? { debugName: "scrollToOverflowEnabled" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
88
|
+
/** Dismiss the keyboard when a drag starts, or interactively as the drag moves. */
|
|
89
|
+
keyboardDismissMode = input(/* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [undefined, { debugName: "keyboardDismissMode" }] : /* istanbul ignore next */ []));
|
|
91
|
+
/** Android: the over-scroll glow. */
|
|
92
|
+
overScrollMode = input(/* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [undefined, { debugName: "overScrollMode" }] : /* istanbul ignore next */ []));
|
|
94
|
+
/** Android: keep the scrollbar visible. */
|
|
95
|
+
persistentScrollbar = input(undefined, { ...(ngDevMode ? { debugName: "persistentScrollbar" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
96
|
+
/** Android: fade the content at the edges over this many points. */
|
|
97
|
+
fadingEdgeLength = input(undefined, { ...(ngDevMode ? { debugName: "fadingEdgeLength" } : /* istanbul ignore next */ {}), transform: optionalNumber });
|
|
98
|
+
/** Android: the colour drawn past the end of short content. */
|
|
99
|
+
endFillColor = input(/* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [undefined, { debugName: "endFillColor" }] : /* istanbul ignore next */ []));
|
|
101
|
+
resolvedDecelerationRate = computed(() => {
|
|
102
|
+
const rate = this.decelerationRate();
|
|
103
|
+
return typeof rate === 'string' ? DECELERATION[rate] : rate;
|
|
104
|
+
}, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "resolvedDecelerationRate" }] : /* istanbul ignore next */ []));
|
|
106
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ScrollViewProps, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
107
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.0", type: ScrollViewProps, isStandalone: true, inputs: { scrollEnabled: { classPropertyName: "scrollEnabled", publicName: "scrollEnabled", isSignal: true, isRequired: false, transformFunction: null }, showsHorizontalScrollIndicator: { classPropertyName: "showsHorizontalScrollIndicator", publicName: "showsHorizontalScrollIndicator", isSignal: true, isRequired: false, transformFunction: null }, showsVerticalScrollIndicator: { classPropertyName: "showsVerticalScrollIndicator", publicName: "showsVerticalScrollIndicator", isSignal: true, isRequired: false, transformFunction: null }, pagingEnabled: { classPropertyName: "pagingEnabled", publicName: "pagingEnabled", isSignal: true, isRequired: false, transformFunction: null }, decelerationRate: { classPropertyName: "decelerationRate", publicName: "decelerationRate", isSignal: true, isRequired: false, transformFunction: null }, snapToInterval: { classPropertyName: "snapToInterval", publicName: "snapToInterval", isSignal: true, isRequired: false, transformFunction: null }, snapToOffsets: { classPropertyName: "snapToOffsets", publicName: "snapToOffsets", isSignal: true, isRequired: false, transformFunction: null }, snapToAlignment: { classPropertyName: "snapToAlignment", publicName: "snapToAlignment", isSignal: true, isRequired: false, transformFunction: null }, snapToStart: { classPropertyName: "snapToStart", publicName: "snapToStart", isSignal: true, isRequired: false, transformFunction: null }, snapToEnd: { classPropertyName: "snapToEnd", publicName: "snapToEnd", isSignal: true, isRequired: false, transformFunction: null }, disableIntervalMomentum: { classPropertyName: "disableIntervalMomentum", publicName: "disableIntervalMomentum", isSignal: true, isRequired: false, transformFunction: null }, scrollEventThrottle: { classPropertyName: "scrollEventThrottle", publicName: "scrollEventThrottle", isSignal: true, isRequired: false, transformFunction: null }, contentInset: { classPropertyName: "contentInset", publicName: "contentInset", isSignal: true, isRequired: false, transformFunction: null }, scrollIndicatorInsets: { classPropertyName: "scrollIndicatorInsets", publicName: "scrollIndicatorInsets", isSignal: true, isRequired: false, transformFunction: null }, bounces: { classPropertyName: "bounces", publicName: "bounces", isSignal: true, isRequired: false, transformFunction: null }, alwaysBounceHorizontal: { classPropertyName: "alwaysBounceHorizontal", publicName: "alwaysBounceHorizontal", isSignal: true, isRequired: false, transformFunction: null }, alwaysBounceVertical: { classPropertyName: "alwaysBounceVertical", publicName: "alwaysBounceVertical", isSignal: true, isRequired: false, transformFunction: null }, bouncesZoom: { classPropertyName: "bouncesZoom", publicName: "bouncesZoom", isSignal: true, isRequired: false, transformFunction: null }, directionalLockEnabled: { classPropertyName: "directionalLockEnabled", publicName: "directionalLockEnabled", isSignal: true, isRequired: false, transformFunction: null }, canCancelContentTouches: { classPropertyName: "canCancelContentTouches", publicName: "canCancelContentTouches", isSignal: true, isRequired: false, transformFunction: null }, centerContent: { classPropertyName: "centerContent", publicName: "centerContent", isSignal: true, isRequired: false, transformFunction: null }, automaticallyAdjustContentInsets: { classPropertyName: "automaticallyAdjustContentInsets", publicName: "automaticallyAdjustContentInsets", isSignal: true, isRequired: false, transformFunction: null }, automaticallyAdjustKeyboardInsets: { classPropertyName: "automaticallyAdjustKeyboardInsets", publicName: "automaticallyAdjustKeyboardInsets", isSignal: true, isRequired: false, transformFunction: null }, automaticallyAdjustsScrollIndicatorInsets: { classPropertyName: "automaticallyAdjustsScrollIndicatorInsets", publicName: "automaticallyAdjustsScrollIndicatorInsets", isSignal: true, isRequired: false, transformFunction: null }, contentInsetAdjustmentBehavior: { classPropertyName: "contentInsetAdjustmentBehavior", publicName: "contentInsetAdjustmentBehavior", isSignal: true, isRequired: false, transformFunction: null }, pinchGestureEnabled: { classPropertyName: "pinchGestureEnabled", publicName: "pinchGestureEnabled", isSignal: true, isRequired: false, transformFunction: null }, maximumZoomScale: { classPropertyName: "maximumZoomScale", publicName: "maximumZoomScale", isSignal: true, isRequired: false, transformFunction: null }, minimumZoomScale: { classPropertyName: "minimumZoomScale", publicName: "minimumZoomScale", isSignal: true, isRequired: false, transformFunction: null }, zoomScale: { classPropertyName: "zoomScale", publicName: "zoomScale", isSignal: true, isRequired: false, transformFunction: null }, indicatorStyle: { classPropertyName: "indicatorStyle", publicName: "indicatorStyle", isSignal: true, isRequired: false, transformFunction: null }, scrollsToTop: { classPropertyName: "scrollsToTop", publicName: "scrollsToTop", isSignal: true, isRequired: false, transformFunction: null }, scrollToOverflowEnabled: { classPropertyName: "scrollToOverflowEnabled", publicName: "scrollToOverflowEnabled", isSignal: true, isRequired: false, transformFunction: null }, keyboardDismissMode: { classPropertyName: "keyboardDismissMode", publicName: "keyboardDismissMode", isSignal: true, isRequired: false, transformFunction: null }, overScrollMode: { classPropertyName: "overScrollMode", publicName: "overScrollMode", isSignal: true, isRequired: false, transformFunction: null }, persistentScrollbar: { classPropertyName: "persistentScrollbar", publicName: "persistentScrollbar", isSignal: true, isRequired: false, transformFunction: null }, fadingEdgeLength: { classPropertyName: "fadingEdgeLength", publicName: "fadingEdgeLength", isSignal: true, isRequired: false, transformFunction: null }, endFillColor: { classPropertyName: "endFillColor", publicName: "endFillColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "scrollEnabled": "scrollEnabled()", "showsHorizontalScrollIndicator": "showsHorizontalScrollIndicator()", "showsVerticalScrollIndicator": "showsVerticalScrollIndicator()", "pagingEnabled": "pagingEnabled()", "decelerationRate": "resolvedDecelerationRate()", "snapToInterval": "snapToInterval()", "snapToOffsets": "snapToOffsets()", "snapToAlignment": "snapToAlignment()", "snapToStart": "snapToStart()", "snapToEnd": "snapToEnd()", "disableIntervalMomentum": "disableIntervalMomentum()", "sendMomentumEvents": "true", "contentInset": "contentInset()", "scrollIndicatorInsets": "scrollIndicatorInsets()", "bounces": "bounces()", "alwaysBounceHorizontal": "resolvedAlwaysBounceHorizontal()", "alwaysBounceVertical": "resolvedAlwaysBounceVertical()", "bouncesZoom": "bouncesZoom()", "directionalLockEnabled": "directionalLockEnabled()", "canCancelContentTouches": "canCancelContentTouches()", "centerContent": "centerContent()", "automaticallyAdjustContentInsets": "automaticallyAdjustContentInsets()", "automaticallyAdjustKeyboardInsets": "automaticallyAdjustKeyboardInsets()", "automaticallyAdjustsScrollIndicatorInsets": "automaticallyAdjustsScrollIndicatorInsets()", "contentInsetAdjustmentBehavior": "contentInsetAdjustmentBehavior()", "pinchGestureEnabled": "pinchGestureEnabled()", "maximumZoomScale": "maximumZoomScale()", "minimumZoomScale": "minimumZoomScale()", "zoomScale": "zoomScale()", "indicatorStyle": "indicatorStyle()", "scrollsToTop": "scrollsToTop()", "scrollToOverflowEnabled": "scrollToOverflowEnabled()", "keyboardDismissMode": "keyboardDismissMode()", "overScrollMode": "overScrollMode()", "persistentScrollbar": "persistentScrollbar()", "fadingEdgeLength": "fadingEdgeLength()", "endFillColor": "endFillColor()" } }, usesInheritance: true, ngImport: i0 });
|
|
108
|
+
}
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ScrollViewProps, decorators: [{
|
|
110
|
+
type: Directive,
|
|
111
|
+
args: [{
|
|
112
|
+
host: {
|
|
113
|
+
'[scrollEnabled]': 'scrollEnabled()',
|
|
114
|
+
'[showsHorizontalScrollIndicator]': 'showsHorizontalScrollIndicator()',
|
|
115
|
+
'[showsVerticalScrollIndicator]': 'showsVerticalScrollIndicator()',
|
|
116
|
+
'[pagingEnabled]': 'pagingEnabled()',
|
|
117
|
+
'[decelerationRate]': 'resolvedDecelerationRate()',
|
|
118
|
+
'[snapToInterval]': 'snapToInterval()',
|
|
119
|
+
'[snapToOffsets]': 'snapToOffsets()',
|
|
120
|
+
'[snapToAlignment]': 'snapToAlignment()',
|
|
121
|
+
'[snapToStart]': 'snapToStart()',
|
|
122
|
+
'[snapToEnd]': 'snapToEnd()',
|
|
123
|
+
'[disableIntervalMomentum]': 'disableIntervalMomentum()',
|
|
124
|
+
'[sendMomentumEvents]': 'true',
|
|
125
|
+
'[contentInset]': 'contentInset()',
|
|
126
|
+
'[scrollIndicatorInsets]': 'scrollIndicatorInsets()',
|
|
127
|
+
'[bounces]': 'bounces()',
|
|
128
|
+
'[alwaysBounceHorizontal]': 'resolvedAlwaysBounceHorizontal()',
|
|
129
|
+
'[alwaysBounceVertical]': 'resolvedAlwaysBounceVertical()',
|
|
130
|
+
'[bouncesZoom]': 'bouncesZoom()',
|
|
131
|
+
'[directionalLockEnabled]': 'directionalLockEnabled()',
|
|
132
|
+
'[canCancelContentTouches]': 'canCancelContentTouches()',
|
|
133
|
+
'[centerContent]': 'centerContent()',
|
|
134
|
+
'[automaticallyAdjustContentInsets]': 'automaticallyAdjustContentInsets()',
|
|
135
|
+
'[automaticallyAdjustKeyboardInsets]': 'automaticallyAdjustKeyboardInsets()',
|
|
136
|
+
'[automaticallyAdjustsScrollIndicatorInsets]': 'automaticallyAdjustsScrollIndicatorInsets()',
|
|
137
|
+
'[contentInsetAdjustmentBehavior]': 'contentInsetAdjustmentBehavior()',
|
|
138
|
+
'[pinchGestureEnabled]': 'pinchGestureEnabled()',
|
|
139
|
+
'[maximumZoomScale]': 'maximumZoomScale()',
|
|
140
|
+
'[minimumZoomScale]': 'minimumZoomScale()',
|
|
141
|
+
'[zoomScale]': 'zoomScale()',
|
|
142
|
+
'[indicatorStyle]': 'indicatorStyle()',
|
|
143
|
+
'[scrollsToTop]': 'scrollsToTop()',
|
|
144
|
+
'[scrollToOverflowEnabled]': 'scrollToOverflowEnabled()',
|
|
145
|
+
'[keyboardDismissMode]': 'keyboardDismissMode()',
|
|
146
|
+
'[overScrollMode]': 'overScrollMode()',
|
|
147
|
+
'[persistentScrollbar]': 'persistentScrollbar()',
|
|
148
|
+
'[fadingEdgeLength]': 'fadingEdgeLength()',
|
|
149
|
+
'[endFillColor]': 'endFillColor()',
|
|
150
|
+
},
|
|
151
|
+
}]
|
|
152
|
+
}], propDecorators: { scrollEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollEnabled", required: false }] }], showsHorizontalScrollIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showsHorizontalScrollIndicator", required: false }] }], showsVerticalScrollIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showsVerticalScrollIndicator", required: false }] }], pagingEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagingEnabled", required: false }] }], decelerationRate: [{ type: i0.Input, args: [{ isSignal: true, alias: "decelerationRate", required: false }] }], snapToInterval: [{ type: i0.Input, args: [{ isSignal: true, alias: "snapToInterval", required: false }] }], snapToOffsets: [{ type: i0.Input, args: [{ isSignal: true, alias: "snapToOffsets", required: false }] }], snapToAlignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "snapToAlignment", required: false }] }], snapToStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "snapToStart", required: false }] }], snapToEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "snapToEnd", required: false }] }], disableIntervalMomentum: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableIntervalMomentum", required: false }] }], scrollEventThrottle: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollEventThrottle", required: false }] }], contentInset: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentInset", required: false }] }], scrollIndicatorInsets: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollIndicatorInsets", required: false }] }], bounces: [{ type: i0.Input, args: [{ isSignal: true, alias: "bounces", required: false }] }], alwaysBounceHorizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysBounceHorizontal", required: false }] }], alwaysBounceVertical: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysBounceVertical", required: false }] }], bouncesZoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "bouncesZoom", required: false }] }], directionalLockEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "directionalLockEnabled", required: false }] }], canCancelContentTouches: [{ type: i0.Input, args: [{ isSignal: true, alias: "canCancelContentTouches", required: false }] }], centerContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "centerContent", required: false }] }], automaticallyAdjustContentInsets: [{ type: i0.Input, args: [{ isSignal: true, alias: "automaticallyAdjustContentInsets", required: false }] }], automaticallyAdjustKeyboardInsets: [{ type: i0.Input, args: [{ isSignal: true, alias: "automaticallyAdjustKeyboardInsets", required: false }] }], automaticallyAdjustsScrollIndicatorInsets: [{ type: i0.Input, args: [{ isSignal: true, alias: "automaticallyAdjustsScrollIndicatorInsets", required: false }] }], contentInsetAdjustmentBehavior: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentInsetAdjustmentBehavior", required: false }] }], pinchGestureEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinchGestureEnabled", required: false }] }], maximumZoomScale: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximumZoomScale", required: false }] }], minimumZoomScale: [{ type: i0.Input, args: [{ isSignal: true, alias: "minimumZoomScale", required: false }] }], zoomScale: [{ type: i0.Input, args: [{ isSignal: true, alias: "zoomScale", required: false }] }], indicatorStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "indicatorStyle", required: false }] }], scrollsToTop: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollsToTop", required: false }] }], scrollToOverflowEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollToOverflowEnabled", required: false }] }], keyboardDismissMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardDismissMode", required: false }] }], overScrollMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "overScrollMode", required: false }] }], persistentScrollbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "persistentScrollbar", required: false }] }], fadingEdgeLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "fadingEdgeLength", required: false }] }], endFillColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "endFillColor", required: false }] }] } });
|
|
153
|
+
//# sourceMappingURL=scroll-view-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-view-props.js","sourceRoot":"","sources":["../src/scroll-view-props.ts"],"names":[],"mappings":"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","sourcesContent":["import { Directive, computed, input } from '@angular/core';\nimport type { Insets } from './events.ts';\nimport { optionalBoolean, optionalNumber } from './transforms.ts';\nimport { ViewBase } from './view-base.ts';\n\n/** RN's `processDecelerationRate`: the named rates, as UIKit and Android define them. */\nconst DECELERATION: Record<string, number> = { normal: 0.998, fast: 0.99 };\n\n/**\n * The native scroll view's own props, as typed inputs, for everything that commits as one:\n * `<scroll-view>` and `<virtual-list>`, as `FlatList` takes every `ScrollView` prop.\n *\n * Only the props that mean the same on both are here. `horizontal`, `contentOffset`,\n * `maintainVisibleContentPosition`, `nestedScrollEnabled` and the scroll event throttle each\n * mean something more to a windowed list, which declares its own.\n */\n@Directive({\n host: {\n '[scrollEnabled]': 'scrollEnabled()',\n '[showsHorizontalScrollIndicator]': 'showsHorizontalScrollIndicator()',\n '[showsVerticalScrollIndicator]': 'showsVerticalScrollIndicator()',\n '[pagingEnabled]': 'pagingEnabled()',\n '[decelerationRate]': 'resolvedDecelerationRate()',\n '[snapToInterval]': 'snapToInterval()',\n '[snapToOffsets]': 'snapToOffsets()',\n '[snapToAlignment]': 'snapToAlignment()',\n '[snapToStart]': 'snapToStart()',\n '[snapToEnd]': 'snapToEnd()',\n '[disableIntervalMomentum]': 'disableIntervalMomentum()',\n '[sendMomentumEvents]': 'true',\n '[contentInset]': 'contentInset()',\n '[scrollIndicatorInsets]': 'scrollIndicatorInsets()',\n '[bounces]': 'bounces()',\n '[alwaysBounceHorizontal]': 'resolvedAlwaysBounceHorizontal()',\n '[alwaysBounceVertical]': 'resolvedAlwaysBounceVertical()',\n '[bouncesZoom]': 'bouncesZoom()',\n '[directionalLockEnabled]': 'directionalLockEnabled()',\n '[canCancelContentTouches]': 'canCancelContentTouches()',\n '[centerContent]': 'centerContent()',\n '[automaticallyAdjustContentInsets]': 'automaticallyAdjustContentInsets()',\n '[automaticallyAdjustKeyboardInsets]': 'automaticallyAdjustKeyboardInsets()',\n '[automaticallyAdjustsScrollIndicatorInsets]': 'automaticallyAdjustsScrollIndicatorInsets()',\n '[contentInsetAdjustmentBehavior]': 'contentInsetAdjustmentBehavior()',\n '[pinchGestureEnabled]': 'pinchGestureEnabled()',\n '[maximumZoomScale]': 'maximumZoomScale()',\n '[minimumZoomScale]': 'minimumZoomScale()',\n '[zoomScale]': 'zoomScale()',\n '[indicatorStyle]': 'indicatorStyle()',\n '[scrollsToTop]': 'scrollsToTop()',\n '[scrollToOverflowEnabled]': 'scrollToOverflowEnabled()',\n '[keyboardDismissMode]': 'keyboardDismissMode()',\n '[overScrollMode]': 'overScrollMode()',\n '[persistentScrollbar]': 'persistentScrollbar()',\n '[fadingEdgeLength]': 'fadingEdgeLength()',\n '[endFillColor]': 'endFillColor()',\n },\n})\nexport abstract class ScrollViewProps extends ViewBase {\n /** Whether the content scrolls along x, which decides the axis the defaults bounce on. */\n abstract readonly horizontal: () => boolean | undefined;\n\n /** Set to false to freeze the scroll position. */\n readonly scrollEnabled = input(undefined, { transform: optionalBoolean });\n readonly showsHorizontalScrollIndicator = input(undefined, { transform: optionalBoolean });\n readonly showsVerticalScrollIndicator = input(undefined, { transform: optionalBoolean });\n /** Stop at multiples of the scroll view's own size. */\n readonly pagingEnabled = input(undefined, { transform: optionalBoolean });\n /** How quickly a fling slows: `normal`, `fast`, or a factor below 1. */\n readonly decelerationRate = input<'normal' | 'fast' | number>();\n /** Stop at multiples of this many points. */\n readonly snapToInterval = input(undefined, { transform: optionalNumber });\n /** Stop only at these offsets. */\n readonly snapToOffsets = input<readonly number[]>();\n /** Where a snap point sits in the viewport. */\n readonly snapToAlignment = input<'start' | 'center' | 'end'>();\n /** Whether the start of the content is a snap point. Defaults to true. */\n readonly snapToStart = input(undefined, { transform: optionalBoolean });\n /** Whether the end of the content is a snap point. Defaults to true. */\n readonly snapToEnd = input(undefined, { transform: optionalBoolean });\n /** With snapping, stop at the next snap point rather than flinging past several. */\n readonly disableIntervalMomentum = input(undefined, { transform: optionalBoolean });\n /** Milliseconds between `(scroll)` events; 16 or less means every frame. */\n readonly scrollEventThrottle = input(undefined, { transform: optionalNumber });\n /** iOS: padding inside the scroll view that the content can scroll into. */\n readonly contentInset = input<Insets>();\n /** iOS: insets for the scroll indicators. */\n readonly scrollIndicatorInsets = input<Insets>();\n /** iOS: rubber-band at the ends. Defaults to true. */\n readonly bounces = input(undefined, { transform: optionalBoolean });\n /** iOS: bounce sideways even when the content fits. */\n readonly alwaysBounceHorizontal = input(undefined, { transform: optionalBoolean });\n /** iOS: bounce vertically even when the content fits. */\n readonly alwaysBounceVertical = input(undefined, { transform: optionalBoolean });\n // Match React Native ScrollView's axis defaults. Passing neither prop through leaves UIKit's\n // false default in place, which makes short vertical pages feel fixed instead of rubber-banding.\n protected readonly resolvedAlwaysBounceHorizontal = computed(\n () => this.alwaysBounceHorizontal() ?? !!this.horizontal(),\n );\n protected readonly resolvedAlwaysBounceVertical = computed(\n () => this.alwaysBounceVertical() ?? !this.horizontal(),\n );\n /** iOS: rubber-band past the zoom limits. */\n readonly bouncesZoom = input(undefined, { transform: optionalBoolean });\n /** iOS: once a drag starts on one axis, ignore the other. */\n readonly directionalLockEnabled = input(undefined, { transform: optionalBoolean });\n /** iOS: whether a drag that started on a child can become a scroll. Defaults to true. */\n readonly canCancelContentTouches = input(undefined, { transform: optionalBoolean });\n /** iOS: centre content smaller than the viewport. */\n readonly centerContent = input(undefined, { transform: optionalBoolean });\n /** iOS: adjust the insets for the navigation bar and status bar automatically. */\n readonly automaticallyAdjustContentInsets = input(undefined, { transform: optionalBoolean });\n /** iOS: add a bottom inset while the keyboard is up. */\n readonly automaticallyAdjustKeyboardInsets = input(undefined, { transform: optionalBoolean });\n /** iOS: keep the indicator insets in step with the content insets. Defaults to true. */\n readonly automaticallyAdjustsScrollIndicatorInsets = input(undefined, {\n transform: optionalBoolean,\n });\n /** iOS: how the safe area affects the content insets. */\n readonly contentInsetAdjustmentBehavior = input<\n 'automatic' | 'scrollableAxes' | 'never' | 'always'\n >();\n /** iOS: allow pinch-to-zoom. Defaults to true. */\n readonly pinchGestureEnabled = input(undefined, { transform: optionalBoolean });\n readonly maximumZoomScale = input(undefined, { transform: optionalNumber });\n readonly minimumZoomScale = input(undefined, { transform: optionalNumber });\n readonly zoomScale = input(undefined, { transform: optionalNumber });\n /** iOS: the scroll indicator's colour. */\n readonly indicatorStyle = input<'default' | 'black' | 'white'>();\n /** iOS: tapping the status bar scrolls to the top. Defaults to true. */\n readonly scrollsToTop = input(undefined, { transform: optionalBoolean });\n /** iOS: allow scrolling past the content programmatically. */\n readonly scrollToOverflowEnabled = input(undefined, { transform: optionalBoolean });\n /** Dismiss the keyboard when a drag starts, or interactively as the drag moves. */\n readonly keyboardDismissMode = input<'none' | 'on-drag' | 'interactive'>();\n /** Android: the over-scroll glow. */\n readonly overScrollMode = input<'auto' | 'always' | 'never'>();\n /** Android: keep the scrollbar visible. */\n readonly persistentScrollbar = input(undefined, { transform: optionalBoolean });\n /** Android: fade the content at the edges over this many points. */\n readonly fadingEdgeLength = input(undefined, { transform: optionalNumber });\n /** Android: the colour drawn past the end of short content. */\n readonly endFillColor = input<string>();\n\n protected readonly resolvedDecelerationRate = computed(() => {\n const rate = this.decelerationRate();\n return typeof rate === 'string' ? DECELERATION[rate] : rate;\n });\n}\n"]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type NativeSyntheticEvent } from '@ng-native/fabric';
|
|
2
|
+
import type { Point, Rect, Size } from './events.ts';
|
|
3
|
+
import { type KeyboardShouldPersistTaps } from './keyboard-taps.ts';
|
|
4
|
+
import { ScrollViewProps } from './scroll-view-props.ts';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* A scrolling container. Commits as `RCTScrollView`, with the children inside a content view.
|
|
8
|
+
*
|
|
9
|
+
* The native scroll view has no `contentContainerStyle`: RN's `ScrollView.js` wraps children in
|
|
10
|
+
* a content view and applies it there, which is done here. The engine gives the host RN's base
|
|
11
|
+
* style (`overflow: 'scroll'` and the flex defaults); without it the content spills out of the
|
|
12
|
+
* scroll view's bounds.
|
|
13
|
+
*
|
|
14
|
+
* `horizontal` changes two things rather than one, and both are needed. RN swaps its whole base
|
|
15
|
+
* style for `baseHorizontal` - the same defaults but `flexDirection: 'row'` - and puts
|
|
16
|
+
* `contentContainerHorizontal` on the content view. With the host left as a column the content
|
|
17
|
+
* view is stretched to the scroll view's width instead of growing past it, so there is nothing to
|
|
18
|
+
* scroll to and a sideways drag does nothing at all. It looks like a scroll view that simply has
|
|
19
|
+
* too little in it.
|
|
20
|
+
*
|
|
21
|
+
* Keyboard policy is the other half of what `ScrollView.js` does in JavaScript. With a text
|
|
22
|
+
* input focused, a tap elsewhere in the scroll view dismisses the keyboard and goes no further
|
|
23
|
+
* (`keyboardShouldPersistTaps: 'never'`, the default), reaches the child first and dismisses only
|
|
24
|
+
* if nothing handled it (`'handled'`), or never dismisses (`'always'`).
|
|
25
|
+
*
|
|
26
|
+
* `stickyHeaderIndices` pins those children of the content to the leading edge, each until the
|
|
27
|
+
* next pushes it off. It is JavaScript in RN as well; see `StickyHeaders`.
|
|
28
|
+
*
|
|
29
|
+
* Events are element events: `(scroll)`, `(scrollBeginDrag)`, `(scrollEndDrag)`,
|
|
30
|
+
* `(momentumScrollBegin)`, `(momentumScrollEnd)`, `(scrollToTop)`. `(contentSizeChange)` is an
|
|
31
|
+
* output, measured from the content view's layout as RN does.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ScrollView extends ScrollViewProps {
|
|
34
|
+
/** Styles for the view that holds the children, e.g. padding and gap. */
|
|
35
|
+
readonly contentContainerStyle: import("@angular/core").InputSignal<Record<string, unknown> | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* The content view's style, with the row direction a horizontal scroll view needs.
|
|
38
|
+
*
|
|
39
|
+
* RN's `contentContainerHorizontal`, and in the same order: the caller's own style is applied
|
|
40
|
+
* over it, so a horizontal scroll view whose content really should stack in a column can still
|
|
41
|
+
* say so.
|
|
42
|
+
*/
|
|
43
|
+
protected readonly contentStyle: import("@angular/core").Signal<Record<string, unknown> | undefined>;
|
|
44
|
+
/** Lay children out in a row and scroll sideways. */
|
|
45
|
+
readonly horizontal: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
46
|
+
/** Where the content starts, before the user scrolls. */
|
|
47
|
+
readonly contentOffset: import("@angular/core").InputSignal<Point | undefined>;
|
|
48
|
+
/** Keep what is on screen still when content is added above it. */
|
|
49
|
+
readonly maintainVisibleContentPosition: import("@angular/core").InputSignal<{
|
|
50
|
+
readonly minIndexForVisible: number;
|
|
51
|
+
readonly autoscrollToTopThreshold?: number;
|
|
52
|
+
} | undefined>;
|
|
53
|
+
/** What a tap does with the keyboard up. See the class note. Defaults to `never`. */
|
|
54
|
+
readonly keyboardShouldPersistTaps: import("@angular/core").InputSignal<KeyboardShouldPersistTaps>;
|
|
55
|
+
/** Android: cooperate with a scrolling ancestor. */
|
|
56
|
+
readonly nestedScrollEnabled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
57
|
+
/** Children of the content, by position, that stick to the leading edge while it scrolls. */
|
|
58
|
+
readonly stickyHeaderIndices: import("@angular/core").InputSignal<readonly number[]>;
|
|
59
|
+
/** The content view's size changed; the value is its new width and height. */
|
|
60
|
+
readonly contentSizeChange: import("@angular/core").OutputEmitterRef<Size>;
|
|
61
|
+
private readonly refreshControl;
|
|
62
|
+
private readonly content;
|
|
63
|
+
private readonly sticky;
|
|
64
|
+
/** RN asks for every scroll event while anything is sticky, which is what keeps it pinned. */
|
|
65
|
+
protected readonly resolvedThrottle: import("@angular/core").Signal<number | undefined>;
|
|
66
|
+
/**
|
|
67
|
+
* RN's `nestedScrollEnabled ?? true` for a scroll view inside Android's swipe layout: the scroll
|
|
68
|
+
* view has to see a drag before the layout wrapped around it does, or every drag is a pull.
|
|
69
|
+
*/
|
|
70
|
+
protected readonly resolvedNestedScroll: import("@angular/core").Signal<boolean | undefined>;
|
|
71
|
+
constructor();
|
|
72
|
+
/**
|
|
73
|
+
* Sticky children are found again after each pass, because a pass can add or move them, and the
|
|
74
|
+
* scroll offset is listened for only while there are any.
|
|
75
|
+
*/
|
|
76
|
+
private trackStickyHeaders;
|
|
77
|
+
/** Scroll to a position. */
|
|
78
|
+
scrollTo(options: {
|
|
79
|
+
x?: number;
|
|
80
|
+
y?: number;
|
|
81
|
+
animated?: boolean;
|
|
82
|
+
}): void;
|
|
83
|
+
scrollToEnd(options?: {
|
|
84
|
+
animated?: boolean;
|
|
85
|
+
}): void;
|
|
86
|
+
/** Briefly show the scroll indicators, to hint that there is more. */
|
|
87
|
+
flashScrollIndicators(): void;
|
|
88
|
+
/** iOS: zoom so that a rectangle of the content fills the viewport. */
|
|
89
|
+
zoomToRect(rect: Rect, animated?: boolean): void;
|
|
90
|
+
protected onContentLayout(event: NativeSyntheticEvent<{
|
|
91
|
+
layout?: Size;
|
|
92
|
+
}>): void;
|
|
93
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollView, never>;
|
|
94
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScrollView, "scroll-view", ["scrollView"], { "contentContainerStyle": { "alias": "contentContainerStyle"; "required": false; "isSignal": true; }; "horizontal": { "alias": "horizontal"; "required": false; "isSignal": true; }; "contentOffset": { "alias": "contentOffset"; "required": false; "isSignal": true; }; "maintainVisibleContentPosition": { "alias": "maintainVisibleContentPosition"; "required": false; "isSignal": true; }; "keyboardShouldPersistTaps": { "alias": "keyboardShouldPersistTaps"; "required": false; "isSignal": true; }; "nestedScrollEnabled": { "alias": "nestedScrollEnabled"; "required": false; "isSignal": true; }; "stickyHeaderIndices": { "alias": "stickyHeaderIndices"; "required": false; "isSignal": true; }; }, { "contentSizeChange": "contentSizeChange"; }, ["refreshControl"], ["refresh-control", "*"], true, never>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Component, DestroyRef, ElementRef, afterEveryRender, computed, contentChild, inject, input, output, viewChild, } from '@angular/core';
|
|
2
|
+
import { nativePlatform } from '@ng-native/fabric';
|
|
3
|
+
import { dismissKeyboardOnTap } from "./keyboard-taps.js";
|
|
4
|
+
import { RefreshControl } from "./refresh-control.js";
|
|
5
|
+
import { StickyHeaders } from "./sticky-headers.js";
|
|
6
|
+
import { optionalBoolean } from "./transforms.js";
|
|
7
|
+
import { ScrollViewProps } from "./scroll-view-props.js";
|
|
8
|
+
import { View } from "./view.js";
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
/**
|
|
11
|
+
* A scrolling container. Commits as `RCTScrollView`, with the children inside a content view.
|
|
12
|
+
*
|
|
13
|
+
* The native scroll view has no `contentContainerStyle`: RN's `ScrollView.js` wraps children in
|
|
14
|
+
* a content view and applies it there, which is done here. The engine gives the host RN's base
|
|
15
|
+
* style (`overflow: 'scroll'` and the flex defaults); without it the content spills out of the
|
|
16
|
+
* scroll view's bounds.
|
|
17
|
+
*
|
|
18
|
+
* `horizontal` changes two things rather than one, and both are needed. RN swaps its whole base
|
|
19
|
+
* style for `baseHorizontal` - the same defaults but `flexDirection: 'row'` - and puts
|
|
20
|
+
* `contentContainerHorizontal` on the content view. With the host left as a column the content
|
|
21
|
+
* view is stretched to the scroll view's width instead of growing past it, so there is nothing to
|
|
22
|
+
* scroll to and a sideways drag does nothing at all. It looks like a scroll view that simply has
|
|
23
|
+
* too little in it.
|
|
24
|
+
*
|
|
25
|
+
* Keyboard policy is the other half of what `ScrollView.js` does in JavaScript. With a text
|
|
26
|
+
* input focused, a tap elsewhere in the scroll view dismisses the keyboard and goes no further
|
|
27
|
+
* (`keyboardShouldPersistTaps: 'never'`, the default), reaches the child first and dismisses only
|
|
28
|
+
* if nothing handled it (`'handled'`), or never dismisses (`'always'`).
|
|
29
|
+
*
|
|
30
|
+
* `stickyHeaderIndices` pins those children of the content to the leading edge, each until the
|
|
31
|
+
* next pushes it off. It is JavaScript in RN as well; see `StickyHeaders`.
|
|
32
|
+
*
|
|
33
|
+
* Events are element events: `(scroll)`, `(scrollBeginDrag)`, `(scrollEndDrag)`,
|
|
34
|
+
* `(momentumScrollBegin)`, `(momentumScrollEnd)`, `(scrollToTop)`. `(contentSizeChange)` is an
|
|
35
|
+
* output, measured from the content view's layout as RN does.
|
|
36
|
+
*/
|
|
37
|
+
export class ScrollView extends ScrollViewProps {
|
|
38
|
+
/** Styles for the view that holds the children, e.g. padding and gap. */
|
|
39
|
+
contentContainerStyle = input(/* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [undefined, { debugName: "contentContainerStyle" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/**
|
|
42
|
+
* The content view's style, with the row direction a horizontal scroll view needs.
|
|
43
|
+
*
|
|
44
|
+
* RN's `contentContainerHorizontal`, and in the same order: the caller's own style is applied
|
|
45
|
+
* over it, so a horizontal scroll view whose content really should stack in a column can still
|
|
46
|
+
* say so.
|
|
47
|
+
*/
|
|
48
|
+
contentStyle = computed(() => this.horizontal()
|
|
49
|
+
? { flexDirection: 'row', ...this.contentContainerStyle() }
|
|
50
|
+
: this.contentContainerStyle(), /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "contentStyle" }] : /* istanbul ignore next */ []));
|
|
52
|
+
/** Lay children out in a row and scroll sideways. */
|
|
53
|
+
horizontal = input(undefined, { ...(ngDevMode ? { debugName: "horizontal" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
54
|
+
/** Where the content starts, before the user scrolls. */
|
|
55
|
+
contentOffset = input(/* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [undefined, { debugName: "contentOffset" }] : /* istanbul ignore next */ []));
|
|
57
|
+
/** Keep what is on screen still when content is added above it. */
|
|
58
|
+
maintainVisibleContentPosition = input(/* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [undefined, { debugName: "maintainVisibleContentPosition" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/** What a tap does with the keyboard up. See the class note. Defaults to `never`. */
|
|
61
|
+
keyboardShouldPersistTaps = input('never', /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "keyboardShouldPersistTaps" }] : /* istanbul ignore next */ []));
|
|
63
|
+
/** Android: cooperate with a scrolling ancestor. */
|
|
64
|
+
nestedScrollEnabled = input(undefined, { ...(ngDevMode ? { debugName: "nestedScrollEnabled" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
|
|
65
|
+
/** Children of the content, by position, that stick to the leading edge while it scrolls. */
|
|
66
|
+
stickyHeaderIndices = input([], /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "stickyHeaderIndices" }] : /* istanbul ignore next */ []));
|
|
68
|
+
/** The content view's size changed; the value is its new width and height. */
|
|
69
|
+
contentSizeChange = output();
|
|
70
|
+
refreshControl = contentChild(RefreshControl, /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "refreshControl" }] : /* istanbul ignore next */ []));
|
|
72
|
+
content = viewChild.required('content', { ...(ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
73
|
+
sticky = new StickyHeaders(this.engine, this.node, () => !!this.horizontal());
|
|
74
|
+
/** RN asks for every scroll event while anything is sticky, which is what keeps it pinned. */
|
|
75
|
+
resolvedThrottle = computed(() => this.stickyHeaderIndices().length > 0 ? 1 : this.scrollEventThrottle(), /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "resolvedThrottle" }] : /* istanbul ignore next */ []));
|
|
77
|
+
/**
|
|
78
|
+
* RN's `nestedScrollEnabled ?? true` for a scroll view inside Android's swipe layout: the scroll
|
|
79
|
+
* view has to see a drag before the layout wrapped around it does, or every drag is a pull.
|
|
80
|
+
*/
|
|
81
|
+
resolvedNestedScroll = computed(() => this.nestedScrollEnabled() ??
|
|
82
|
+
(nativePlatform() === 'android' && this.refreshControl() ? true : undefined), /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "resolvedNestedScroll" }] : /* istanbul ignore next */ []));
|
|
84
|
+
constructor() {
|
|
85
|
+
super();
|
|
86
|
+
const stop = dismissKeyboardOnTap(this.engine, this.node, () => this.keyboardShouldPersistTaps());
|
|
87
|
+
inject(DestroyRef).onDestroy(stop);
|
|
88
|
+
this.trackStickyHeaders();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Sticky children are found again after each pass, because a pass can add or move them, and the
|
|
92
|
+
* scroll offset is listened for only while there are any.
|
|
93
|
+
*/
|
|
94
|
+
trackStickyHeaders() {
|
|
95
|
+
let stopScroll = null;
|
|
96
|
+
afterEveryRender(() => {
|
|
97
|
+
const indices = this.stickyHeaderIndices();
|
|
98
|
+
if (indices.length === 0 && !stopScroll)
|
|
99
|
+
return;
|
|
100
|
+
this.sticky.track(this.content().nativeElement, indices);
|
|
101
|
+
if (indices.length > 0 && !stopScroll) {
|
|
102
|
+
stopScroll = this.engine.setEventListener(this.node, 'topScroll', (event) => {
|
|
103
|
+
const offset = event.nativeEvent
|
|
104
|
+
?.contentOffset;
|
|
105
|
+
this.sticky.scrolled((this.horizontal() ? offset?.x : offset?.y) ?? 0);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
else if (indices.length === 0 && stopScroll) {
|
|
109
|
+
stopScroll();
|
|
110
|
+
stopScroll = null;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
inject(DestroyRef).onDestroy(() => {
|
|
114
|
+
stopScroll?.();
|
|
115
|
+
this.sticky.destroy();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/** Scroll to a position. */
|
|
119
|
+
scrollTo(options) {
|
|
120
|
+
const { x = 0, y = 0, animated = true } = options;
|
|
121
|
+
this.engine.dispatchCommand(this.node, 'scrollTo', [x, y, animated]);
|
|
122
|
+
}
|
|
123
|
+
scrollToEnd(options = {}) {
|
|
124
|
+
this.engine.dispatchCommand(this.node, 'scrollToEnd', [options.animated ?? true]);
|
|
125
|
+
}
|
|
126
|
+
/** Briefly show the scroll indicators, to hint that there is more. */
|
|
127
|
+
flashScrollIndicators() {
|
|
128
|
+
this.engine.dispatchCommand(this.node, 'flashScrollIndicators');
|
|
129
|
+
}
|
|
130
|
+
/** iOS: zoom so that a rectangle of the content fills the viewport. */
|
|
131
|
+
zoomToRect(rect, animated = true) {
|
|
132
|
+
this.engine.dispatchCommand(this.node, 'zoomToRect', [rect, animated]);
|
|
133
|
+
}
|
|
134
|
+
onContentLayout(event) {
|
|
135
|
+
const layout = event.nativeEvent?.layout;
|
|
136
|
+
if (layout)
|
|
137
|
+
this.contentSizeChange.emit({ width: layout.width, height: layout.height });
|
|
138
|
+
}
|
|
139
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ScrollView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
140
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.0", type: ScrollView, isStandalone: true, selector: "scroll-view", inputs: { contentContainerStyle: { classPropertyName: "contentContainerStyle", publicName: "contentContainerStyle", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, contentOffset: { classPropertyName: "contentOffset", publicName: "contentOffset", isSignal: true, isRequired: false, transformFunction: null }, maintainVisibleContentPosition: { classPropertyName: "maintainVisibleContentPosition", publicName: "maintainVisibleContentPosition", isSignal: true, isRequired: false, transformFunction: null }, keyboardShouldPersistTaps: { classPropertyName: "keyboardShouldPersistTaps", publicName: "keyboardShouldPersistTaps", isSignal: true, isRequired: false, transformFunction: null }, nestedScrollEnabled: { classPropertyName: "nestedScrollEnabled", publicName: "nestedScrollEnabled", isSignal: true, isRequired: false, transformFunction: null }, stickyHeaderIndices: { classPropertyName: "stickyHeaderIndices", publicName: "stickyHeaderIndices", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contentSizeChange: "contentSizeChange" }, host: { properties: { "flexDirection": "horizontal() ? 'row' : 'column'", "horizontal": "horizontal()", "contentOffset": "contentOffset()", "maintainVisibleContentPosition": "maintainVisibleContentPosition()", "scrollEventThrottle": "resolvedThrottle()", "nestedScrollEnabled": "resolvedNestedScroll()" } }, queries: [{ propertyName: "refreshControl", first: true, predicate: RefreshControl, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, read: ElementRef, isSignal: true }], exportAs: ["scrollView"], usesInheritance: true, ngImport: i0, template: `
|
|
141
|
+
<ng-content select="refresh-control" />
|
|
142
|
+
<view #content [style]="contentStyle()" collapsable="false" (layout)="onContentLayout($event)">
|
|
143
|
+
<ng-content />
|
|
144
|
+
</view>
|
|
145
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: View, selector: "view" }] });
|
|
146
|
+
}
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ScrollView, decorators: [{
|
|
148
|
+
type: Component,
|
|
149
|
+
args: [{
|
|
150
|
+
selector: 'scroll-view',
|
|
151
|
+
exportAs: 'scrollView',
|
|
152
|
+
imports: [View],
|
|
153
|
+
// `collapsable: false` is load-bearing, not a hint. Fabric flattens views whose props are
|
|
154
|
+
// layout-only, and a content container with just padding qualifies: it gets no UIView at all.
|
|
155
|
+
// Touches in its empty areas then land on the scroll view itself, which does not scroll from a
|
|
156
|
+
// direct hit, so dragging anywhere the children do not cover silently does nothing. RN sets the
|
|
157
|
+
// same flag on its content container for the same reason.
|
|
158
|
+
//
|
|
159
|
+
// A refresh control is the scroll view's own child, before the content view, as RN's
|
|
160
|
+
// ScrollView.js commits it. On iOS it finds its scroll view once, when it is inserted, and
|
|
161
|
+
// Fabric mounts bottom-up: inside the content view it would look before that view was in the
|
|
162
|
+
// scroll view, and never attach.
|
|
163
|
+
template: `
|
|
164
|
+
<ng-content select="refresh-control" />
|
|
165
|
+
<view #content [style]="contentStyle()" collapsable="false" (layout)="onContentLayout($event)">
|
|
166
|
+
<ng-content />
|
|
167
|
+
</view>
|
|
168
|
+
`,
|
|
169
|
+
host: {
|
|
170
|
+
// The base style's direction, which `horizontal` decides. A top-level prop rather than a
|
|
171
|
+
// host `[style]`, so the caller's own `[style]` still applies over it as it does in RN.
|
|
172
|
+
'[flexDirection]': "horizontal() ? 'row' : 'column'",
|
|
173
|
+
'[horizontal]': 'horizontal()',
|
|
174
|
+
'[contentOffset]': 'contentOffset()',
|
|
175
|
+
'[maintainVisibleContentPosition]': 'maintainVisibleContentPosition()',
|
|
176
|
+
'[scrollEventThrottle]': 'resolvedThrottle()',
|
|
177
|
+
'[nestedScrollEnabled]': 'resolvedNestedScroll()',
|
|
178
|
+
},
|
|
179
|
+
}]
|
|
180
|
+
}], ctorParameters: () => [], propDecorators: { contentContainerStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentContainerStyle", required: false }] }], horizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "horizontal", required: false }] }], contentOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentOffset", required: false }] }], maintainVisibleContentPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "maintainVisibleContentPosition", required: false }] }], keyboardShouldPersistTaps: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardShouldPersistTaps", required: false }] }], nestedScrollEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "nestedScrollEnabled", required: false }] }], stickyHeaderIndices: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyHeaderIndices", required: false }] }], contentSizeChange: [{ type: i0.Output, args: ["contentSizeChange"] }], refreshControl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => RefreshControl), { isSignal: true }] }], content: [{ type: i0.ViewChild, args: ['content', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
181
|
+
//# sourceMappingURL=scroll-view.js.map
|