react-native-header-motion 0.4.0 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +400 -335
  2. package/lib/module/components/Bridge.js +16 -0
  3. package/lib/module/components/Bridge.js.map +1 -0
  4. package/lib/module/components/FlatList.js +5 -62
  5. package/lib/module/components/FlatList.js.map +1 -1
  6. package/lib/module/components/Header.js +71 -13
  7. package/lib/module/components/Header.js.map +1 -1
  8. package/lib/module/components/HeaderDynamic.js +34 -0
  9. package/lib/module/components/HeaderDynamic.js.map +1 -0
  10. package/lib/module/components/HeaderMotion.js +59 -23
  11. package/lib/module/components/HeaderMotion.js.map +1 -1
  12. package/lib/module/components/HeaderPanBoundary.js +54 -0
  13. package/lib/module/components/HeaderPanBoundary.js.map +1 -0
  14. package/lib/module/components/NavigationBridge.js +20 -0
  15. package/lib/module/components/NavigationBridge.js.map +1 -0
  16. package/lib/module/components/ScrollManager.js +7 -5
  17. package/lib/module/components/ScrollManager.js.map +1 -1
  18. package/lib/module/components/ScrollView.js +6 -47
  19. package/lib/module/components/ScrollView.js.map +1 -1
  20. package/lib/module/components/createHeaderMotionScrollable.js +136 -0
  21. package/lib/module/components/createHeaderMotionScrollable.js.map +1 -0
  22. package/lib/module/components/index.js +3 -1
  23. package/lib/module/components/index.js.map +1 -1
  24. package/lib/module/context.js +8 -1
  25. package/lib/module/context.js.map +1 -1
  26. package/lib/module/hooks/index.js +1 -0
  27. package/lib/module/hooks/index.js.map +1 -1
  28. package/lib/module/hooks/useActiveScrollId.js +7 -6
  29. package/lib/module/hooks/useActiveScrollId.js.map +1 -1
  30. package/lib/module/hooks/useHeaderMotionBridge.js +14 -0
  31. package/lib/module/hooks/useHeaderMotionBridge.js.map +1 -0
  32. package/lib/module/hooks/useMotionProgress.js +10 -36
  33. package/lib/module/hooks/useMotionProgress.js.map +1 -1
  34. package/lib/module/hooks/useMotionProgress.test.js +56 -0
  35. package/lib/module/hooks/useMotionProgress.test.js.map +1 -0
  36. package/lib/module/hooks/useScrollManager.js +219 -109
  37. package/lib/module/hooks/useScrollManager.js.map +1 -1
  38. package/lib/module/index.js +21 -18
  39. package/lib/module/index.js.map +1 -1
  40. package/lib/module/utils/defaults.js +2 -1
  41. package/lib/module/utils/defaults.js.map +1 -1
  42. package/lib/module/utils/header.js +24 -0
  43. package/lib/module/utils/header.js.map +1 -0
  44. package/lib/module/utils/headerOffsetStyle.js +31 -0
  45. package/lib/module/utils/headerOffsetStyle.js.map +1 -0
  46. package/lib/module/utils/index.js +3 -0
  47. package/lib/module/utils/index.js.map +1 -1
  48. package/lib/module/utils/refreshControl.js +93 -0
  49. package/lib/module/utils/refreshControl.js.map +1 -0
  50. package/lib/module/utils/values.js +36 -0
  51. package/lib/module/utils/values.js.map +1 -1
  52. package/lib/typescript/src/components/Bridge.d.ts +19 -0
  53. package/lib/typescript/src/components/Bridge.d.ts.map +1 -0
  54. package/lib/typescript/src/components/FlatList.d.ts +7 -15
  55. package/lib/typescript/src/components/FlatList.d.ts.map +1 -1
  56. package/lib/typescript/src/components/Header.d.ts +73 -12
  57. package/lib/typescript/src/components/Header.d.ts.map +1 -1
  58. package/lib/typescript/src/components/HeaderDynamic.d.ts +11 -0
  59. package/lib/typescript/src/components/HeaderDynamic.d.ts.map +1 -0
  60. package/lib/typescript/src/components/HeaderMotion.d.ts +37 -18
  61. package/lib/typescript/src/components/HeaderMotion.d.ts.map +1 -1
  62. package/lib/typescript/src/components/HeaderPanBoundary.d.ts +11 -0
  63. package/lib/typescript/src/components/HeaderPanBoundary.d.ts.map +1 -0
  64. package/lib/typescript/src/components/NavigationBridge.d.ts +19 -0
  65. package/lib/typescript/src/components/NavigationBridge.d.ts.map +1 -0
  66. package/lib/typescript/src/components/ScrollManager.d.ts +18 -25
  67. package/lib/typescript/src/components/ScrollManager.d.ts.map +1 -1
  68. package/lib/typescript/src/components/ScrollView.d.ts +7 -14
  69. package/lib/typescript/src/components/ScrollView.d.ts.map +1 -1
  70. package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts +86 -0
  71. package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts.map +1 -0
  72. package/lib/typescript/src/components/index.d.ts +3 -1
  73. package/lib/typescript/src/components/index.d.ts.map +1 -1
  74. package/lib/typescript/src/context.d.ts +3 -13
  75. package/lib/typescript/src/context.d.ts.map +1 -1
  76. package/lib/typescript/src/hooks/index.d.ts +1 -0
  77. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  78. package/lib/typescript/src/hooks/useActiveScrollId.d.ts +7 -6
  79. package/lib/typescript/src/hooks/useActiveScrollId.d.ts.map +1 -1
  80. package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts +10 -0
  81. package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts.map +1 -0
  82. package/lib/typescript/src/hooks/useMotionProgress.d.ts +8 -25
  83. package/lib/typescript/src/hooks/useMotionProgress.d.ts.map +1 -1
  84. package/lib/typescript/src/hooks/useMotionProgress.test.d.ts +2 -0
  85. package/lib/typescript/src/hooks/useMotionProgress.test.d.ts.map +1 -0
  86. package/lib/typescript/src/hooks/useScrollManager.d.ts +63 -31
  87. package/lib/typescript/src/hooks/useScrollManager.d.ts.map +1 -1
  88. package/lib/typescript/src/index.d.ts +56 -26
  89. package/lib/typescript/src/index.d.ts.map +1 -1
  90. package/lib/typescript/src/types.d.ts +63 -15
  91. package/lib/typescript/src/types.d.ts.map +1 -1
  92. package/lib/typescript/src/utils/defaults.d.ts +3 -2
  93. package/lib/typescript/src/utils/defaults.d.ts.map +1 -1
  94. package/lib/typescript/src/utils/header.d.ts +10 -0
  95. package/lib/typescript/src/utils/header.d.ts.map +1 -0
  96. package/lib/typescript/src/utils/headerOffsetStyle.d.ts +19 -0
  97. package/lib/typescript/src/utils/headerOffsetStyle.d.ts.map +1 -0
  98. package/lib/typescript/src/utils/index.d.ts +3 -0
  99. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  100. package/lib/typescript/src/utils/refreshControl.d.ts +150 -0
  101. package/lib/typescript/src/utils/refreshControl.d.ts.map +1 -0
  102. package/lib/typescript/src/utils/values.d.ts +4 -1
  103. package/lib/typescript/src/utils/values.d.ts.map +1 -1
  104. package/package.json +13 -5
  105. package/src/components/Bridge.tsx +29 -0
  106. package/src/components/FlatList.tsx +18 -84
  107. package/src/components/Header.tsx +159 -23
  108. package/src/components/HeaderDynamic.tsx +45 -0
  109. package/src/components/HeaderMotion.tsx +114 -41
  110. package/src/components/HeaderPanBoundary.tsx +92 -0
  111. package/src/components/NavigationBridge.tsx +30 -0
  112. package/src/components/ScrollManager.tsx +38 -43
  113. package/src/components/ScrollView.tsx +16 -68
  114. package/src/components/createHeaderMotionScrollable.tsx +438 -0
  115. package/src/components/index.ts +3 -1
  116. package/src/context.ts +12 -18
  117. package/src/hooks/index.ts +1 -0
  118. package/src/hooks/useActiveScrollId.ts +7 -6
  119. package/src/hooks/useHeaderMotionBridge.ts +15 -0
  120. package/src/hooks/useMotionProgress.test.ts +67 -0
  121. package/src/hooks/useMotionProgress.ts +12 -37
  122. package/src/hooks/useScrollManager.ts +310 -129
  123. package/src/index.ts +82 -36
  124. package/src/types.ts +85 -25
  125. package/src/utils/defaults.ts +7 -1
  126. package/src/utils/header.tsx +52 -0
  127. package/src/utils/headerOffsetStyle.ts +40 -0
  128. package/src/utils/index.ts +3 -0
  129. package/src/utils/refreshControl.tsx +118 -0
  130. package/src/utils/values.ts +57 -1
  131. package/lib/module/components/HeaderBase.js +0 -59
  132. package/lib/module/components/HeaderBase.js.map +0 -1
  133. package/lib/module/hooks/refreshControl.js +0 -31
  134. package/lib/module/hooks/refreshControl.js.map +0 -1
  135. package/lib/typescript/src/components/HeaderBase.d.ts +0 -34
  136. package/lib/typescript/src/components/HeaderBase.d.ts.map +0 -1
  137. package/lib/typescript/src/hooks/refreshControl.d.ts +0 -13
  138. package/lib/typescript/src/hooks/refreshControl.d.ts.map +0 -1
  139. package/src/components/HeaderBase.tsx +0 -51
  140. package/src/hooks/refreshControl.ts +0 -55
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ import { cloneElement, createElement, isValidElement } from 'react';
4
+ import { RefreshControl } from 'react-native';
5
+ import Animated, { useAnimatedProps } from 'react-native-reanimated';
6
+
7
+ // FIXME: Types are a mess here
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl);
10
+ export function resolveRefreshControl({
11
+ refreshControl,
12
+ refreshing,
13
+ onRefresh,
14
+ progressViewOffset
15
+ }) {
16
+ if (!refreshControl) {
17
+ return createRefreshControlWithOffset({
18
+ refreshing,
19
+ onRefresh,
20
+ progressViewOffset
21
+ });
22
+ }
23
+ return /*#__PURE__*/isValidElement(refreshControl) ? injectProgressViewOffset(refreshControl, progressViewOffset) : undefined;
24
+ }
25
+ function createRefreshControlWithOffset({
26
+ refreshing,
27
+ onRefresh,
28
+ progressViewOffset
29
+ }) {
30
+ if (!onRefresh) {
31
+ return undefined;
32
+ }
33
+ return /*#__PURE__*/createElement(ResolvedRefreshControl, {
34
+ refreshing: refreshing ?? false,
35
+ onRefresh: onRefresh,
36
+ progressViewOffset: progressViewOffset
37
+ });
38
+ }
39
+ function injectProgressViewOffset(refreshControl, progressViewOffset) {
40
+ const offset = refreshControl.props.progressViewOffset ?? progressViewOffset;
41
+ if (!isSharedValue(offset)) {
42
+ return /*#__PURE__*/cloneElement(refreshControl, {
43
+ progressViewOffset: offset
44
+ });
45
+ }
46
+ return /*#__PURE__*/createElement(ResolvedRefreshControl, {
47
+ ...refreshControl.props,
48
+ progressViewOffset: progressViewOffset
49
+ });
50
+ }
51
+ function ResolvedRefreshControl({
52
+ refreshing,
53
+ onRefresh,
54
+ progressViewOffset,
55
+ ...props
56
+ }) {
57
+ const animatedProps = useAnimatedProps(() => {
58
+ return {
59
+ ...(isSharedValue(refreshing) ? {
60
+ refreshing: refreshing.value
61
+ } : {}),
62
+ ...(isSharedValue(onRefresh) ? {
63
+ onRefresh: onRefresh.value
64
+ } : {}),
65
+ ...(isSharedValue(progressViewOffset) ? {
66
+ progressViewOffset: progressViewOffset.value
67
+ } : {})
68
+ };
69
+ });
70
+ const nonAnimatedProps = {
71
+ ...(isSharedValue(refreshing) ? {} : {
72
+ refreshing
73
+ }),
74
+ ...(isSharedValue(onRefresh) ? {} : {
75
+ onRefresh
76
+ }),
77
+ ...(isSharedValue(progressViewOffset) ? {} : {
78
+ progressViewOffset
79
+ })
80
+ };
81
+ return /*#__PURE__*/_jsx(AnimatedRefreshControl, {
82
+ ...props,
83
+ ...nonAnimatedProps,
84
+ refreshing: nonAnimatedProps.refreshing,
85
+ animatedProps: animatedProps
86
+ });
87
+ }
88
+ function isSharedValue(value) {
89
+ 'worklet';
90
+
91
+ return typeof value === 'object' && value !== null && 'value' in value;
92
+ }
93
+ //# sourceMappingURL=refreshControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cloneElement","createElement","isValidElement","RefreshControl","Animated","useAnimatedProps","jsx","_jsx","AnimatedRefreshControl","createAnimatedComponent","resolveRefreshControl","refreshControl","refreshing","onRefresh","progressViewOffset","createRefreshControlWithOffset","injectProgressViewOffset","undefined","ResolvedRefreshControl","offset","props","isSharedValue","animatedProps","value","nonAnimatedProps"],"sourceRoot":"../../../src","sources":["utils/refreshControl.tsx"],"mappings":"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","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import { DEFAULT_SCROLL_ID } from "./defaults.js";
3
4
  export function getInitialScrollValue() {
4
5
  'worklet';
5
6
 
@@ -8,4 +9,39 @@ export function getInitialScrollValue() {
8
9
  current: 0
9
10
  };
10
11
  }
12
+ export function ensureScrollValueRegistered(scrollValues, id) {
13
+ 'worklet';
14
+
15
+ const values = scrollValues.get();
16
+ if (values[id]) {
17
+ return values;
18
+ }
19
+ scrollValues.modify(value => {
20
+ if (!value[id]) {
21
+ value[id] = getInitialScrollValue();
22
+ }
23
+ return value;
24
+ });
25
+ return scrollValues.get();
26
+ }
27
+ export function warnIfMissingActiveScrollId(scrollValues, id, activeScrollId) {
28
+ 'worklet';
29
+
30
+ if (!__DEV__ || activeScrollId || id === DEFAULT_SCROLL_ID) {
31
+ return;
32
+ }
33
+ let nonDefaultCount = 0;
34
+ let nonDefaultIds = '';
35
+ for (const key in scrollValues) {
36
+ if (key === DEFAULT_SCROLL_ID) {
37
+ continue;
38
+ }
39
+ nonDefaultCount += 1;
40
+ nonDefaultIds = nonDefaultIds ? `${nonDefaultIds}, ${key}` : key;
41
+ }
42
+ if (nonDefaultCount < 1) {
43
+ return;
44
+ }
45
+ console.warn(`[react-native-header-motion] Explicit scrollIds (${nonDefaultIds}) are registered but no activeScrollId was provided. Pass useActiveScrollId(...).sv to <HeaderMotion activeScrollId={...}> to keep header motion deterministic.`);
46
+ }
11
47
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getInitialScrollValue","min","current"],"sourceRoot":"../../../src","sources":["utils/values.ts"],"mappings":";;AAEA,OAAO,SAASA,qBAAqBA,CAAA,EAAgB;EACnD,SAAS;;EACT,OAAO;IAAEC,GAAG,EAAE,CAAC;IAAEC,OAAO,EAAE;EAAE,CAAC;AAC/B","ignoreList":[]}
1
+ {"version":3,"names":["DEFAULT_SCROLL_ID","getInitialScrollValue","min","current","ensureScrollValueRegistered","scrollValues","id","values","get","modify","value","warnIfMissingActiveScrollId","activeScrollId","__DEV__","nonDefaultCount","nonDefaultIds","key","console","warn"],"sourceRoot":"../../../src","sources":["utils/values.ts"],"mappings":";;AAEA,SAASA,iBAAiB,QAAQ,eAAY;AAE9C,OAAO,SAASC,qBAAqBA,CAAA,EAAgB;EACnD,SAAS;;EACT,OAAO;IAAEC,GAAG,EAAE,CAAC;IAAEC,OAAO,EAAE;EAAE,CAAC;AAC/B;AAEA,OAAO,SAASC,2BAA2BA,CACzCC,YAAuC,EACvCC,EAAU,EACI;EACd,SAAS;;EAET,MAAMC,MAAM,GAAGF,YAAY,CAACG,GAAG,CAAC,CAAC;EACjC,IAAID,MAAM,CAACD,EAAE,CAAC,EAAE;IACd,OAAOC,MAAM;EACf;EAEAF,YAAY,CAACI,MAAM,CAAEC,KAAK,IAAK;IAC7B,IAAI,CAACA,KAAK,CAACJ,EAAE,CAAC,EAAE;MACbI,KAAK,CAAkBJ,EAAE,CAAC,GAAGL,qBAAqB,CAAC,CAAC;IACvD;IAEA,OAAOS,KAAK;EACd,CAAC,CAAC;EAEF,OAAOL,YAAY,CAACG,GAAG,CAAC,CAAC;AAC3B;AAEA,OAAO,SAASG,2BAA2BA,CACzCN,YAA0B,EAC1BC,EAAU,EACVM,cAAkC,EAC5B;EACN,SAAS;;EAET,IAAI,CAACC,OAAO,IAAID,cAAc,IAAIN,EAAE,KAAKN,iBAAiB,EAAE;IAC1D;EACF;EAEA,IAAIc,eAAe,GAAG,CAAC;EACvB,IAAIC,aAAa,GAAG,EAAE;EAEtB,KAAK,MAAMC,GAAG,IAAIX,YAAY,EAAE;IAC9B,IAAIW,GAAG,KAAKhB,iBAAiB,EAAE;MAC7B;IACF;IAEAc,eAAe,IAAI,CAAC;IACpBC,aAAa,GAAGA,aAAa,GAAG,GAAGA,aAAa,KAAKC,GAAG,EAAE,GAAGA,GAAG;EAClE;EAEA,IAAIF,eAAe,GAAG,CAAC,EAAE;IACvB;EACF;EAEAG,OAAO,CAACC,IAAI,CACV,oDAAoDH,aAAa,iKACnE,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { HeaderMotionBridgeValue } from '../types';
3
+ type HeaderRenderChildren = (value: HeaderMotionBridgeValue) => ReactNode;
4
+ export interface HeaderMotionBridgeProps {
5
+ /**
6
+ * Render function that receives the current HeaderMotion context value.
7
+ *
8
+ * Use this when you need to pass the library's context across a React tree
9
+ * boundary, most commonly into a navigation-rendered header.
10
+ */
11
+ children: HeaderRenderChildren;
12
+ }
13
+ /**
14
+ * Reads the current HeaderMotion context and exposes it through a render
15
+ * function so it can be forwarded into another subtree.
16
+ */
17
+ export declare function Bridge({ children }: HeaderMotionBridgeProps): ReactNode;
18
+ export {};
19
+ //# sourceMappingURL=Bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bridge.d.ts","sourceRoot":"","sources":["../../../../src/components/Bridge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;AAE1E,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,aAQ3D"}
@@ -1,17 +1,8 @@
1
- import { type ComponentProps } from 'react';
2
- import Animated, { type AnimatedRef } from 'react-native-reanimated';
3
- export type HeaderMotionFlatListProps<T = any> = ComponentProps<typeof Animated.FlatList<T>> & {
4
- /**
5
- * Optional unique identifier for this scroll view.
6
- * Use this when you have multiple scroll views (e.g. in tabs) to track them separately.
7
- */
8
- scrollId?: string;
9
- /**
10
- * Optional animated ref to use for the flat list.
11
- * When provided, the scroll manager will use this ref instead of creating its own.
12
- */
13
- animatedRef?: AnimatedRef<any>;
14
- };
1
+ import type { ReactElement } from 'react';
2
+ import Animated, { type FlatListPropsWithLayout } from 'react-native-reanimated';
3
+ import { type HeaderMotionScrollableOwnProps } from './createHeaderMotionScrollable';
4
+ export type HeaderMotionFlatListProps<T = any> = FlatListPropsWithLayout<T> & HeaderMotionScrollableOwnProps<Animated.FlatList<T>>;
5
+ type FlatListComponent = <T = any>(props: HeaderMotionFlatListProps<T>) => ReactElement | null;
15
6
  /**
16
7
  * Animated FlatList component that integrates with HeaderMotion.
17
8
  * Automatically handles scroll tracking and header animation synchronization.
@@ -29,5 +20,6 @@ export type HeaderMotionFlatListProps<T = any> = ComponentProps<typeof Animated.
29
20
  * </HeaderMotion>
30
21
  * ```
31
22
  */
32
- export declare function HeaderMotionFlatList<T = any>({ scrollId, animatedRef, contentContainerStyle, onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd, ...props }: HeaderMotionFlatListProps<T>): import("react/jsx-runtime").JSX.Element;
23
+ export declare const FlatList: FlatListComponent;
24
+ export {};
33
25
  //# sourceMappingURL=FlatList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/FlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAqB,MAAM,OAAO,CAAC;AAC3E,OAAO,QAAQ,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKrE,MAAM,MAAM,yBAAyB,CAAC,CAAC,GAAG,GAAG,IAAI,cAAc,CAC7D,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC5B,GAAG;IACF;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAAE,EAC5C,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,GAAG,KAAK,EACT,EAAE,yBAAyB,CAAC,CAAC,CAAC,2CA4C9B"}
1
+ {"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/FlatList.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,yBAAyB,CAAC,CAAC,GAAG,GAAG,IAAI,uBAAuB,CAAC,CAAC,CAAC,GACzE,8BAA8B,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvD,KAAK,iBAAiB,GAAG,CAAC,CAAC,GAAG,GAAG,EAC/B,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC,KAChC,YAAY,GAAG,IAAI,CAAC;AAEzB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,EAIf,iBAAiB,CAAC"}
@@ -1,19 +1,80 @@
1
- import type { MotionProgress } from '../types';
2
- import type { ReactNode } from 'react';
3
- type HeaderRenderChildren = (props: MotionProgress) => ReactNode;
4
- export interface HeaderMotionHeaderProps {
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
- * Render function that receives motion progress props.
7
- * Use this to animate your header based on scroll progress and to provide measurement functions to the elements of the header.
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
- children: HeaderRenderChildren;
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 component for providing motion progress properties to animated headers.
13
- * Must be used within a HeaderMotion component.
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
- * Use to pass props to the header components in React Navigation / Expo Router, which cannot access HeaderMotion's context and `useMotionProgress` otherwise.`
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 function HeaderMotionHeader({ children }: HeaderMotionHeaderProps): ReactNode;
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":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,SAAS,CAAC;AAEjE,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,aASvE"}
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,48 +3,67 @@ import type { ReactNode } from 'react';
3
3
  import type { MeasureAnimatedHeader, ProgressThreshold } from '../types';
4
4
  export interface HeaderMotionProps<T extends string> {
5
5
  /**
6
- * The threshold at which the header animation completes (reaches progress = 1).
7
- * Can be a fixed number or a function that calculates based on the result of {@link measureDynamic}.
6
+ * Distance that maps the active scrollable from `progress = 0`
7
+ * to `progress = 1`.
8
8
  *
9
- * Defaults to a function that returns the return value of `measureDynamic` unchanged.
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
- * Function to measure a dimension of choice of the animated element of the header.
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 function can be further accessed when rendering headers from `HeaderMotion.Header` or `useMotionProgress` - should be passed to the `onLayout` prop of such. If used, can be used for dynamic calculation of the {@link progressThreshold}.
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
- * Defaults to measuring the height from the event.
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
- * Mode for measuring dynamic header height.
29
+ * Controls when `measureDynamic` is allowed to update.
30
+ *
24
31
  * - 'mount': Only measure once on mount
25
- * - 'update': Update measurement on every layout recalculation of the component that {@link measureDynamic} was provided to as the `onLayout` property
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 for tracking the active scroll ID in multi-scroll scenarios (e.g. tabs).
31
- * When provided, the header animation will sync across multiple scroll views.
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
- * Extrapolation type for the progress animation.
36
- * Controls how the progress value behaves outside the threshold range.
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
- /** Child components that will have access to the header motion context */
58
+ /** Descendants that should participate in the shared header-motion state. */
43
59
  children: ReactNode;
44
60
  }
45
61
  /**
46
- * Context provider component for HeaderMotion.
47
- * Manages header animation state and provides it to child components via context.
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
+ *
48
67
  * @template T - The type of scroll ID string
49
68
  */
50
69
  declare function HeaderMotionContextProvider<T extends string>({ progressThreshold, measureDynamic, measureDynamicMode, activeScrollId, progressExtrapolation, children, }: HeaderMotionProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -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,EACV,qBAAqB,EAErB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAQlB,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM;IACjD;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;IAC1C,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;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,2CAqGtB;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
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"}
@@ -1,37 +1,30 @@
1
+ import { type UseScrollManagerOptions } from '../hooks';
1
2
  import type { ScrollManagerConfig } from '../types';
2
- import type { ResolveRefreshControlOptions } from '../hooks/refreshControl';
3
3
  import type { ReactNode } from 'react';
4
- import type { AnimatedRef } from 'react-native-reanimated';
5
- import type { ConsumerScrollEventHandlers } from '../hooks/useConsumerScrollHandlers';
6
- type ScrollManagerRenderChildren = (scrollableProps: ScrollManagerConfig['scrollableProps'], options: ScrollManagerConfig['headerMotionContext']) => ReactNode;
7
- export interface HeaderMotionScrollManagerProps extends Omit<ResolveRefreshControlOptions, 'progressViewOffset'>, ConsumerScrollEventHandlers {
4
+ import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/commonTypes';
5
+ type ScrollManagerRenderChildren<TRef extends InstanceOrElement = any> = (scrollableProps: ScrollManagerConfig<TRef>['scrollableProps'], options: ScrollManagerConfig<TRef>['headerMotionContext']) => ReactNode;
6
+ export interface HeaderMotionScrollManagerProps<TRef extends InstanceOrElement = any> extends UseScrollManagerOptions<TRef> {
8
7
  /**
9
- * Optional unique identifier for this scroll view.
10
- * Use this when you have multiple scroll views (e.g., in tabs) to track them separately.
8
+ * Unique identifier for this scrollable in multi-scroll setups.
9
+ *
10
+ * Omit it for single-scroll screens.
11
11
  */
12
12
  scrollId?: string;
13
13
  /**
14
- * Optional animated ref to use for the scroll view.
15
- * When provided, the scroll manager will use this ref instead of creating its own.
14
+ * Render function that receives:
15
+ * - the props to spread onto your scrollable
16
+ * - the layout values needed to offset content below the header
16
17
  */
17
- animatedRef?: AnimatedRef<any>;
18
- /**
19
- * Optional refresh progress offset override.
20
- * When provided, it takes precedence over the automatic offset based on header height.
21
- */
22
- progressViewOffset?: ResolveRefreshControlOptions['progressViewOffset'];
23
- /**
24
- * Render function that receives scroll props and header context.
25
- * Use this to create custom scroll implementations that integrate with HeaderMotion.
26
- */
27
- children: ScrollManagerRenderChildren;
18
+ children: ScrollManagerRenderChildren<TRef>;
28
19
  }
29
20
  /**
30
- * ScrollManager component that provides scroll tracking functionality for custom scroll implementations. Uses {@link useScrollManager} under the hood.
31
- * Must be used within a HeaderMotion component.
21
+ * Render-prop wrapper around `useScrollManager()`.
22
+ *
23
+ * **Most code should prefer `createHeaderMotionScrollable()` instead.**
32
24
  *
33
- * This is useful when you need to use a scroll component that isn't directly supported
34
- * (like a custom scroll view or third-party list components).
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.
35
28
  *
36
29
  * @example
37
30
  * ```tsx
@@ -48,6 +41,6 @@ export interface HeaderMotionScrollManagerProps extends Omit<ResolveRefreshContr
48
41
  * </HeaderMotion>
49
42
  * ```
50
43
  */
51
- export declare function HeaderMotionScrollManager({ children, scrollId, animatedRef, refreshControl, refreshing, onRefresh, progressViewOffset, onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd, }: HeaderMotionScrollManagerProps): ReactNode;
44
+ export declare function ScrollManager<TRef extends InstanceOrElement = any>({ children, scrollId, animatedRef, refreshControl, refreshing, onRefresh, progressViewOffset, onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd, }: HeaderMotionScrollManagerProps<TRef>): ReactNode;
52
45
  export {};
53
46
  //# sourceMappingURL=ScrollManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollManager.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEtF,KAAK,2BAA2B,GAAG,CACjC,eAAe,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,EACvD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,KAChD,SAAS,CAAC;AAEf,MAAM,WAAW,8BACf,SAAQ,IAAI,CAAC,4BAA4B,EAAE,oBAAoB,CAAC,EAC9D,2BAA2B;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,oBAAoB,CAAC,CAAC;IACxE;;;OAGG;IACH,QAAQ,EAAE,2BAA2B,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,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,aAqBhC"}
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 { type AnimatedRef, type AnimatedScrollViewProps } from 'react-native-reanimated';
2
- export type HeaderMotionScrollViewProps = AnimatedScrollViewProps & {
3
- /**
4
- * Optional unique identifier for this scroll view.
5
- * Use this when you have multiple scroll views (e.g. in tabs) to track them separately.
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<any>;
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 function HeaderMotionScrollView({ scrollId, animatedRef, children, contentContainerStyle, refreshControl, onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd, ...props }: HeaderMotionScrollViewProps): import("react/jsx-runtime").JSX.Element;
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,OAAiB,EACf,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,2BAA2B,GAAG,uBAAuB,GAAG;IAClE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,GAAG,KAAK,EACT,EAAE,2BAA2B,2CAyC7B"}
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"}