react-native-header-motion 1.0.0-alpha.0 → 1.0.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 +65 -528
- package/lib/module/components/Bridge.js +16 -0
- package/lib/module/components/Bridge.js.map +1 -0
- package/lib/module/components/FlatList.js +5 -54
- package/lib/module/components/FlatList.js.map +1 -1
- package/lib/module/components/Header.js +71 -13
- package/lib/module/components/Header.js.map +1 -1
- package/lib/module/components/HeaderDynamic.js +34 -0
- package/lib/module/components/HeaderDynamic.js.map +1 -0
- package/lib/module/components/HeaderMotion.js +14 -20
- package/lib/module/components/HeaderMotion.js.map +1 -1
- package/lib/module/components/HeaderPanBoundary.js +54 -0
- package/lib/module/components/HeaderPanBoundary.js.map +1 -0
- package/lib/module/components/NavigationBridge.js +20 -0
- package/lib/module/components/NavigationBridge.js.map +1 -0
- package/lib/module/components/ScrollManager.js +19 -7
- package/lib/module/components/ScrollManager.js.map +1 -1
- package/lib/module/components/ScrollView.js +6 -39
- package/lib/module/components/ScrollView.js.map +1 -1
- package/lib/module/components/createHeaderMotionScrollable.js +136 -0
- package/lib/module/components/createHeaderMotionScrollable.js.map +1 -0
- package/lib/module/components/index.js +3 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/context.js +8 -1
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useActiveScrollId.js +7 -6
- package/lib/module/hooks/useActiveScrollId.js.map +1 -1
- package/lib/module/hooks/useConsumerScrollHandlers.js +86 -0
- package/lib/module/hooks/useConsumerScrollHandlers.js.map +1 -0
- package/lib/module/hooks/useHeaderMotionBridge.js +14 -0
- package/lib/module/hooks/useHeaderMotionBridge.js.map +1 -0
- package/lib/module/hooks/useMotionProgress.js +12 -42
- package/lib/module/hooks/useMotionProgress.js.map +1 -1
- package/lib/module/hooks/useMotionProgress.test.js +56 -0
- package/lib/module/hooks/useMotionProgress.test.js.map +1 -0
- package/lib/module/hooks/useScrollManager.js +168 -87
- package/lib/module/hooks/useScrollManager.js.map +1 -1
- package/lib/module/index.js +21 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/defaults.js +2 -1
- package/lib/module/utils/defaults.js.map +1 -1
- package/lib/module/utils/header.js +24 -0
- package/lib/module/utils/header.js.map +1 -0
- package/lib/module/utils/headerOffsetStyle.js +31 -0
- package/lib/module/utils/headerOffsetStyle.js.map +1 -0
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/docs/docusaurus.config.d.ts +4 -0
- package/lib/typescript/docs/docusaurus.config.d.ts.map +1 -0
- package/lib/typescript/docs/sidebars.d.ts +4 -0
- package/lib/typescript/docs/sidebars.d.ts.map +1 -0
- package/lib/typescript/docs/src/pages/index.d.ts +2 -0
- package/lib/typescript/docs/src/pages/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Bridge.d.ts +19 -0
- package/lib/typescript/src/components/Bridge.d.ts.map +1 -0
- package/lib/typescript/src/components/FlatList.d.ts +7 -15
- package/lib/typescript/src/components/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/Header.d.ts +73 -12
- package/lib/typescript/src/components/Header.d.ts.map +1 -1
- package/lib/typescript/src/components/HeaderDynamic.d.ts +11 -0
- package/lib/typescript/src/components/HeaderDynamic.d.ts.map +1 -0
- package/lib/typescript/src/components/HeaderMotion.d.ts +38 -23
- package/lib/typescript/src/components/HeaderMotion.d.ts.map +1 -1
- package/lib/typescript/src/components/HeaderPanBoundary.d.ts +11 -0
- package/lib/typescript/src/components/HeaderPanBoundary.d.ts.map +1 -0
- package/lib/typescript/src/components/NavigationBridge.d.ts +19 -0
- package/lib/typescript/src/components/NavigationBridge.d.ts.map +1 -0
- package/lib/typescript/src/components/ScrollManager.d.ts +13 -9
- package/lib/typescript/src/components/ScrollManager.d.ts.map +1 -1
- package/lib/typescript/src/components/ScrollView.d.ts +7 -14
- package/lib/typescript/src/components/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts +86 -0
- package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +3 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/context.d.ts +3 -17
- package/lib/typescript/src/context.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useActiveScrollId.d.ts +7 -6
- package/lib/typescript/src/hooks/useActiveScrollId.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useConsumerScrollHandlers.d.ts +64 -0
- package/lib/typescript/src/hooks/useConsumerScrollHandlers.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts +10 -0
- package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMotionProgress.d.ts +8 -25
- package/lib/typescript/src/hooks/useMotionProgress.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMotionProgress.test.d.ts +2 -0
- package/lib/typescript/src/hooks/useMotionProgress.test.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useScrollManager.d.ts +61 -29
- package/lib/typescript/src/hooks/useScrollManager.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +56 -26
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +54 -17
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/defaults.d.ts +3 -2
- package/lib/typescript/src/utils/defaults.d.ts.map +1 -1
- package/lib/typescript/src/utils/header.d.ts +10 -0
- package/lib/typescript/src/utils/header.d.ts.map +1 -0
- package/lib/typescript/src/utils/headerOffsetStyle.d.ts +19 -0
- package/lib/typescript/src/utils/headerOffsetStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +2 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/refreshControl.d.ts +12 -12
- package/package.json +12 -5
- package/src/components/Bridge.tsx +29 -0
- package/src/components/FlatList.tsx +18 -76
- package/src/components/Header.tsx +159 -23
- package/src/components/HeaderDynamic.tsx +45 -0
- package/src/components/HeaderMotion.tsx +47 -50
- package/src/components/HeaderPanBoundary.tsx +92 -0
- package/src/components/NavigationBridge.tsx +30 -0
- package/src/components/ScrollManager.tsx +23 -11
- package/src/components/ScrollView.tsx +16 -60
- package/src/components/createHeaderMotionScrollable.tsx +438 -0
- package/src/components/index.ts +3 -1
- package/src/context.ts +11 -24
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useActiveScrollId.ts +7 -6
- package/src/hooks/useConsumerScrollHandlers.ts +148 -0
- package/src/hooks/useHeaderMotionBridge.ts +15 -0
- package/src/hooks/useMotionProgress.test.ts +67 -0
- package/src/hooks/useMotionProgress.ts +12 -45
- package/src/hooks/useScrollManager.ts +251 -114
- package/src/index.ts +82 -36
- package/src/types.ts +81 -29
- package/src/utils/defaults.ts +7 -1
- package/src/utils/header.tsx +52 -0
- package/src/utils/headerOffsetStyle.ts +40 -0
- package/src/utils/index.ts +2 -0
- package/lib/module/components/HeaderBase.js +0 -107
- package/lib/module/components/HeaderBase.js.map +0 -1
- package/lib/typescript/src/components/HeaderBase.d.ts +0 -41
- package/lib/typescript/src/components/HeaderBase.d.ts.map +0 -1
- package/src/components/HeaderBase.tsx +0 -140
|
@@ -1,19 +1,80 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
type
|
|
4
|
-
|
|
1
|
+
import type { HeaderAsChildProps, HeaderDefaultProps, HeaderPanDecayConfig } from '../types';
|
|
2
|
+
import { HeaderDynamic } from './HeaderDynamic';
|
|
3
|
+
type HeaderPanProps = {
|
|
4
|
+
/** Enables dragging the header itself to scroll the active scrollable.
|
|
5
|
+
*
|
|
6
|
+
* This is useful when the header covers a large portion of the screen
|
|
7
|
+
* and you want the gesture to feel continuous between header and content.
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
pannable: true;
|
|
12
|
+
/**
|
|
13
|
+
* Customizes the momentum animation that runs after a header pan ends.
|
|
14
|
+
*
|
|
15
|
+
* Use an object for a fixed decay profile. Use a function when the decay
|
|
16
|
+
* should depend on the end event, for example to dampen or amplify
|
|
17
|
+
* certain velocities.
|
|
18
|
+
*
|
|
19
|
+
* If you provide a function, it runs inside the gesture end worklet and
|
|
20
|
+
* **must itself be marked with the 'worklet' directive.**
|
|
21
|
+
*/
|
|
22
|
+
panDecayConfig?: HeaderPanDecayConfig;
|
|
23
|
+
} | {
|
|
24
|
+
pannable?: false | undefined;
|
|
25
|
+
panDecayConfig?: never;
|
|
26
|
+
};
|
|
27
|
+
export type HeaderProps = (HeaderDefaultProps & HeaderPanProps & {
|
|
28
|
+
/**
|
|
29
|
+
* Applies the default absolute-positioned header layout.
|
|
30
|
+
*
|
|
31
|
+
* Leave this enabled for navigation headers and any header that should
|
|
32
|
+
* visually float above the scrollable content. Disable it only when you
|
|
33
|
+
* intentionally want the header to participate in normal layout flow.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
overlay?: boolean;
|
|
5
38
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
39
|
+
* Wraps the pan gesture in `GestureHandlerRootView`.
|
|
40
|
+
*
|
|
41
|
+
* Only use this when the rendered header subtree is not already under a
|
|
42
|
+
* gesture-handler root.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
8
45
|
*/
|
|
9
|
-
|
|
10
|
-
}
|
|
46
|
+
withGestureHandlerRootView?: boolean;
|
|
47
|
+
}) | (HeaderAsChildProps & HeaderPanProps & {
|
|
48
|
+
/**
|
|
49
|
+
* Wraps the pan gesture in `GestureHandlerRootView`.
|
|
50
|
+
*
|
|
51
|
+
* Only use this when the rendered header subtree is not already under a
|
|
52
|
+
* gesture-handler root.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
withGestureHandlerRootView?: boolean;
|
|
57
|
+
});
|
|
58
|
+
declare function HeaderRoot(props: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
59
|
/**
|
|
12
|
-
* Header
|
|
13
|
-
*
|
|
60
|
+
* Header container that measures the total header height for scroll offsetting.
|
|
61
|
+
*
|
|
62
|
+
* It renders an `Animated.View` by default, wires the outer header measurement
|
|
63
|
+
* automatically, and can optionally make the header surface pannable.
|
|
14
64
|
*
|
|
15
|
-
*
|
|
65
|
+
* Pair it with `Header.Dynamic` to mark the part of the header that should
|
|
66
|
+
* drive the collapse threshold.
|
|
16
67
|
*/
|
|
17
|
-
export declare
|
|
68
|
+
export declare const Header: typeof HeaderRoot & {
|
|
69
|
+
/**
|
|
70
|
+
* Marks the part of the header whose measured layout should define the
|
|
71
|
+
* collapsible distance.
|
|
72
|
+
*
|
|
73
|
+
* In most designs, this is the section that visually disappears while the
|
|
74
|
+
* header collapses. Its measured value feeds `measureDynamic`, which can in
|
|
75
|
+
* turn drive `progressThreshold`.
|
|
76
|
+
*/
|
|
77
|
+
Dynamic: typeof HeaderDynamic;
|
|
78
|
+
};
|
|
18
79
|
export {};
|
|
19
80
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/Header.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/Header.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAMlB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,KAAK,cAAc,GACf;IACE;;;;;;OAMG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC,GACD;IACE,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IAC7B,cAAc,CAAC,EAAE,KAAK,CAAC;CACxB,CAAC;AAEN,MAAM,MAAM,WAAW,GACnB,CAAC,kBAAkB,GACjB,cAAc,GAAG;IACf;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC,GACJ,CAAC,kBAAkB,GACjB,cAAc,GAAG;IACf;;;;;;;OAOG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC,CAAC;AAWT,iBAAS,UAAU,CAAC,KAAK,EAAE,WAAW,2CAwDrC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM;IACjB;;;;;;;OAOG;;CAEH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HeaderDynamicProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Marks the part of the header whose layout should define the collapsible
|
|
4
|
+
* distance.
|
|
5
|
+
*
|
|
6
|
+
* In most designs, this is the section that visually disappears while the
|
|
7
|
+
* header collapses. Its measured value feeds `measureDynamic`, which in turn
|
|
8
|
+
* can drive `progressThreshold`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function HeaderDynamic(props: HeaderDynamicProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=HeaderDynamic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderDynamic.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderDynamic.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAOnD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA0BtD"}
|
|
@@ -3,54 +3,69 @@ import type { ReactNode } from 'react';
|
|
|
3
3
|
import type { MeasureAnimatedHeader, ProgressThreshold } from '../types';
|
|
4
4
|
export interface HeaderMotionProps<T extends string> {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Distance that maps the active scrollable from `progress = 0`
|
|
7
|
+
* to `progress = 1`.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Use a number when the collapse distance is fixed. Use a function when the
|
|
10
|
+
* distance should depend on what `measureDynamic` reads from
|
|
11
|
+
* `HeaderMotion.Header.Dynamic`.
|
|
12
|
+
*
|
|
13
|
+
* A common pattern is to measure the height of the part of the header that
|
|
14
|
+
* should disappear and use that as the threshold.
|
|
10
15
|
*/
|
|
11
16
|
progressThreshold?: ProgressThreshold;
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Receives the layout change event from React Native.
|
|
18
|
+
* Reads the value that should define the "collapsible" part of the header.
|
|
16
19
|
*
|
|
17
|
-
* This
|
|
20
|
+
* This is called from `HeaderMotion.Header.Dynamic` on layout. The returned
|
|
21
|
+
* number feeds `progressThreshold` when you provide that prop as a function.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
23
|
+
* By default, the library measures the dynamic section's height. Override
|
|
24
|
+
* this when the collapse distance should be based on something else, for
|
|
25
|
+
* example width or a derived value from the layout event.
|
|
20
26
|
*/
|
|
21
27
|
measureDynamic?: MeasureAnimatedHeader;
|
|
22
28
|
/**
|
|
23
|
-
*
|
|
29
|
+
* Controls when `measureDynamic` is allowed to update.
|
|
30
|
+
*
|
|
24
31
|
* - 'mount': Only measure once on mount
|
|
25
|
-
* - 'update':
|
|
32
|
+
* - 'update': Re-measure whenever `HeaderMotion.Header.Dynamic` lays out again
|
|
33
|
+
*
|
|
34
|
+
* Use `'mount'` for stable headers. Use `'update'` when the dynamic section
|
|
35
|
+
* can change size after mount, for example after async data loads or content
|
|
36
|
+
* expansion.
|
|
37
|
+
*
|
|
26
38
|
* @default 'mount'
|
|
27
39
|
*/
|
|
28
40
|
measureDynamicMode?: 'update' | 'mount';
|
|
29
41
|
/**
|
|
30
|
-
* Shared value
|
|
31
|
-
*
|
|
42
|
+
* Shared value that tells HeaderMotion which scrollable currently owns the
|
|
43
|
+
* header progress in multi-scroll setups.
|
|
44
|
+
*
|
|
45
|
+
* Pass this when one header is shared across multiple scrollables, such as
|
|
46
|
+
* tabs or pager pages. Each scrollable should also get its own `scrollId`.
|
|
32
47
|
*/
|
|
33
48
|
activeScrollId?: SharedValue<T>;
|
|
34
49
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
50
|
+
* Controls how `progress` behaves outside the `[0, threshold]` range.
|
|
51
|
+
*
|
|
52
|
+
* The default clamps the value between `0` and `1`. Relax this if you want
|
|
53
|
+
* to animate overscroll or other out-of-range states.
|
|
37
54
|
*
|
|
38
|
-
* You may want to modify it to achieve some animations for the overscroll scenarios.
|
|
39
55
|
* @default Extrapolation.CLAMP
|
|
40
56
|
*/
|
|
41
57
|
progressExtrapolation?: ExtrapolationType;
|
|
42
|
-
/**
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
enableHeaderPan?: boolean;
|
|
46
|
-
/** Child components that will have access to the header motion context */
|
|
58
|
+
/** Descendants that should participate in the shared header-motion state. */
|
|
47
59
|
children: ReactNode;
|
|
48
60
|
}
|
|
49
61
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
62
|
+
* Root provider for a header-motion setup.
|
|
63
|
+
*
|
|
64
|
+
* It tracks the measured header layout, the active scroll position, and the
|
|
65
|
+
* derived `progress` shared value consumed by your animated header UI.
|
|
66
|
+
*
|
|
52
67
|
* @template T - The type of scroll ID string
|
|
53
68
|
*/
|
|
54
|
-
declare function HeaderMotionContextProvider<T extends string>({ progressThreshold, measureDynamic, measureDynamicMode, activeScrollId, progressExtrapolation,
|
|
69
|
+
declare function HeaderMotionContextProvider<T extends string>({ progressThreshold, measureDynamic, measureDynamicMode, activeScrollId, progressExtrapolation, children, }: HeaderMotionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
55
70
|
export { HeaderMotionContextProvider };
|
|
56
71
|
//# sourceMappingURL=HeaderMotion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderMotion.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderMotion.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAEV,qBAAqB,EAErB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAkClB,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM;IACjD
|
|
1
|
+
{"version":3,"file":"HeaderMotion.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderMotion.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAEV,qBAAqB,EAErB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAkClB,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM;IACjD;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACxC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;IAC1C,6EAA6E;IAC7E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,iBAAS,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAAE,EACrD,iBAA8C,EAC9C,cAAwC,EACxC,kBAA4B,EAC5B,cAAc,EACd,qBAA2C,EAC3C,QAAQ,GACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAgItB;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { HeaderPanDecayConfig, HeaderMotionBridgeValue } from '../types';
|
|
3
|
+
type HeaderPanBoundaryProps = Pick<HeaderMotionBridgeValue, 'scrollToRef' | 'headerPanMomentumOffset'> & {
|
|
4
|
+
children: ReactElement;
|
|
5
|
+
pannable?: boolean;
|
|
6
|
+
panDecayConfig?: HeaderPanDecayConfig;
|
|
7
|
+
withGestureHandlerRootView?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function HeaderPanBoundary({ children, pannable, panDecayConfig, scrollToRef, headerPanMomentumOffset, withGestureHandlerRootView, }: HeaderPanBoundaryProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=HeaderPanBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderPanBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderPanBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAQnD,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAOlB,KAAK,sBAAsB,GAAG,IAAI,CAChC,uBAAuB,EACvB,aAAa,GAAG,yBAAyB,CAC1C,GAAG;IACF,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,QAAgB,EAChB,cAAc,EACd,WAAW,EACX,uBAAuB,EACvB,0BAAkC,GACnC,EAAE,sBAAsB,2CAsCxB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { HeaderMotionBridgeValue } from '../types';
|
|
3
|
+
export interface HeaderMotionNavigationBridgeProps {
|
|
4
|
+
/**
|
|
5
|
+
* Previously captured HeaderMotion context value to re-provide in another
|
|
6
|
+
* subtree.
|
|
7
|
+
*/
|
|
8
|
+
value: HeaderMotionBridgeValue;
|
|
9
|
+
/** Subtree that should regain access to HeaderMotion context. */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Re-provides HeaderMotion context in a different part of the React tree.
|
|
14
|
+
*
|
|
15
|
+
* This is primarily useful for navigation libraries that render headers outside
|
|
16
|
+
* the screen subtree where `HeaderMotion` itself lives.
|
|
17
|
+
*/
|
|
18
|
+
export declare function NavigationBridge({ value, children, }: HeaderMotionNavigationBridgeProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=NavigationBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationBridge.d.ts","sourceRoot":"","sources":["../../../../src/components/NavigationBridge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,iCAAiC;IAChD;;;OAGG;IACH,KAAK,EAAE,uBAAuB,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,GACT,EAAE,iCAAiC,2CAMnC"}
|
|
@@ -5,22 +5,26 @@ import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/c
|
|
|
5
5
|
type ScrollManagerRenderChildren<TRef extends InstanceOrElement = any> = (scrollableProps: ScrollManagerConfig<TRef>['scrollableProps'], options: ScrollManagerConfig<TRef>['headerMotionContext']) => ReactNode;
|
|
6
6
|
export interface HeaderMotionScrollManagerProps<TRef extends InstanceOrElement = any> extends UseScrollManagerOptions<TRef> {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Unique identifier for this scrollable in multi-scroll setups.
|
|
9
|
+
*
|
|
10
|
+
* Omit it for single-scroll screens.
|
|
10
11
|
*/
|
|
11
12
|
scrollId?: string;
|
|
12
13
|
/**
|
|
13
|
-
* Render function that receives
|
|
14
|
-
*
|
|
14
|
+
* Render function that receives:
|
|
15
|
+
* - the props to spread onto your scrollable
|
|
16
|
+
* - the layout values needed to offset content below the header
|
|
15
17
|
*/
|
|
16
18
|
children: ScrollManagerRenderChildren<TRef>;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
|
-
*
|
|
20
|
-
* Must be used within a HeaderMotion component.
|
|
21
|
+
* Render-prop wrapper around `useScrollManager()`.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* **Most code should prefer `createHeaderMotionScrollable()` instead.**
|
|
24
|
+
*
|
|
25
|
+
* Use `ScrollManager` only when the factory approach is not enough and you
|
|
26
|
+
* still need HeaderMotion to manage a custom scrollable through render-prop
|
|
27
|
+
* composition.
|
|
24
28
|
*
|
|
25
29
|
* @example
|
|
26
30
|
* ```tsx
|
|
@@ -37,6 +41,6 @@ export interface HeaderMotionScrollManagerProps<TRef extends InstanceOrElement =
|
|
|
37
41
|
* </HeaderMotion>
|
|
38
42
|
* ```
|
|
39
43
|
*/
|
|
40
|
-
export declare function
|
|
44
|
+
export declare function ScrollManager<TRef extends InstanceOrElement = any>({ children, scrollId, animatedRef, refreshControl, refreshing, onRefresh, progressViewOffset, onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd, }: HeaderMotionScrollManagerProps<TRef>): ReactNode;
|
|
41
45
|
export {};
|
|
42
46
|
//# sourceMappingURL=ScrollManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,KAAK,2BAA2B,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,IAAI,CACvE,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,EAC7D,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC,KACtD,SAAS,CAAC;AAEf,MAAM,WAAW,8BAA8B,CAC7C,IAAI,SAAS,iBAAiB,GAAG,GAAG,CACpC,SAAQ,uBAAuB,CAAC,IAAI,CAAC;IACrC
|
|
1
|
+
{"version":3,"file":"ScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,KAAK,2BAA2B,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,IAAI,CACvE,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,EAC7D,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC,KACtD,SAAS,CAAC;AAEf,MAAM,WAAW,8BAA8B,CAC7C,IAAI,SAAS,iBAAiB,GAAG,GAAG,CACpC,SAAQ,uBAAuB,CAAC,IAAI,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,2BAA2B,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,EAAE,EAClE,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GACpB,EAAE,8BAA8B,CAAC,IAAI,CAAC,aAwBtC"}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
scrollId?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Optional animated ref to use for the scroll view.
|
|
10
|
-
* When provided, the scroll manager will use this ref instead of creating its own.
|
|
11
|
-
*/
|
|
12
|
-
animatedRef?: AnimatedRef<Animated.ScrollView> | AnimatedRef;
|
|
13
|
-
};
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import Animated, { type AnimatedScrollViewProps } from 'react-native-reanimated';
|
|
3
|
+
import { type HeaderMotionScrollableOwnProps } from './createHeaderMotionScrollable';
|
|
4
|
+
export type HeaderMotionScrollViewProps = AnimatedScrollViewProps & HeaderMotionScrollableOwnProps<Animated.ScrollView>;
|
|
5
|
+
type HeaderMotionScrollViewComponent = (props: HeaderMotionScrollViewProps) => ReactElement | null;
|
|
14
6
|
/**
|
|
15
7
|
* Animated ScrollView component that integrates with HeaderMotion.
|
|
16
8
|
* Automatically handles scroll tracking and header animation synchronization.
|
|
@@ -25,5 +17,6 @@ export type HeaderMotionScrollViewProps = AnimatedScrollViewProps & {
|
|
|
25
17
|
* </HeaderMotion>
|
|
26
18
|
* ```
|
|
27
19
|
*/
|
|
28
|
-
export declare
|
|
20
|
+
export declare const ScrollView: HeaderMotionScrollViewComponent;
|
|
21
|
+
export {};
|
|
29
22
|
//# sourceMappingURL=ScrollView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,QAAQ,EAAE,EACf,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,2BAA2B,GAAG,uBAAuB,GAC/D,8BAA8B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAEtD,KAAK,+BAA+B,GAAG,CACrC,KAAK,EAAE,2BAA2B,KAC/B,YAAY,GAAG,IAAI,CAAC;AAEzB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,EAIjB,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type ReactElement, type Ref } from 'react';
|
|
2
|
+
import { type AnimatedProps, type AnimatedRef } from 'react-native-reanimated';
|
|
3
|
+
import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/commonTypes';
|
|
4
|
+
import type { HeaderMotionOffsetProps } from '../types';
|
|
5
|
+
export type HeaderMotionScrollableOwnProps<TRef extends InstanceOrElement = any> = HeaderMotionOffsetProps & {
|
|
6
|
+
/**
|
|
7
|
+
* Unique identifier for this scrollable when one header is shared across
|
|
8
|
+
* multiple scrollables.
|
|
9
|
+
*/
|
|
10
|
+
scrollId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Animated ref to reuse instead of letting HeaderMotion create one.
|
|
13
|
+
*/
|
|
14
|
+
animatedRef?: AnimatedRef<TRef> | AnimatedRef;
|
|
15
|
+
};
|
|
16
|
+
export interface CreateHeaderMotionScrollableOptions<TIsComponentAnimated extends boolean = boolean> {
|
|
17
|
+
displayName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* If true, this function will NOT call Animated.createAnimatedComponent internally.
|
|
20
|
+
* Useful when you are creating a HeaderMotionScrollable from lists that already export their
|
|
21
|
+
* own (Re)animated components (e.g. LegendList).
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
isComponentAnimated?: TIsComponentAnimated;
|
|
26
|
+
/**
|
|
27
|
+
* Controls how HeaderMotion injects content-container spacing.
|
|
28
|
+
*
|
|
29
|
+
* - `children`: wraps `children` in an inner `Animated.View`
|
|
30
|
+
* - `renderScrollComponent`: injects a custom scroll component that wraps the content
|
|
31
|
+
*
|
|
32
|
+
* Use `children` for ScrollView-like components. Use
|
|
33
|
+
* `renderScrollComponent` for FlatList-like components that own their
|
|
34
|
+
* internal scroll container.
|
|
35
|
+
*
|
|
36
|
+
* @default 'renderScrollComponent'
|
|
37
|
+
*/
|
|
38
|
+
contentContainerMode?: ContentContainerMode;
|
|
39
|
+
}
|
|
40
|
+
export declare function createHeaderMotionScrollable<TScrollableComponent extends ScrollableComponent, TIsComponentAnimated extends boolean = false>(ScrollableComponent: TScrollableComponent, options?: CreateHeaderMotionScrollableOptions<TIsComponentAnimated>): HeaderMotionScrollableComponent<TScrollableComponent, TIsComponentAnimated>;
|
|
41
|
+
type ContentContainerMode = 'children' | 'renderScrollComponent';
|
|
42
|
+
type ScrollableComponent = ((props: any) => ReactElement | null) | (new (...args: any[]) => any);
|
|
43
|
+
declare const noListItemSymbol: unique symbol;
|
|
44
|
+
type NoListItem = {
|
|
45
|
+
readonly [noListItemSymbol]: true;
|
|
46
|
+
};
|
|
47
|
+
type ScrollableComponentProps<TScrollableComponent> = TScrollableComponent extends new (props: infer TProps, ...args: any[]) => any ? TProps : TScrollableComponent extends (props: infer TProps, ...args: any[]) => any ? TProps : never;
|
|
48
|
+
type IsUnknown<TValue> = unknown extends TValue ? [keyof TValue] extends [never] ? true : false : false;
|
|
49
|
+
type ReplaceUnknownDeep<TValue, TReplacement> = IsUnknown<TValue> extends true ? TReplacement : TValue extends (...args: infer TArgs) => infer TResult ? (...args: {
|
|
50
|
+
[TIndex in keyof TArgs]: ReplaceUnknownDeep<TArgs[TIndex], TReplacement>;
|
|
51
|
+
}) => TResult : TValue extends readonly (infer TItem)[] ? readonly ReplaceUnknownDeep<TItem, TReplacement>[] : TValue extends object ? {
|
|
52
|
+
[TKey in keyof TValue]: ReplaceUnknownDeep<TValue[TKey], TReplacement>;
|
|
53
|
+
} : TValue;
|
|
54
|
+
type MaybeAnimatedProps<TProps extends object, TIsComponentAnimated> = TIsComponentAnimated extends true ? TProps : AnimatedProps<TProps>;
|
|
55
|
+
type ResolveListItemProps<TProps extends object, TListItem> = [
|
|
56
|
+
TListItem
|
|
57
|
+
] extends [NoListItem] ? TProps : ReplaceUnknownDeep<TProps, TListItem>;
|
|
58
|
+
type ExtractDataProp<TProps> = TProps extends {
|
|
59
|
+
data?: infer TData;
|
|
60
|
+
} ? TData : TProps extends {
|
|
61
|
+
data: infer TData;
|
|
62
|
+
} ? TData : never;
|
|
63
|
+
type ExtractListItemFromData<TData> = TData extends ReadonlyArray<infer TItem> | null | undefined ? TItem : TData extends ArrayLike<infer TItem> | null | undefined ? TItem : never;
|
|
64
|
+
type HasGenericDataProp<TProps> = IsUnknown<ExtractListItemFromData<ExtractDataProp<TProps>>>;
|
|
65
|
+
type ExtractRefTargetFromRef<TRef> = TRef extends Ref<infer TInstance> ? TInstance : TRef extends AnimatedRef<infer TInstance> ? TInstance : never;
|
|
66
|
+
type ExtractRefTargetFromProps<TProps> = TProps extends {
|
|
67
|
+
ref?: infer TRef;
|
|
68
|
+
} ? ExtractRefTargetFromRef<TRef> : TProps extends {
|
|
69
|
+
ref: infer TRef;
|
|
70
|
+
} ? ExtractRefTargetFromRef<TRef> : never;
|
|
71
|
+
type ResolveScrollableRefTarget<TScrollableComponent, TProps> = [
|
|
72
|
+
ExtractRefTargetFromProps<TProps>
|
|
73
|
+
] extends [never] ? TScrollableComponent extends new (...args: any[]) => infer TInstance ? TInstance extends InstanceOrElement ? TInstance : any : any : ExtractRefTargetFromProps<TProps> extends InstanceOrElement ? ExtractRefTargetFromProps<TProps> : any;
|
|
74
|
+
type HeaderMotionScrollableBaseProps<TScrollableComponent extends ScrollableComponent, TIsComponentAnimated extends boolean, TListItem = NoListItem> = ResolveListItemProps<MaybeAnimatedProps<ScrollableComponentProps<TScrollableComponent>, TIsComponentAnimated>, TListItem>;
|
|
75
|
+
type HeaderMotionScrollablePublicProps<TScrollableComponent extends ScrollableComponent, TIsComponentAnimated extends boolean, TListItem = NoListItem> = HeaderMotionScrollableBaseProps<TScrollableComponent, TIsComponentAnimated, TListItem> & HeaderMotionScrollableOwnProps<ResolveScrollableRefTarget<TScrollableComponent, HeaderMotionScrollableBaseProps<TScrollableComponent, TIsComponentAnimated, TListItem>>>;
|
|
76
|
+
type HeaderMotionGenericScrollableComponent<TScrollableComponent extends ScrollableComponent, TIsComponentAnimated extends boolean> = {
|
|
77
|
+
<TListItem = any>(props: HeaderMotionScrollablePublicProps<TScrollableComponent, TIsComponentAnimated, TListItem>): ReactElement | null;
|
|
78
|
+
displayName?: string;
|
|
79
|
+
};
|
|
80
|
+
type HeaderMotionStaticScrollableComponent<TScrollableComponent extends ScrollableComponent, TIsComponentAnimated extends boolean> = {
|
|
81
|
+
(props: HeaderMotionScrollablePublicProps<TScrollableComponent, TIsComponentAnimated>): ReactElement | null;
|
|
82
|
+
displayName?: string;
|
|
83
|
+
};
|
|
84
|
+
type HeaderMotionScrollableComponent<TScrollableComponent extends ScrollableComponent, TIsComponentAnimated extends boolean> = HasGenericDataProp<ScrollableComponentProps<TScrollableComponent>> extends true ? HeaderMotionGenericScrollableComponent<TScrollableComponent, TIsComponentAnimated> : HeaderMotionStaticScrollableComponent<TScrollableComponent, TIsComponentAnimated>;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=createHeaderMotionScrollable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHeaderMotionScrollable.d.ts","sourceRoot":"","sources":["../../../../src/components/createHeaderMotionScrollable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,YAAY,EAEjB,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAEf,OAAiB,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAGxD,MAAM,MAAM,8BAA8B,CACxC,IAAI,SAAS,iBAAiB,GAAG,GAAG,IAClC,uBAAuB,GAAG;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;CAC/C,CAAC;AAEF,MAAM,WAAW,mCAAmC,CAClD,oBAAoB,SAAS,OAAO,GAAG,OAAO;IAE9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAC3C;;;;;;;;;;;OAWG;IACH,oBAA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AAK,sCAAsC,CACzC,oBAAoB,SAAS,mBAAmB,EAChD,oBAAoB,SAAS,OAAO,IAClC;IACF,CAAC,SAAS,GAAG,GAAG,EACd,KAAK,EAAE,iCAAiC,CACtC,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,CACV,GACA,YAAY,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,qCAAqC,CACxC,oBAAoB,SAAS,mBAAmB,EAChD,oBAAoB,SAAS,OAAO,IAClC;IACF,CACE,KAAK,EAAE,iCAAiC,CACtC,oBAAoB,EACpB,oBAAoB,CACrB,GACA,YAAY,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,+BAA+B,CAClC,oBAAoB,SAAS,mBAAmB,EAChD,oBAAoB,SAAS,OAAO,IAClC,kBAAkB,CACpB,wBAAwB,CAAC,oBAAoB,CAAC,CAC/C,SAAS,IAAI,GACV,sCAAsC,CACpC,oBAAoB,EACpB,oBAAoB,CACrB,GACD,qCAAqC,CACnC,oBAAoB,EACpB,oBAAoB,CACrB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * from './Bridge';
|
|
1
2
|
export * from './FlatList';
|
|
2
3
|
export * from './Header';
|
|
3
|
-
export * from './
|
|
4
|
+
export * from './NavigationBridge';
|
|
4
5
|
export * from './HeaderMotion';
|
|
5
6
|
export * from './ScrollManager';
|
|
6
7
|
export * from './ScrollView';
|
|
8
|
+
export * from './createHeaderMotionScrollable';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC"}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
progress: Progress;
|
|
5
|
-
measureTotalHeight: MeasureAnimatedHeaderAndSet;
|
|
6
|
-
measureDynamic: MeasureAnimatedHeaderAndSet;
|
|
7
|
-
enableHeaderPan: boolean;
|
|
8
|
-
headerPanMomentumOffset: SharedValue<number | null>;
|
|
9
|
-
animatedHeaderBaseProps: AnimatedHeaderBaseMotionProps;
|
|
10
|
-
scrollValues: SharedValue<ScrollValues>;
|
|
11
|
-
activeScrollId: SharedValue<string> | undefined;
|
|
12
|
-
progressThreshold: SharedValue<number>;
|
|
13
|
-
originalHeaderHeight: SharedValue<number>;
|
|
14
|
-
scrollToRef: React.RefObject<ScrollTo | null>;
|
|
15
|
-
}
|
|
16
|
-
export declare const HeaderMotionContext: import("react").Context<HeaderMotionContextType | null>;
|
|
17
|
-
export {};
|
|
1
|
+
import type { HeaderMotionBridgeValue } from './types';
|
|
2
|
+
export declare const HeaderMotionContext: import("react").Context<HeaderMotionBridgeValue | null>;
|
|
3
|
+
export declare function useHeaderMotionContextOrThrow(errorMessage: string): HeaderMotionBridgeValue;
|
|
18
4
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,eAAO,MAAM,mBAAmB,yDACqB,CAAC;AAEtD,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,2BAOjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { ActiveScrollIdValues, SetActiveScrollId } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Keeps a React state value and a shared value in sync for the currently active
|
|
4
|
+
* scrollable.
|
|
5
5
|
*
|
|
6
|
-
* Use this when
|
|
7
|
-
*
|
|
6
|
+
* Use this when one header is shared across multiple scroll views, for example
|
|
7
|
+
* pager pages or tabs. Pass `values.sv` to `HeaderMotion` and use the setter
|
|
8
|
+
* whenever the active page changes.
|
|
8
9
|
*
|
|
9
10
|
* @template T - The type of the scroll ID string
|
|
10
11
|
* @param initialActiveScrollId - The initial active scroll ID
|
|
11
12
|
* @returns A tuple containing:
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
13
|
+
* - an object with both the React `state` and shared-value `sv`
|
|
14
|
+
* - a setter that updates both in lockstep
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
17
|
* ```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveScrollId.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useActiveScrollId.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"useActiveScrollId.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useActiveScrollId.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,qBAAqB,EAAE,CAAC,GACvB,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAuBjD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type AnimatedScrollViewProps, type ScrollHandler, type ScrollHandlerProcessed } from 'react-native-reanimated';
|
|
2
|
+
import type { ScrollHandlerContext } from '../types';
|
|
3
|
+
type AnimatedScrollViewOnScroll = AnimatedScrollViewProps['onScroll'];
|
|
4
|
+
type ScrollEvent = Parameters<ScrollHandler<Record<string, unknown>>>[0];
|
|
5
|
+
export type ConsumerScrollEventHandlers = Pick<AnimatedScrollViewProps, 'onScroll' | 'onScrollBeginDrag' | 'onScrollEndDrag' | 'onMomentumScrollBegin' | 'onMomentumScrollEnd'>;
|
|
6
|
+
export interface ConsumerScrollBridges {
|
|
7
|
+
onScroll?: (event: ScrollEvent) => void;
|
|
8
|
+
onBeginDrag?: (event: ScrollEvent) => void;
|
|
9
|
+
onEndDrag?: (event: ScrollEvent) => void;
|
|
10
|
+
onMomentumBegin?: (event: ScrollEvent) => void;
|
|
11
|
+
onMomentumEnd?: (event: ScrollEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function useConsumerScrollHandlers({ onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd, }: ConsumerScrollEventHandlers): ConsumerScrollBridges;
|
|
14
|
+
export declare function useScrollHandlerComposition(ownScrollHandler: ScrollHandlerProcessed<ScrollHandlerContext>, consumerScrollHandler: AnimatedScrollViewOnScroll | undefined): (event: Readonly<{
|
|
15
|
+
bubbles: boolean | undefined;
|
|
16
|
+
cancelable: boolean | undefined;
|
|
17
|
+
currentTarget: number | import("react-native").HostInstance;
|
|
18
|
+
defaultPrevented: boolean | undefined;
|
|
19
|
+
dispatchConfig: Readonly<{
|
|
20
|
+
registrationName: string;
|
|
21
|
+
}>;
|
|
22
|
+
eventPhase: number | undefined;
|
|
23
|
+
preventDefault: () => void;
|
|
24
|
+
isDefaultPrevented: () => boolean;
|
|
25
|
+
stopPropagation: () => void;
|
|
26
|
+
isPropagationStopped: () => boolean;
|
|
27
|
+
isTrusted: boolean | undefined;
|
|
28
|
+
nativeEvent: Readonly<{
|
|
29
|
+
contentInset: Readonly<{
|
|
30
|
+
bottom: number;
|
|
31
|
+
left: number;
|
|
32
|
+
right: number;
|
|
33
|
+
top: number;
|
|
34
|
+
}>;
|
|
35
|
+
contentOffset: Readonly<{
|
|
36
|
+
y: number;
|
|
37
|
+
x: number;
|
|
38
|
+
}>;
|
|
39
|
+
contentSize: Readonly<{
|
|
40
|
+
height: number;
|
|
41
|
+
width: number;
|
|
42
|
+
}>;
|
|
43
|
+
layoutMeasurement: Readonly<{
|
|
44
|
+
height: number;
|
|
45
|
+
width: number;
|
|
46
|
+
}>;
|
|
47
|
+
velocity?: Readonly<{
|
|
48
|
+
y: number;
|
|
49
|
+
x: number;
|
|
50
|
+
}>;
|
|
51
|
+
zoomScale?: number;
|
|
52
|
+
responderIgnoreScroll?: boolean;
|
|
53
|
+
targetContentOffset?: Readonly<{
|
|
54
|
+
y: number;
|
|
55
|
+
x: number;
|
|
56
|
+
}>;
|
|
57
|
+
}>;
|
|
58
|
+
persist: () => void;
|
|
59
|
+
target: (number | undefined) | import("react-native").HostInstance;
|
|
60
|
+
timeStamp: number;
|
|
61
|
+
type: string | undefined;
|
|
62
|
+
}>, context?: ScrollHandlerContext | undefined) => void;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=useConsumerScrollHandlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConsumerScrollHandlers.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useConsumerScrollHandlers.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGrD,KAAK,0BAA0B,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;AACtE,KAAK,WAAW,GAAG,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,uBAAuB,EACrB,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,uBAAuB,GACvB,qBAAqB,CACxB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GACpB,EAAE,2BAA2B,GAAG,qBAAqB,CA0FrD;AAED,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,sBAAsB,CAAC,oBAAoB,C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