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.
Files changed (137) hide show
  1. package/README.md +65 -528
  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 -54
  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 +14 -20
  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 +19 -7
  17. package/lib/module/components/ScrollManager.js.map +1 -1
  18. package/lib/module/components/ScrollView.js +6 -39
  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/useConsumerScrollHandlers.js +86 -0
  31. package/lib/module/hooks/useConsumerScrollHandlers.js.map +1 -0
  32. package/lib/module/hooks/useHeaderMotionBridge.js +14 -0
  33. package/lib/module/hooks/useHeaderMotionBridge.js.map +1 -0
  34. package/lib/module/hooks/useMotionProgress.js +12 -42
  35. package/lib/module/hooks/useMotionProgress.js.map +1 -1
  36. package/lib/module/hooks/useMotionProgress.test.js +56 -0
  37. package/lib/module/hooks/useMotionProgress.test.js.map +1 -0
  38. package/lib/module/hooks/useScrollManager.js +168 -87
  39. package/lib/module/hooks/useScrollManager.js.map +1 -1
  40. package/lib/module/index.js +21 -18
  41. package/lib/module/index.js.map +1 -1
  42. package/lib/module/utils/defaults.js +2 -1
  43. package/lib/module/utils/defaults.js.map +1 -1
  44. package/lib/module/utils/header.js +24 -0
  45. package/lib/module/utils/header.js.map +1 -0
  46. package/lib/module/utils/headerOffsetStyle.js +31 -0
  47. package/lib/module/utils/headerOffsetStyle.js.map +1 -0
  48. package/lib/module/utils/index.js +2 -0
  49. package/lib/module/utils/index.js.map +1 -1
  50. package/lib/typescript/docs/docusaurus.config.d.ts +4 -0
  51. package/lib/typescript/docs/docusaurus.config.d.ts.map +1 -0
  52. package/lib/typescript/docs/sidebars.d.ts +4 -0
  53. package/lib/typescript/docs/sidebars.d.ts.map +1 -0
  54. package/lib/typescript/docs/src/pages/index.d.ts +2 -0
  55. package/lib/typescript/docs/src/pages/index.d.ts.map +1 -0
  56. package/lib/typescript/src/components/Bridge.d.ts +19 -0
  57. package/lib/typescript/src/components/Bridge.d.ts.map +1 -0
  58. package/lib/typescript/src/components/FlatList.d.ts +7 -15
  59. package/lib/typescript/src/components/FlatList.d.ts.map +1 -1
  60. package/lib/typescript/src/components/Header.d.ts +73 -12
  61. package/lib/typescript/src/components/Header.d.ts.map +1 -1
  62. package/lib/typescript/src/components/HeaderDynamic.d.ts +11 -0
  63. package/lib/typescript/src/components/HeaderDynamic.d.ts.map +1 -0
  64. package/lib/typescript/src/components/HeaderMotion.d.ts +38 -23
  65. package/lib/typescript/src/components/HeaderMotion.d.ts.map +1 -1
  66. package/lib/typescript/src/components/HeaderPanBoundary.d.ts +11 -0
  67. package/lib/typescript/src/components/HeaderPanBoundary.d.ts.map +1 -0
  68. package/lib/typescript/src/components/NavigationBridge.d.ts +19 -0
  69. package/lib/typescript/src/components/NavigationBridge.d.ts.map +1 -0
  70. package/lib/typescript/src/components/ScrollManager.d.ts +13 -9
  71. package/lib/typescript/src/components/ScrollManager.d.ts.map +1 -1
  72. package/lib/typescript/src/components/ScrollView.d.ts +7 -14
  73. package/lib/typescript/src/components/ScrollView.d.ts.map +1 -1
  74. package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts +86 -0
  75. package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts.map +1 -0
  76. package/lib/typescript/src/components/index.d.ts +3 -1
  77. package/lib/typescript/src/components/index.d.ts.map +1 -1
  78. package/lib/typescript/src/context.d.ts +3 -17
  79. package/lib/typescript/src/context.d.ts.map +1 -1
  80. package/lib/typescript/src/hooks/index.d.ts +1 -0
  81. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  82. package/lib/typescript/src/hooks/useActiveScrollId.d.ts +7 -6
  83. package/lib/typescript/src/hooks/useActiveScrollId.d.ts.map +1 -1
  84. package/lib/typescript/src/hooks/useConsumerScrollHandlers.d.ts +64 -0
  85. package/lib/typescript/src/hooks/useConsumerScrollHandlers.d.ts.map +1 -0
  86. package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts +10 -0
  87. package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts.map +1 -0
  88. package/lib/typescript/src/hooks/useMotionProgress.d.ts +8 -25
  89. package/lib/typescript/src/hooks/useMotionProgress.d.ts.map +1 -1
  90. package/lib/typescript/src/hooks/useMotionProgress.test.d.ts +2 -0
  91. package/lib/typescript/src/hooks/useMotionProgress.test.d.ts.map +1 -0
  92. package/lib/typescript/src/hooks/useScrollManager.d.ts +61 -29
  93. package/lib/typescript/src/hooks/useScrollManager.d.ts.map +1 -1
  94. package/lib/typescript/src/index.d.ts +56 -26
  95. package/lib/typescript/src/index.d.ts.map +1 -1
  96. package/lib/typescript/src/types.d.ts +54 -17
  97. package/lib/typescript/src/types.d.ts.map +1 -1
  98. package/lib/typescript/src/utils/defaults.d.ts +3 -2
  99. package/lib/typescript/src/utils/defaults.d.ts.map +1 -1
  100. package/lib/typescript/src/utils/header.d.ts +10 -0
  101. package/lib/typescript/src/utils/header.d.ts.map +1 -0
  102. package/lib/typescript/src/utils/headerOffsetStyle.d.ts +19 -0
  103. package/lib/typescript/src/utils/headerOffsetStyle.d.ts.map +1 -0
  104. package/lib/typescript/src/utils/index.d.ts +2 -0
  105. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  106. package/lib/typescript/src/utils/refreshControl.d.ts +12 -12
  107. package/package.json +12 -5
  108. package/src/components/Bridge.tsx +29 -0
  109. package/src/components/FlatList.tsx +18 -76
  110. package/src/components/Header.tsx +159 -23
  111. package/src/components/HeaderDynamic.tsx +45 -0
  112. package/src/components/HeaderMotion.tsx +47 -50
  113. package/src/components/HeaderPanBoundary.tsx +92 -0
  114. package/src/components/NavigationBridge.tsx +30 -0
  115. package/src/components/ScrollManager.tsx +23 -11
  116. package/src/components/ScrollView.tsx +16 -60
  117. package/src/components/createHeaderMotionScrollable.tsx +438 -0
  118. package/src/components/index.ts +3 -1
  119. package/src/context.ts +11 -24
  120. package/src/hooks/index.ts +1 -0
  121. package/src/hooks/useActiveScrollId.ts +7 -6
  122. package/src/hooks/useConsumerScrollHandlers.ts +148 -0
  123. package/src/hooks/useHeaderMotionBridge.ts +15 -0
  124. package/src/hooks/useMotionProgress.test.ts +67 -0
  125. package/src/hooks/useMotionProgress.ts +12 -45
  126. package/src/hooks/useScrollManager.ts +251 -114
  127. package/src/index.ts +82 -36
  128. package/src/types.ts +81 -29
  129. package/src/utils/defaults.ts +7 -1
  130. package/src/utils/header.tsx +52 -0
  131. package/src/utils/headerOffsetStyle.ts +40 -0
  132. package/src/utils/index.ts +2 -0
  133. package/lib/module/components/HeaderBase.js +0 -107
  134. package/lib/module/components/HeaderBase.js.map +0 -1
  135. package/lib/typescript/src/components/HeaderBase.d.ts +0 -41
  136. package/lib/typescript/src/components/HeaderBase.d.ts.map +0 -1
  137. package/src/components/HeaderBase.tsx +0 -140
@@ -0,0 +1,10 @@
1
+ import type { HeaderMotionBridgeValue } from '../types';
2
+ /**
3
+ * Returns the full internal HeaderMotion context value.
4
+ *
5
+ * Most app code should use `useMotionProgress()` instead. Reach for this hook
6
+ * only when you need to carry HeaderMotion context across a tree boundary and
7
+ * re-provide it somewhere else.
8
+ */
9
+ export declare function useHeaderMotionBridge(): HeaderMotionBridgeValue;
10
+ //# sourceMappingURL=useHeaderMotionBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHeaderMotionBridge.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useHeaderMotionBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,uBAAuB,CAI/D"}
@@ -1,36 +1,19 @@
1
1
  import type { MotionProgress } from '../types';
2
2
  /**
3
- * Hook to access motion progress values and measuring functions for header animations.
4
- * Returns the progress value (0-1), threshold, and measurement functions.
3
+ * Returns the two shared values most header animations actually need:
4
+ * `progress` and `progressThreshold`.
5
5
  *
6
- * Must be used within a {@link HeaderMotion} component.
6
+ * Use this inside your animated header components to derive transforms,
7
+ * opacity, scale, parallax, or any other visual response to scroll.
7
8
  *
8
- * @returns Motion progress values and measuring functions:
9
- * - `progress`: Shared value from 0 to 1
10
- * - `progressThreshold`: The threshold at which animation completes
11
- * - `measureTotalHeight`: Function to measure total header height. Should be passed to the `onLayout` prop of the base of a header, to let scrollables account for the total header height
12
- * - `measureDynamic`: Function to measure a dimension of choice of the animated element of the header - should be passed to the `onLayout` prop of such. If used, can be used for dynamic calculation of the {@link progressThreshold}.
13
- *
14
- * @throws Error if used outside of a {@link HeaderMotion} component
9
+ * `progress` usually lives in the `0..1` range, where `0` is the expanded
10
+ * state and `1` is the fully collapsed state. `progressThreshold` is the pixel
11
+ * distance that corresponds to that transition.
15
12
  *
16
13
  * @example
17
14
  * ```tsx
18
15
  * function MyHeader() {
19
- * const { progress, progressThreshold, measureTotalHeight, measureDynamic } = useMotionProgress();
20
- * const dynamicStyle = useAnimatedStyle(() => {
21
- * const translateY = interpolate(
22
- * progress.value,
23
- * [0, 1],
24
- * [0, -progressThreshold],
25
- * Extrapolation.CLAMP,
26
- * )
27
- * return { transform: [{ translateY }] }
28
- * })
29
- * return (
30
- * <AnimatedHeaderBase onLayout={measureTotalHeight}>
31
- * <Animated.View onLayout={measureDynamic} style={dynamicStyle} />
32
- * </AnimatedHeaderBase>
33
- * )
16
+ * const { progress, progressThreshold } = useMotionProgress();
34
17
  * }
35
18
  * ```
36
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useMotionProgress.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useMotionProgress.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAwBlD"}
1
+ {"version":3,"file":"useMotionProgress.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useMotionProgress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CASlD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useMotionProgress.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMotionProgress.test.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useMotionProgress.test.ts"],"names":[],"mappings":""}
@@ -2,27 +2,66 @@ import { type AnimatedRef } from 'react-native-reanimated';
2
2
  import type { ScrollManagerConfig } from '../types';
3
3
  import { type ResolveRefreshControlOptions } from '../utils';
4
4
  import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/commonTypes';
5
+ import { type ConsumerScrollEventHandlers } from './useConsumerScrollHandlers';
6
+ export interface UseScrollManagerOptions<TRef extends InstanceOrElement = any> extends Omit<ResolveRefreshControlOptions, 'progressViewOffset'>, ConsumerScrollEventHandlers {
7
+ /**
8
+ * Animated ref for the managed scrollable.
9
+ *
10
+ * Provide this when the caller also needs imperative access to the same
11
+ * scrollable instance. Otherwise the hook creates one internally.
12
+ */
13
+ animatedRef?: AnimatedRef<TRef>;
14
+ /**
15
+ * Overrides the refresh indicator offset.
16
+ *
17
+ * By default, HeaderMotion derives this from the measured header height so
18
+ * pull-to-refresh starts below the header. Override it only when you need a
19
+ * custom refresh placement.
20
+ */
21
+ progressViewOffset?: ResolveRefreshControlOptions['progressViewOffset'];
22
+ /**
23
+ * Ensures short content can still scroll far enough to fully collapse the
24
+ * header.
25
+ *
26
+ * **Experimental: this relies on extra layout measurement and may still be
27
+ * refined.**
28
+ *
29
+ * Enable this when your content is sometimes shorter than the viewport and
30
+ * you still want the header to reach the collapsed state.
31
+ */
32
+ ensureScrollableContentMinHeight?: boolean;
33
+ }
5
34
  /**
6
- * Hook that manages scroll tracking and synchronization for header animations.
7
- * Returns props to apply to scrollable components and additional values that help with adjusting styling of the scrollables to header's dimensions.
35
+ * Wires a custom scrollable into HeaderMotion.
8
36
  *
9
- * This hook handles:
10
- * - Scroll position tracking
11
- * - Synchronization between multiple scroll views (when using multiple scroll IDs)
12
- * - Content container minimum height calculations for cases where one of the tracked scrollables does not take enough space to reach the progress threshold/
37
+ * Most code should not use this hook directly.
13
38
  *
14
- * Must be used within a HeaderMotion component.
39
+ * **Prefer `createHeaderMotionScrollable()` whenever possible.** It gives
40
+ * you the same integration in a reusable component wrapper with less manual
41
+ * wiring. Reach for `useScrollManager()` only in more complex cases where the
42
+ * factory API is not enough, for example when a third-party scrollable needs
43
+ * highly custom composition.
15
44
  *
16
- * @param scrollId - Optional unique identifier for the related scrollable.
17
- * Use when you have multiple scrollables (e.g., in tabs).
18
- * @param options - Optional configuration object.
19
- * @param options.animatedRef - Optional animated ref to use instead of creating one internally.
20
- * Useful when you need access to the scroll view ref from outside.
21
- * @returns Configuration object containing:
22
- * - `scrollableProps`: Props to apply to scrollable component (onScroll, scrollEventThrottle, ref)
23
- * - `headerMotionContext`: Header context values (originalHeaderHeight, minHeightContentContainerStyle)
45
+ * It returns two things:
46
+ * - `scrollableProps`: the event handlers / ref / refresh-control props that
47
+ * should go on the scrollable itself
48
+ * - `headerMotionContext`: layout values you can use to offset the content
49
+ * below the measured header
24
50
  *
25
- * @throws Error if used outside of a HeaderMotion component
51
+ * In multi-scroll setups, pass a unique `scrollId` for each scrollable.
52
+ * In single-scroll setups, you usually do not need one.
53
+ *
54
+ * If you need the same fallback behavior but prefer render-prop composition
55
+ * over a hook, use `HeaderMotion.ScrollManager`.
56
+ *
57
+ * @param scrollId Optional unique identifier for the managed scrollable.
58
+ * @param options Optional configuration for refs, refresh handling, user
59
+ * scroll callbacks, and short-content fallback behavior.
60
+ * @returns Object containing:
61
+ * - `scrollableProps`: props to spread onto the scrollable (`ref`, managed
62
+ * `onScroll`, optional `onLayout`, and resolved `refreshControl`)
63
+ * - `headerMotionContext`: layout values for offsetting the content container
64
+ * (`originalHeaderHeight` and optional `contentContainerMinHeight`)
26
65
  *
27
66
  * @example
28
67
  * ```tsx
@@ -31,7 +70,12 @@ import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/c
31
70
  *
32
71
  * return (
33
72
  * <CustomScrollView {...scrollableProps}>
34
- * <View style={{ paddingTop: headerMotionContext.originalHeaderHeight }}>
73
+ * <View
74
+ * style={{
75
+ * paddingTop: headerMotionContext.originalHeaderHeight,
76
+ * minHeight: headerMotionContext.contentContainerMinHeight,
77
+ * }}
78
+ * >
35
79
  * Content
36
80
  * </View>
37
81
  * </CustomScrollView>
@@ -39,17 +83,5 @@ import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/c
39
83
  * }
40
84
  * ```
41
85
  */
42
- export interface UseScrollManagerOptions<TRef extends InstanceOrElement = any> extends Omit<ResolveRefreshControlOptions, 'progressViewOffset'> {
43
- /**
44
- * Optional animated ref to use instead of creating one internally.
45
- * Useful when you need access to the scroll view ref from outside.
46
- */
47
- animatedRef?: AnimatedRef<TRef>;
48
- /**
49
- * Optional refresh progress offset override.
50
- * When provided, it takes precedence over the automatic offset based on header height.
51
- */
52
- progressViewOffset?: ResolveRefreshControlOptions['progressViewOffset'];
53
- }
54
86
  export declare function useScrollManager<TRef extends InstanceOrElement = any>(scrollId?: string, options?: UseScrollManagerOptions<TRef>): ScrollManagerConfig<TRef>;
55
87
  //# sourceMappingURL=useScrollManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScrollManager.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAKL,KAAK,4BAA4B,EAClC,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAQ5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,uBAAuB,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,CAC3E,SAAQ,IAAI,CAAC,4BAA4B,EAAE,oBAAoB,CAAC;IAChE;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,oBAAoB,CAAC,CAAC;CACzE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,EACnE,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,uBAAuB,CAAC,IAAI,CAAC,GACtC,mBAAmB,CAAC,IAAI,CAAC,CAiN3B"}
1
+ {"version":3,"file":"useScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScrollManager.ts"],"names":[],"mappings":"AAOA,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,mBAAmB,EAAwB,MAAM,UAAU,CAAC;AAE1E,OAAO,EAKL,KAAK,4BAA4B,EAClC,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAC5F,OAAO,EAGL,KAAK,2BAA2B,EACjC,MAAM,6BAA6B,CAAC;AAgQrC,MAAM,WAAW,uBAAuB,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,CAC3E,SAAQ,IAAI,CAAC,4BAA4B,EAAE,oBAAoB,CAAC,EAC9D,2BAA2B;IAC7B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,oBAAoB,CAAC,CAAC;IACxE;;;;;;;;;OASG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,EACnE,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,uBAAuB,CAAC,IAAI,CAAC,GACtC,mBAAmB,CAAC,IAAI,CAAC,CAuD3B"}
@@ -1,51 +1,81 @@
1
- import { AnimatedHeaderBase, HeaderBase, HeaderMotionFlatList, HeaderMotionHeader, HeaderMotionScrollManager, HeaderMotionScrollView, type HeaderMotionFlatListProps, type HeaderMotionHeaderProps, type HeaderMotionProps, type HeaderMotionScrollManagerProps, type HeaderMotionScrollViewProps } from './components';
2
- import type { ReactElement } from 'react';
3
- /**
4
- * Compound component type for HeaderMotion.
5
- * Provides the main context provider and sub-components for building collapsible headers.
6
- */
7
- type HeaderMotionComponent = {
8
- /** Main context provider component */
9
- <T extends string>(props: HeaderMotionProps<T>): ReactElement;
10
- /** Component for providing motion progress properties to animated headers.
11
- * Use to pass props to the header components in React Navigation / Expo Router, which cannot access HeaderMotion's context and `useMotionProgress` otherwise.
1
+ import { createHeaderMotionScrollable, Bridge, HeaderMotionContextProvider, FlatList, Header, NavigationBridge, ScrollManager, ScrollView, type CreateHeaderMotionScrollableOptions, type HeaderProps, type HeaderMotionBridgeProps, type HeaderMotionFlatListProps, type HeaderMotionNavigationBridgeProps, type HeaderMotionProps, type HeaderMotionScrollManagerProps, type HeaderMotionScrollableOwnProps, type HeaderMotionScrollViewProps } from './components';
2
+ import type { HeaderDynamicProps } from './types';
3
+ type HeaderMotionCompound = typeof HeaderMotionContextProvider & {
4
+ /**
5
+ * Header container that measures the total header height and can optionally
6
+ * make the header surface pannable.
7
+ *
8
+ * Use `HeaderMotion.Header.Dynamic` inside it to mark the part of the header
9
+ * that should define the collapse distance.
10
+ */
11
+ Header: typeof Header;
12
+ /**
13
+ * Captures the current HeaderMotion context and exposes it through a render
14
+ * function so it can be forwarded across a React tree boundary.
15
+ *
16
+ * This is primarily useful for navigation-rendered headers.
17
+ */
18
+ Bridge: typeof Bridge;
19
+ /**
20
+ * Re-provides a previously captured HeaderMotion context value in another
21
+ * subtree.
22
+ *
23
+ * This is primarily useful for navigation libraries that render headers
24
+ * outside the screen subtree where `HeaderMotion` lives.
12
25
  */
13
- Header: typeof HeaderMotionHeader;
14
- /** Component for custom scroll implementations */
15
- ScrollManager: typeof HeaderMotionScrollManager;
16
- /** Animated ScrollView component with header motion integration */
17
- ScrollView: typeof HeaderMotionScrollView;
18
- /** Animated FlatList component with header motion integration */
19
- FlatList: typeof HeaderMotionFlatList;
26
+ NavigationBridge: typeof NavigationBridge;
27
+ /**
28
+ * Render-prop wrapper for managing a custom scrollable.
29
+ *
30
+ * Prefer `createHeaderMotionScrollable()` for most custom integrations. Use
31
+ * `ScrollManager` only when the factory approach is not flexible enough.
32
+ */
33
+ ScrollManager: typeof ScrollManager;
34
+ /**
35
+ * Pre-wired `Animated.ScrollView` that participates in HeaderMotion's scroll
36
+ * tracking and header offsetting.
37
+ */
38
+ ScrollView: typeof ScrollView;
39
+ /**
40
+ * Pre-wired `Animated.FlatList` that participates in HeaderMotion's scroll
41
+ * tracking and header offsetting.
42
+ */
43
+ FlatList: typeof FlatList;
20
44
  };
21
45
  /**
22
46
  * Main HeaderMotion component.
23
- * A compound component that provides context for collapsible header animations.
47
+ * Root provider and compound entrypoint for the library.
48
+ *
49
+ * It tracks header measurements, derives the shared `progress` value, and
50
+ * exposes the pre-wired subcomponents used to connect headers and scrollables.
24
51
  *
25
52
  * @example
26
53
  * ```tsx
27
54
  * <HeaderMotion>
28
- * <HeaderMotion.Header>
29
- * {(headerProps) => (
55
+ * <HeaderMotion.Bridge>
56
+ * {(value) => (
30
57
  * <Stack.Screen
31
58
  * options={{
32
59
  * header: () => (
33
- * <MyAnimatedHeader {...headerProps} />
60
+ * <HeaderMotion.NavigationBridge value={value}>
61
+ * <MyAnimatedHeader />
62
+ * </HeaderMotion.NavigationBridge>
34
63
  * ),
35
64
  * }}
36
65
  * />
37
66
  * )}
38
- * </HeaderMotion.Header>
67
+ * </HeaderMotion.Bridge>
39
68
  * <HeaderMotion.ScrollView>
40
69
  * <MyScrollableContent />
41
70
  * </HeaderMotion.ScrollView>
42
71
  * </HeaderMotion>
43
72
  * ```
44
73
  */
45
- declare const HeaderMotion: HeaderMotionComponent;
74
+ declare const HeaderMotion: HeaderMotionCompound;
46
75
  export default HeaderMotion;
47
76
  export * from './hooks';
48
77
  export type * from './types';
49
- export { AnimatedHeaderBase, HeaderBase };
50
- export type { HeaderMotionFlatListProps, HeaderMotionHeaderProps, HeaderMotionProps, HeaderMotionScrollManagerProps, HeaderMotionScrollViewProps, };
78
+ export { createHeaderMotionScrollable };
79
+ export { Bridge, Header, NavigationBridge };
80
+ export type { CreateHeaderMotionScrollableOptions, HeaderDynamicProps, HeaderMotionFlatListProps, HeaderMotionBridgeProps, HeaderMotionNavigationBridgeProps, HeaderMotionProps, HeaderMotionScrollManagerProps, HeaderMotionScrollableOwnProps, HeaderMotionScrollViewProps, HeaderProps, };
51
81
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,UAAU,EAEV,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,EACjC,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C;;;GAGG;AACH,KAAK,qBAAqB,GAAG;IAC3B,sCAAsC;IACtC,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC;IAC9D;;OAEG;IACH,MAAM,EAAE,OAAO,kBAAkB,CAAC;IAClC,kDAAkD;IAClD,aAAa,EAAE,OAAO,yBAAyB,CAAC;IAChD,mEAAmE;IACnE,UAAU,EAAE,OAAO,sBAAsB,CAAC;IAC1C,iEAAiE;IACjE,QAAQ,EAAE,OAAO,oBAAoB,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,YAAY,EAAkC,qBAAqB,CAAC;AAM1E,eAAe,YAAY,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC;AAC1C,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,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B,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,2BAA2B,EAC3B,WAAW,GACZ,CAAC"}
@@ -1,9 +1,40 @@
1
1
  import type { ReactElement } from 'react';
2
- import type { LayoutChangeEvent, ScrollViewProps } from 'react-native';
3
- import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
2
+ import type { LayoutChangeEvent, ScrollViewProps, ViewProps } from 'react-native';
3
+ import type { AnimatedProps, AnimatedRef, SharedValue } from 'react-native-reanimated';
4
4
  import { DEFAULT_SCROLL_ID } from './utils/defaults';
5
5
  import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/commonTypes';
6
+ import type { GestureStateChangeEvent, PanGestureHandlerEventPayload } from 'react-native-gesture-handler';
7
+ import type { WithDecayConfig } from 'react-native-reanimated';
6
8
  export type Progress = SharedValue<number>;
9
+ export type HeaderMotionOffsetStrategy = 'padding' | 'margin' | 'top' | 'translate' | 'none';
10
+ export interface HeaderMotionOffsetProps {
11
+ /**
12
+ * How the scrollable content should be pushed below the measured header.
13
+ *
14
+ * `padding` is the safest default for most screens. `margin`, `top`, and
15
+ * `translate` can be useful when the scrollable or its children need a
16
+ * different layout behavior.
17
+ *
18
+ * `top` and `translate` add bottom compensation so the end of the content
19
+ * remains reachable.
20
+ *
21
+ * @default 'padding'
22
+ */
23
+ headerOffsetStrategy?: HeaderMotionOffsetStrategy;
24
+ /**
25
+ * Adds a minimum content height so scrollables with short content can still collapse the
26
+ * header completely.
27
+ *
28
+ * **Experimental: this relies on extra layout measurement and may still be
29
+ * refined.**
30
+ *
31
+ * Enable this when some screens do not have enough content to naturally
32
+ * scroll through the full collapse distance.
33
+ *
34
+ * @default false
35
+ */
36
+ ensureScrollableContentMinHeight?: boolean;
37
+ }
7
38
  export type ProgressThreshold = number | ((measuredHeaderValue: number) => number);
8
39
  export type MeasureAnimatedHeader = (e: LayoutChangeEvent) => number;
9
40
  export type MeasureAnimatedHeaderAndSet = (e: LayoutChangeEvent) => void;
@@ -19,38 +50,44 @@ export interface ScrollValue {
19
50
  export type ScrollValues = Record<string, ScrollValue> & {
20
51
  [key in typeof DEFAULT_SCROLL_ID]?: ScrollValue;
21
52
  };
22
- export type WithCollapsibleHeaderProps<T extends Record<string, unknown> = Record<string, unknown>> = T & MotionProgress;
23
- export type WithCollapsiblePagedHeaderProps<Tab extends string = string, T extends Record<string, unknown> = Record<string, unknown>> = WithCollapsibleHeaderProps<T> & {
24
- onTabChange: (newTab: Tab) => void;
25
- activeTab: Tab;
26
- };
27
53
  export interface MotionProgress {
28
54
  progress: Progress;
29
55
  progressThreshold: SharedValue<number>;
56
+ }
57
+ export type HeaderPanDecayEvent = GestureStateChangeEvent<PanGestureHandlerEventPayload>;
58
+ export type HeaderPanDecayConfig = WithDecayConfig | ((event: HeaderPanDecayEvent) => WithDecayConfig);
59
+ export type HeaderAsChildProps = {
60
+ asChild: true;
61
+ children: ReactElement;
62
+ };
63
+ export type HeaderDefaultProps = AnimatedProps<ViewProps> & {
64
+ asChild?: false;
65
+ };
66
+ export type HeaderDynamicProps = HeaderDefaultProps | HeaderAsChildProps;
67
+ export interface HeaderMotionBridgeValue extends MotionProgress {
30
68
  measureTotalHeight: MeasureAnimatedHeaderAndSet;
31
69
  measureDynamic: MeasureAnimatedHeaderAndSet;
32
- animatedHeaderBaseProps: AnimatedHeaderBaseMotionProps;
70
+ headerPanMomentumOffset: SharedValue<number | null>;
71
+ scrollValues: SharedValue<ScrollValues>;
33
72
  activeScrollId: SharedValue<string> | undefined;
34
- }
35
- export interface AnimatedHeaderBaseMotionProps {
36
- enableHeaderPan: boolean;
37
73
  scrollToRef: React.RefObject<ScrollTo | null>;
38
- headerPanMomentumOffset: SharedValue<number | null>;
74
+ originalHeaderHeight: number;
39
75
  }
40
76
  export interface ScrollManagerHeaderMotionContext {
41
- originalHeaderHeight: SharedValue<number>;
42
- minHeightContentContainerStyle: {} | {
43
- minHeight: number;
44
- };
77
+ originalHeaderHeight: number;
78
+ contentContainerMinHeight?: number;
45
79
  }
46
80
  export interface ScrollManagerConfig<TRef extends InstanceOrElement = any> {
47
- scrollableProps: Required<Pick<ScrollViewProps, 'onScroll' | 'scrollEventThrottle'>> & {
81
+ scrollableProps: Pick<ScrollViewProps, 'onScroll' | 'onLayout'> & {
48
82
  refreshControl?: ReactElement;
49
83
  ref: AnimatedRef<TRef>;
50
84
  };
51
85
  headerMotionContext: ScrollManagerHeaderMotionContext;
52
86
  }
53
87
  export type ScrollTo = (y: number, options?: ScrollToOptions) => void;
88
+ export type ScrollHandlerContext = {
89
+ lastOffset: number | undefined;
90
+ };
54
91
  interface ScrollToOptions {
55
92
  isValueDelta?: boolean;
56
93
  animated?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,CAAC,CAAC,mBAAmB,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,EAAE,iBAAiB,KAAK,MAAM,CAAC;AACrE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAEzE,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAC5D,KAAK,EAAE,CAAC,CAAC;IACT,EAAE,EAAE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E,OAAO,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -1,6 +1,7 @@
1
- import type { MeasureAnimatedHeader, ProgressThreshold } from '../types';
1
+ import type { HeaderMotionOffsetStrategy, MeasureAnimatedHeader, ProgressThreshold } from '../types';
2
2
  declare const DEFAULT_PROGRESS_THRESHOLD: ProgressThreshold;
3
3
  declare const DEFAULT_MEASURE_DYNAMIC: MeasureAnimatedHeader;
4
+ declare const DEFAULT_HEADER_OFFSET_STRATEGY: HeaderMotionOffsetStrategy;
4
5
  declare const DEFAULT_SCROLL_ID = "__HEADER_MOTION_DEFAULT_SCROLL_ID__";
5
- export { DEFAULT_MEASURE_DYNAMIC, DEFAULT_PROGRESS_THRESHOLD, DEFAULT_SCROLL_ID, };
6
+ export { DEFAULT_HEADER_OFFSET_STRATEGY, DEFAULT_MEASURE_DYNAMIC, DEFAULT_PROGRESS_THRESHOLD, DEFAULT_SCROLL_ID, };
6
7
  //# sourceMappingURL=defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEzE,QAAA,MAAM,0BAA0B,EAAE,iBACb,CAAC;AACtB,QAAA,MAAM,uBAAuB,EAAE,qBACF,CAAC;AAI9B,QAAA,MAAM,iBAAiB,wCAAwC,CAAC;AAEhE,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,QAAA,MAAM,0BAA0B,EAAE,iBACb,CAAC;AACtB,QAAA,MAAM,uBAAuB,EAAE,qBACF,CAAC;AAC9B,QAAA,MAAM,8BAA8B,EAAE,0BAAsC,CAAC;AAI7E,QAAA,MAAM,iBAAiB,wCAAwC,CAAC;AAEhE,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,GAClB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { ViewProps } from 'react-native';
3
+ export type SlottableElementProps = {
4
+ onLayout?: ViewProps['onLayout'];
5
+ };
6
+ export type SlottableElement = ReactElement<SlottableElementProps>;
7
+ export declare function composeOnLayoutHandlers(userHandler: ViewProps['onLayout'], internalHandler: ViewProps['onLayout']): (e: Parameters<NonNullable<ViewProps["onLayout"]>>[0]) => void;
8
+ export declare function resolveSlottableChild(componentName: string, child: ReactElement): SlottableElement;
9
+ export declare function cloneWithOnLayout(child: SlottableElement, onLayout: ViewProps['onLayout'], componentName: string): ReactElement<SlottableElementProps, string | import("react").JSXElementConstructor<any>>;
10
+ //# sourceMappingURL=header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../src/utils/header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAEnE,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,CAAC,UAAU,CAAC,EAClC,eAAe,EAAE,SAAS,CAAC,UAAU,CAAC,IAE9B,GAAG,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAI7D;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,YAAY,GAQH,gBAAgB,CACjC;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,EAC/B,aAAa,EAAE,MAAM,4FAWtB"}
@@ -0,0 +1,19 @@
1
+ import type { SharedValue } from 'react-native-reanimated';
2
+ import type { HeaderMotionOffsetStrategy } from '../types';
3
+ type HeaderOffsetValue = number | SharedValue<number>;
4
+ type HeaderOffsetStyle = undefined | {
5
+ paddingTop: HeaderOffsetValue;
6
+ } | {
7
+ marginTop: HeaderOffsetValue;
8
+ } | {
9
+ top: HeaderOffsetValue;
10
+ paddingBottom: HeaderOffsetValue;
11
+ } | {
12
+ transform: [{
13
+ translateY: HeaderOffsetValue;
14
+ }];
15
+ paddingBottom: HeaderOffsetValue;
16
+ };
17
+ export declare function resolveHeaderOffsetStyle(originalHeaderHeight: HeaderOffsetValue, headerOffsetStrategy?: HeaderMotionOffsetStrategy): HeaderOffsetStyle;
18
+ export {};
19
+ //# sourceMappingURL=headerOffsetStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headerOffsetStyle.d.ts","sourceRoot":"","sources":["../../../../src/utils/headerOffsetStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAG3D,KAAK,iBAAiB,GAAG,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAEtD,KAAK,iBAAiB,GAClB,SAAS,GACT;IAAE,UAAU,EAAE,iBAAiB,CAAA;CAAE,GACjC;IAAE,SAAS,EAAE,iBAAiB,CAAA;CAAE,GAChC;IAAE,GAAG,EAAE,iBAAiB,CAAC;IAAC,aAAa,EAAE,iBAAiB,CAAA;CAAE,GAC5D;IACE,SAAS,EAAE,CAAC;QAAE,UAAU,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAC;IAC/C,aAAa,EAAE,iBAAiB,CAAC;CAClC,CAAC;AAEN,wBAAgB,wBAAwB,CACtC,oBAAoB,EAAE,iBAAiB,EACvC,oBAAoB,GAAE,0BAA2D,GAChF,iBAAiB,CAoBnB"}
@@ -1,4 +1,6 @@
1
1
  export * from './defaults';
2
+ export * from './header';
3
+ export * from './headerOffsetStyle';
2
4
  export * from './values';
3
5
  export * from './refreshControl';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}