react-native-header-motion 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,10 @@ High-level APIs for **orchestrating header motion** driven by scroll — built o
4
4
 
5
5
  This library is **100% a wrapper around Reanimated**. All the credit for the underlying animation engine, worklets, and primitives goes to **Reanimated** (and `react-native-worklets`). This package focuses on a specific use case: **header motion + scroll orchestration** (including multi-scroll/tab scenarios).
6
6
 
7
+ <div align="center">
8
+ <img src="https://github.com/user-attachments/assets/b673349a-f26a-4cc8-bfe1-60d77deb4390" width="70%" />
9
+ </div>
10
+
7
11
  ## What this is (and isn’t)
8
12
 
9
13
  **✅ This is**
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import { forwardRef } from 'react';
4
- import { ScrollView } from 'react-native';
5
4
  import Animated from 'react-native-reanimated';
6
5
  import { HeaderMotionScrollManager } from "./ScrollManager.js";
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -24,6 +23,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
23
  */
25
24
  export function HeaderMotionFlatList({
26
25
  scrollId,
26
+ contentContainerStyle,
27
27
  ...props
28
28
  }) {
29
29
  return /*#__PURE__*/_jsx(HeaderMotionScrollManager, {
@@ -39,11 +39,11 @@ export function HeaderMotionFlatList({
39
39
  ...props,
40
40
  onScroll: onScroll,
41
41
  renderScrollComponent: propsz => /*#__PURE__*/_jsx(AnimatedScrollContainer, {
42
- ...propsz
43
- }),
44
- contentContainerStyle: [minHeightContentContainerStyle, {
45
- paddingTop: originalHeaderHeight
46
- }, props.contentContainerStyle]
42
+ ...propsz,
43
+ contentContainerStyle: [minHeightContentContainerStyle, {
44
+ paddingTop: originalHeaderHeight
45
+ }, contentContainerStyle]
46
+ })
47
47
  })
48
48
  });
49
49
  }
@@ -52,7 +52,7 @@ const AnimatedScrollContainer = /*#__PURE__*/forwardRef(({
52
52
  contentContainerStyle,
53
53
  ...rest
54
54
  }, ref) => {
55
- return /*#__PURE__*/_jsx(ScrollView, {
55
+ return /*#__PURE__*/_jsx(Animated.ScrollView, {
56
56
  ...rest,
57
57
  ref: ref,
58
58
  children: /*#__PURE__*/_jsx(Animated.View, {
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","ScrollView","Animated","HeaderMotionScrollManager","jsx","_jsx","HeaderMotionFlatList","scrollId","props","children","onScroll","scrollViewProps","originalHeaderHeight","minHeightContentContainerStyle","FlatList","renderScrollComponent","propsz","AnimatedScrollContainer","contentContainerStyle","paddingTop","rest","ref","View","style"],"sourceRoot":"../../../src","sources":["components/FlatList.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAgD,OAAO;AAC1E,SAASC,UAAU,QAA8B,cAAc;AAC/D,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,yBAAyB,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAc5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAU;EAC5CC,QAAQ;EACR,GAAGC;AACyB,CAAC,EAAE;EAC/B,oBACEH,IAAA,CAACF,yBAAyB;IAACI,QAAQ,EAAEA,QAAS;IAAAE,QAAA,EAC3CA,CACC;MAAEC,QAAQ;MAAE,GAAGC;IAAgB,CAAC,EAChC;MAAEC,oBAAoB;MAAEC;IAA+B,CAAC,kBAExDR,IAAA,CAACH,QAAQ,CAACY,QAAQ;MAAA,GACZH,eAAe;MAAA,GACfH,KAAK;MACTE,QAAQ,EAAEA,QAAS;MACnBK,qBAAqB,EAAGC,MAAM,iBAC5BX,IAAA,CAACY,uBAAuB;QAAA,GAAKD;MAAM,CAAG,CACtC;MACFE,qBAAqB,EAAE,CACrBL,8BAA8B,EAC9B;QAAEM,UAAU,EAAEP;MAAqB,CAAC,EACpCJ,KAAK,CAACU,qBAAqB;IAC3B,CACH;EACF,CACwB,CAAC;AAEhC;AAEA,MAAMD,uBAAuB,gBAAGjB,UAAU,CAGxC,CAAC;EAAES,QAAQ;EAAES,qBAAqB;EAAE,GAAGE;AAAK,CAAC,EAAEC,GAAG,KAAK;EACvD,oBACEhB,IAAA,CAACJ,UAAU;IAAA,GAAKmB,IAAI;IAAEC,GAAG,EAAEA,GAAI;IAAAZ,QAAA,eAC7BJ,IAAA,CAACH,QAAQ,CAACoB,IAAI;MAACC,KAAK,EAAEL,qBAAsB;MAAAT,QAAA,EAAEA;IAAQ,CAAgB;EAAC,CAC7D,CAAC;AAEjB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","Animated","HeaderMotionScrollManager","jsx","_jsx","HeaderMotionFlatList","scrollId","contentContainerStyle","props","children","onScroll","scrollViewProps","originalHeaderHeight","minHeightContentContainerStyle","FlatList","renderScrollComponent","propsz","AnimatedScrollContainer","paddingTop","rest","ref","ScrollView","View","style"],"sourceRoot":"../../../src","sources":["components/FlatList.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAgD,OAAO;AAC1E,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,yBAAyB,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgB5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAU;EAC5CC,QAAQ;EACRC,qBAAqB;EACrB,GAAGC;AACyB,CAAC,EAAE;EAC/B,oBACEJ,IAAA,CAACF,yBAAyB;IAACI,QAAQ,EAAEA,QAAS;IAAAG,QAAA,EAC3CA,CACC;MAAEC,QAAQ;MAAE,GAAGC;IAAgB,CAAC,EAChC;MAAEC,oBAAoB;MAAEC;IAA+B,CAAC,kBAExDT,IAAA,CAACH,QAAQ,CAACa,QAAQ;MAAA,GACZH,eAAe;MAAA,GACfH,KAAK;MACTE,QAAQ,EAAEA,QAAS;MACnBK,qBAAqB,EAAGC,MAAM,iBAC5BZ,IAAA,CAACa,uBAAuB;QAAA,GAClBD,MAAM;QACVT,qBAAqB,EAAE,CACrBM,8BAA8B,EAC9B;UAAEK,UAAU,EAAEN;QAAqB,CAAC,EACpCL,qBAAqB;MACrB,CACH;IACD,CACH;EACF,CACwB,CAAC;AAEhC;AAEA,MAAMU,uBAAuB,gBAAGjB,UAAU,CAGxC,CAAC;EAAES,QAAQ;EAAEF,qBAAqB;EAAE,GAAGY;AAAK,CAAC,EAAEC,GAAG,KAAK;EACvD,oBACEhB,IAAA,CAACH,QAAQ,CAACoB,UAAU;IAAA,GAAKF,IAAI;IAAEC,GAAG,EAAEA,GAAI;IAAAX,QAAA,eACtCL,IAAA,CAACH,QAAQ,CAACqB,IAAI;MAACC,KAAK,EAAEhB,qBAAsB;MAAAE,QAAA,EAAEA;IAAQ,CAAgB;EAAC,CACpD,CAAC;AAE1B,CAAC,CAAC","ignoreList":[]}
@@ -25,6 +25,6 @@ export type HeaderMotionFlatListProps<T = any> = AnimatedFlatListProps<T> & {
25
25
  * </HeaderMotion>
26
26
  * ```
27
27
  */
28
- export declare function HeaderMotionFlatList<T = any>({ scrollId, ...props }: HeaderMotionFlatListProps<T>): import("react/jsx-runtime").JSX.Element;
28
+ export declare function HeaderMotionFlatList<T = any>({ scrollId, contentContainerStyle, ...props }: HeaderMotionFlatListProps<T>): import("react/jsx-runtime").JSX.Element;
29
29
  export {};
30
30
  //# 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;AAE3E,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAG/C,KAAK,qBAAqB,CAAC,CAAC,GAAG,GAAG,IAAI,cAAc,CAClD,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC5B,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,CAAC,GAAG,GAAG,IAAI,qBAAqB,CAAC,CAAC,CAAC,GAAG;IAC1E;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAAE,EAC5C,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,CAAC,CAAC,CAAC,2CAuB9B"}
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,MAAM,yBAAyB,CAAC;AAK/C,KAAK,qBAAqB,CAAC,CAAC,GAAG,GAAG,IAAI,cAAc,CAClD,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC5B,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,CAAC,GAAG,GAAG,IAAI,qBAAqB,CAAC,CAAC,CAAC,GAAG;IAC1E;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAAE,EAC5C,QAAQ,EACR,qBAAqB,EACrB,GAAG,KAAK,EACT,EAAE,yBAAyB,CAAC,CAAC,CAAC,2CAyB9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-header-motion",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Smooth, animated collapsible headers with scroll-based motion control in React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -1,8 +1,9 @@
1
1
  import { forwardRef, type ComponentProps, type ComponentRef } from 'react';
2
- import { ScrollView, type ScrollViewProps } from 'react-native';
3
2
  import Animated from 'react-native-reanimated';
4
3
  import { HeaderMotionScrollManager } from './ScrollManager';
5
4
 
5
+ import type { ScrollViewProps } from 'react-native';
6
+
6
7
  type AnimatedFlatListProps<T = any> = ComponentProps<
7
8
  typeof Animated.FlatList<T>
8
9
  >;
@@ -34,6 +35,7 @@ export type HeaderMotionFlatListProps<T = any> = AnimatedFlatListProps<T> & {
34
35
  */
35
36
  export function HeaderMotionFlatList<T = any>({
36
37
  scrollId,
38
+ contentContainerStyle,
37
39
  ...props
38
40
  }: HeaderMotionFlatListProps<T>) {
39
41
  return (
@@ -47,13 +49,15 @@ export function HeaderMotionFlatList<T = any>({
47
49
  {...props}
48
50
  onScroll={onScroll}
49
51
  renderScrollComponent={(propsz) => (
50
- <AnimatedScrollContainer {...propsz} />
52
+ <AnimatedScrollContainer
53
+ {...propsz}
54
+ contentContainerStyle={[
55
+ minHeightContentContainerStyle,
56
+ { paddingTop: originalHeaderHeight },
57
+ contentContainerStyle,
58
+ ]}
59
+ />
51
60
  )}
52
- contentContainerStyle={[
53
- minHeightContentContainerStyle,
54
- { paddingTop: originalHeaderHeight },
55
- props.contentContainerStyle,
56
- ]}
57
61
  />
58
62
  )}
59
63
  </HeaderMotionScrollManager>
@@ -61,12 +65,12 @@ export function HeaderMotionFlatList<T = any>({
61
65
  }
62
66
 
63
67
  const AnimatedScrollContainer = forwardRef<
64
- ComponentRef<typeof ScrollView>,
68
+ ComponentRef<typeof Animated.ScrollView>,
65
69
  ScrollViewProps
66
70
  >(({ children, contentContainerStyle, ...rest }, ref) => {
67
71
  return (
68
- <ScrollView {...rest} ref={ref}>
72
+ <Animated.ScrollView {...rest} ref={ref}>
69
73
  <Animated.View style={contentContainerStyle}>{children}</Animated.View>
70
- </ScrollView>
74
+ </Animated.ScrollView>
71
75
  );
72
76
  });