react-native-animated-header-flat-list 1.1.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 (32) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +224 -0
  3. package/lib/commonjs/components/AnimatedHeaderFlatList.js +195 -0
  4. package/lib/commonjs/components/AnimatedHeaderFlatList.js.map +1 -0
  5. package/lib/commonjs/hooks/useAnimatedHeaderFlatListAnimatedStyles.js +102 -0
  6. package/lib/commonjs/hooks/useAnimatedHeaderFlatListAnimatedStyles.js.map +1 -0
  7. package/lib/commonjs/index.js +13 -0
  8. package/lib/commonjs/index.js.map +1 -0
  9. package/lib/module/components/AnimatedHeaderFlatList.js +189 -0
  10. package/lib/module/components/AnimatedHeaderFlatList.js.map +1 -0
  11. package/lib/module/hooks/useAnimatedHeaderFlatListAnimatedStyles.js +97 -0
  12. package/lib/module/hooks/useAnimatedHeaderFlatListAnimatedStyles.js.map +1 -0
  13. package/lib/module/index.js +5 -0
  14. package/lib/module/index.js.map +1 -0
  15. package/lib/typescript/commonjs/package.json +1 -0
  16. package/lib/typescript/commonjs/src/components/AnimatedHeaderFlatList.d.ts +18 -0
  17. package/lib/typescript/commonjs/src/components/AnimatedHeaderFlatList.d.ts.map +1 -0
  18. package/lib/typescript/commonjs/src/hooks/useAnimatedHeaderFlatListAnimatedStyles.d.ts +24 -0
  19. package/lib/typescript/commonjs/src/hooks/useAnimatedHeaderFlatListAnimatedStyles.d.ts.map +1 -0
  20. package/lib/typescript/commonjs/src/index.d.ts +3 -0
  21. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  22. package/lib/typescript/module/package.json +1 -0
  23. package/lib/typescript/module/src/components/AnimatedHeaderFlatList.d.ts +18 -0
  24. package/lib/typescript/module/src/components/AnimatedHeaderFlatList.d.ts.map +1 -0
  25. package/lib/typescript/module/src/hooks/useAnimatedHeaderFlatListAnimatedStyles.d.ts +24 -0
  26. package/lib/typescript/module/src/hooks/useAnimatedHeaderFlatListAnimatedStyles.d.ts.map +1 -0
  27. package/lib/typescript/module/src/index.d.ts +3 -0
  28. package/lib/typescript/module/src/index.d.ts.map +1 -0
  29. package/package.json +199 -0
  30. package/src/components/AnimatedHeaderFlatList.tsx +299 -0
  31. package/src/hooks/useAnimatedHeaderFlatListAnimatedStyles.ts +179 -0
  32. package/src/index.tsx +3 -0
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { StyleSheet, View } from 'react-native';
5
+ import { useLayoutEffect, useCallback, useMemo } from 'react';
6
+ import { useAnimatedHeaderFlatListAnimatedStyles } from "../hooks/useAnimatedHeaderFlatListAnimatedStyles.js";
7
+ import Animated from 'react-native-reanimated';
8
+
9
+ // Types
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export function AnimatedHeaderFlatList({
12
+ navigation,
13
+ title,
14
+ headerTitleStyle,
15
+ navigationTitleStyle,
16
+ HeaderBackground,
17
+ HeaderContent,
18
+ StickyComponent,
19
+ style,
20
+ ...flatListProps
21
+ }) {
22
+ const getFontSizeFromStyle = useCallback(textStyle => {
23
+ if (!textStyle) return undefined;
24
+ if (Array.isArray(textStyle)) {
25
+ for (const styleItem of textStyle) {
26
+ if (styleItem && typeof styleItem === 'object' && 'fontSize' in styleItem) {
27
+ return styleItem.fontSize;
28
+ }
29
+ }
30
+ } else if (typeof textStyle === 'object' && 'fontSize' in textStyle) {
31
+ return textStyle.fontSize;
32
+ }
33
+ return undefined;
34
+ }, []);
35
+ const {
36
+ scrollHandler,
37
+ navigationBarHeight,
38
+ headerLayout,
39
+ setHeaderLayout,
40
+ setHeaderTitleLayout,
41
+ stickyComponentLayout,
42
+ setStickyComponentLayout,
43
+ navigationTitleAnimatedStyle,
44
+ headerTitleAnimatedStyle,
45
+ stickyHeaderAnimatedStyle,
46
+ headerContentAnimatedStyle,
47
+ headerBackgroundAnimatedStyle
48
+ } = useAnimatedHeaderFlatListAnimatedStyles({
49
+ headerTitleFontSize: getFontSizeFromStyle(headerTitleStyle),
50
+ navigationTitleFontSize: getFontSizeFromStyle(navigationTitleStyle)
51
+ });
52
+ const navigationTitle = useCallback(() => /*#__PURE__*/_jsx(Animated.Text, {
53
+ style: [navigationTitleAnimatedStyle, navigationTitleStyle, styles.titleStyle],
54
+ numberOfLines: 1,
55
+ children: title
56
+ }), [navigationTitleAnimatedStyle, navigationTitleStyle, title]);
57
+ useLayoutEffect(() => {
58
+ navigation.setOptions({
59
+ headerShown: true,
60
+ headerStyle: styles.navigationBar,
61
+ headerShadowVisible: false,
62
+ headerTransparent: true,
63
+ headerTitle: navigationTitle,
64
+ headerTitleAlign: 'center'
65
+ });
66
+ }, [navigationTitle, navigation]);
67
+ const ListHeaderComponent = useMemo(() => {
68
+ return /*#__PURE__*/_jsx(View, {
69
+ style: styles.headerWrapper,
70
+ children: /*#__PURE__*/_jsxs(View, {
71
+ style: [styles.headerContainer, {
72
+ top: -navigationBarHeight
73
+ }],
74
+ onLayout: event => {
75
+ setHeaderLayout({
76
+ ...event.nativeEvent.layout,
77
+ height: event.nativeEvent.layout.height + navigationBarHeight
78
+ });
79
+ },
80
+ children: [/*#__PURE__*/_jsx(Animated.View, {
81
+ style: headerBackgroundAnimatedStyle,
82
+ children: /*#__PURE__*/_jsx(HeaderBackground, {})
83
+ }), HeaderContent && /*#__PURE__*/_jsx(Animated.View, {
84
+ style: [headerContentAnimatedStyle, styles.headerContentContainer],
85
+ children: /*#__PURE__*/_jsx(HeaderContent, {})
86
+ }), /*#__PURE__*/_jsx(Animated.Text, {
87
+ onLayout: event => {
88
+ setHeaderTitleLayout(event.nativeEvent.layout);
89
+ },
90
+ numberOfLines: 1,
91
+ style: [headerTitleAnimatedStyle, styles.headerTitle, headerTitleStyle],
92
+ children: title
93
+ })]
94
+ })
95
+ });
96
+ }, [navigationBarHeight, headerBackgroundAnimatedStyle, HeaderBackground, HeaderContent, headerContentAnimatedStyle, headerTitleAnimatedStyle, headerTitleStyle, title, setHeaderLayout, setHeaderTitleLayout]);
97
+ const renderItem = useCallback(({
98
+ item
99
+ }) => {
100
+ if (item === 'HEADER') {
101
+ return /*#__PURE__*/_jsxs(View, {
102
+ style: [styles.stickyHeaderContainer, {
103
+ height: navigationBarHeight + stickyComponentLayout.height
104
+ }],
105
+ children: [/*#__PURE__*/_jsx(Animated.View, {
106
+ style: [stickyHeaderAnimatedStyle, styles.stickyHeader, {
107
+ bottom: headerLayout.height - navigationBarHeight * 2 + stickyComponentLayout.height
108
+ }],
109
+ children: ListHeaderComponent
110
+ }), StickyComponent && /*#__PURE__*/_jsx(View, {
111
+ style: styles.stickyComponentContainer,
112
+ onLayout: event => {
113
+ setStickyComponentLayout(event.nativeEvent.layout);
114
+ },
115
+ children: /*#__PURE__*/_jsx(StickyComponent, {})
116
+ })]
117
+ });
118
+ }
119
+ return flatListProps.renderItem && typeof flatListProps.renderItem === 'function' ? flatListProps.renderItem({
120
+ item
121
+ }) : null;
122
+ }, [flatListProps, navigationBarHeight, stickyComponentLayout.height, stickyHeaderAnimatedStyle, headerLayout.height, ListHeaderComponent, StickyComponent, setStickyComponentLayout]);
123
+ return /*#__PURE__*/_jsx(Animated.FlatList, {
124
+ ...flatListProps,
125
+ style: style,
126
+ stickyHeaderHiddenOnScroll: false,
127
+ stickyHeaderIndices: [1],
128
+ ListHeaderComponent: /*#__PURE__*/_jsx(Animated.View, {
129
+ style: [styles.mainHeaderContainer, {
130
+ height: headerLayout.height - navigationBarHeight * 2,
131
+ transform: [{
132
+ translateY: navigationBarHeight
133
+ }]
134
+ }],
135
+ children: ListHeaderComponent
136
+ }),
137
+ onScroll: scrollHandler,
138
+ data: ['HEADER', ...(Array.isArray(flatListProps.data) ? flatListProps.data : [])],
139
+ renderItem: renderItem
140
+ });
141
+ }
142
+ const styles = StyleSheet.create({
143
+ navigationBar: {
144
+ backgroundColor: 'transparent'
145
+ },
146
+ titleStyle: {
147
+ left: 0,
148
+ right: 0,
149
+ top: 0,
150
+ bottom: 0
151
+ },
152
+ headerWrapper: {
153
+ overflow: 'visible'
154
+ },
155
+ headerContainer: {
156
+ left: 0,
157
+ right: 0,
158
+ overflow: 'visible',
159
+ position: 'absolute'
160
+ },
161
+ stickyHeaderContainer: {
162
+ overflow: 'scroll'
163
+ },
164
+ stickyHeader: {
165
+ position: 'absolute',
166
+ left: 0,
167
+ right: 0
168
+ },
169
+ mainHeaderContainer: {
170
+ overflow: 'visible'
171
+ },
172
+ headerTitle: {
173
+ position: 'absolute'
174
+ },
175
+ stickyComponentContainer: {
176
+ position: 'absolute',
177
+ bottom: 0,
178
+ left: 0,
179
+ right: 0
180
+ },
181
+ headerContentContainer: {
182
+ position: 'absolute',
183
+ top: 0,
184
+ left: 0,
185
+ right: 0,
186
+ bottom: 0
187
+ }
188
+ });
189
+ //# sourceMappingURL=AnimatedHeaderFlatList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StyleSheet","View","useLayoutEffect","useCallback","useMemo","useAnimatedHeaderFlatListAnimatedStyles","Animated","jsx","_jsx","jsxs","_jsxs","AnimatedHeaderFlatList","navigation","title","headerTitleStyle","navigationTitleStyle","HeaderBackground","HeaderContent","StickyComponent","style","flatListProps","getFontSizeFromStyle","textStyle","undefined","Array","isArray","styleItem","fontSize","scrollHandler","navigationBarHeight","headerLayout","setHeaderLayout","setHeaderTitleLayout","stickyComponentLayout","setStickyComponentLayout","navigationTitleAnimatedStyle","headerTitleAnimatedStyle","stickyHeaderAnimatedStyle","headerContentAnimatedStyle","headerBackgroundAnimatedStyle","headerTitleFontSize","navigationTitleFontSize","navigationTitle","Text","styles","titleStyle","numberOfLines","children","setOptions","headerShown","headerStyle","navigationBar","headerShadowVisible","headerTransparent","headerTitle","headerTitleAlign","ListHeaderComponent","headerWrapper","headerContainer","top","onLayout","event","nativeEvent","layout","height","headerContentContainer","renderItem","item","stickyHeaderContainer","stickyHeader","bottom","stickyComponentContainer","FlatList","stickyHeaderHiddenOnScroll","stickyHeaderIndices","mainHeaderContainer","transform","translateY","onScroll","data","create","backgroundColor","left","right","overflow","position"],"sourceRoot":"../../../src","sources":["components/AnimatedHeaderFlatList.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,UAAU,EACVC,IAAI,QAMC,cAAc;AACrB,SAASC,eAAe,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAG7D,SAASC,uCAAuC,QAAQ,qDAAkD;AAC1G,OAAOC,QAAQ,MAAM,yBAAyB;;AAE9C;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAkBA,OAAO,SAASC,sBAAsBA,CAAI;EACxCC,UAAU;EACVC,KAAK;EACLC,gBAAgB;EAChBC,oBAAoB;EACpBC,gBAAgB;EAChBC,aAAa;EACbC,eAAe;EACfC,KAAK;EACL,GAAGC;AAC2B,CAAC,EAAE;EACjC,MAAMC,oBAAoB,GAAGlB,WAAW,CACrCmB,SAA+B,IAAK;IACnC,IAAI,CAACA,SAAS,EAAE,OAAOC,SAAS;IAChC,IAAIC,KAAK,CAACC,OAAO,CAACH,SAAS,CAAC,EAAE;MAC5B,KAAK,MAAMI,SAAS,IAAIJ,SAAS,EAAE;QACjC,IACEI,SAAS,IACT,OAAOA,SAAS,KAAK,QAAQ,IAC7B,UAAU,IAAIA,SAAS,EACvB;UACA,OAAOA,SAAS,CAACC,QAAQ;QAC3B;MACF;IACF,CAAC,MAAM,IAAI,OAAOL,SAAS,KAAK,QAAQ,IAAI,UAAU,IAAIA,SAAS,EAAE;MACnE,OAAOA,SAAS,CAACK,QAAQ;IAC3B;IACA,OAAOJ,SAAS;EAClB,CAAC,EACD,EACF,CAAC;EAED,MAAM;IACJK,aAAa;IACbC,mBAAmB;IACnBC,YAAY;IACZC,eAAe;IACfC,oBAAoB;IACpBC,qBAAqB;IACrBC,wBAAwB;IACxBC,4BAA4B;IAC5BC,wBAAwB;IACxBC,yBAAyB;IACzBC,0BAA0B;IAC1BC;EACF,CAAC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';
4
+ import { useState } from 'react';
5
+ import { useWindowDimensions } from 'react-native';
6
+ import { interpolate, useAnimatedScrollHandler, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
7
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
8
+ export const useAnimatedHeaderFlatListAnimatedStyles = ({
9
+ headerTitleFontSize,
10
+ navigationTitleFontSize
11
+ }) => {
12
+ const {
13
+ width: windowWidth
14
+ } = useWindowDimensions();
15
+ const scrollY = useSharedValue(0);
16
+ const navigationBarHeight = useHeaderHeight();
17
+ const safeAreaInsets = useSafeAreaInsets();
18
+ const [headerLayout, setHeaderLayout] = useState({
19
+ x: 0,
20
+ y: 0,
21
+ width: 0,
22
+ height: 0
23
+ });
24
+ const [headerTitleLayout, setHeaderTitleLayout] = useState({
25
+ x: 0,
26
+ y: 0,
27
+ width: 0,
28
+ height: 0
29
+ });
30
+ const [stickyComponentLayout, setStickyComponentLayout] = useState({
31
+ x: 0,
32
+ y: 0,
33
+ width: 0,
34
+ height: 0
35
+ });
36
+ const distanceBetweenTitleAndNavigationBar = (navigationBarHeight - safeAreaInsets.top + headerTitleLayout.height) / 2 + headerTitleLayout.y - navigationBarHeight;
37
+ const navigationTitleOpacity = useSharedValue(0);
38
+ const stickyHeaderOpacity = useSharedValue(0);
39
+ const navigationTitleAnimatedStyle = useAnimatedStyle(() => {
40
+ return {
41
+ opacity: navigationTitleOpacity.value
42
+ };
43
+ });
44
+ const headerTitleAnimatedStyle = useAnimatedStyle(() => {
45
+ return {
46
+ opacity: 1 - navigationTitleOpacity.value,
47
+ transform: [{
48
+ translateX: interpolate(scrollY.value, [0, distanceBetweenTitleAndNavigationBar], [0, windowWidth / 2 - headerTitleLayout.x - headerTitleLayout.width / 2], 'clamp')
49
+ }, {
50
+ scale: interpolate(scrollY.value, [0, distanceBetweenTitleAndNavigationBar], [1, navigationTitleFontSize && headerTitleFontSize ? navigationTitleFontSize / headerTitleFontSize : 1], 'clamp')
51
+ }]
52
+ };
53
+ });
54
+ const stickyHeaderAnimatedStyle = useAnimatedStyle(() => {
55
+ return {
56
+ opacity: stickyHeaderOpacity.value
57
+ };
58
+ });
59
+ const headerContentAnimatedStyle = useAnimatedStyle(() => {
60
+ return {
61
+ opacity: interpolate(scrollY.value, [0, headerLayout.height - navigationBarHeight * 2], [1, 0], 'clamp')
62
+ };
63
+ });
64
+ const headerBackgroundAnimatedStyle = useAnimatedStyle(() => {
65
+ if (scrollY.value >= 0) {
66
+ return {};
67
+ }
68
+ return {
69
+ transform: [{
70
+ translateY: interpolate(scrollY.value, [scrollY.value, 0], [scrollY.value / 2, 0], 'clamp')
71
+ }, {
72
+ scale: interpolate(scrollY.value, [scrollY.value, 0], [1 - scrollY.value / (headerLayout.height - navigationBarHeight), 1, 1], 'clamp')
73
+ }]
74
+ };
75
+ });
76
+ const scrollHandler = useAnimatedScrollHandler(event => {
77
+ scrollY.value = event.contentOffset.y;
78
+ navigationTitleOpacity.value = event.contentOffset.y >= distanceBetweenTitleAndNavigationBar ? 1 : 0;
79
+ stickyHeaderOpacity.value = event.contentOffset.y >= headerLayout.height - navigationBarHeight * 2 ? 1 : 0;
80
+ });
81
+ return {
82
+ scrollHandler,
83
+ navigationBarHeight,
84
+ headerLayout,
85
+ setHeaderLayout,
86
+ headerTitleLayout,
87
+ setHeaderTitleLayout,
88
+ stickyComponentLayout,
89
+ setStickyComponentLayout,
90
+ navigationTitleAnimatedStyle,
91
+ headerTitleAnimatedStyle,
92
+ stickyHeaderAnimatedStyle,
93
+ headerContentAnimatedStyle,
94
+ headerBackgroundAnimatedStyle
95
+ };
96
+ };
97
+ //# sourceMappingURL=useAnimatedHeaderFlatListAnimatedStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useHeaderHeight","useState","useWindowDimensions","interpolate","useAnimatedScrollHandler","useAnimatedStyle","useSharedValue","useSafeAreaInsets","useAnimatedHeaderFlatListAnimatedStyles","headerTitleFontSize","navigationTitleFontSize","width","windowWidth","scrollY","navigationBarHeight","safeAreaInsets","headerLayout","setHeaderLayout","x","y","height","headerTitleLayout","setHeaderTitleLayout","stickyComponentLayout","setStickyComponentLayout","distanceBetweenTitleAndNavigationBar","top","navigationTitleOpacity","stickyHeaderOpacity","navigationTitleAnimatedStyle","opacity","value","headerTitleAnimatedStyle","transform","translateX","scale","stickyHeaderAnimatedStyle","headerContentAnimatedStyle","headerBackgroundAnimatedStyle","translateY","scrollHandler","event","contentOffset"],"sourceRoot":"../../../src","sources":["hooks/useAnimatedHeaderFlatListAnimatedStyles.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,QAAQ,QAAQ,OAAO;AAChC,SACEC,mBAAmB,QAGd,cAAc;AACrB,SACEC,WAAW,EACXC,wBAAwB,EACxBC,gBAAgB,EAChBC,cAAc,QAGT,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC;AAuBlE,OAAO,MAAMC,uCAAuC,GAAGA,CAAC;EACtDC,mBAAmB;EACnBC;AACyC,CAAC,KAA2C;EACrF,MAAM;IAAEC,KAAK,EAAEC;EAAY,CAAC,GAAGV,mBAAmB,CAAC,CAAC;EACpD,MAAMW,OAAO,GAAGP,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMQ,mBAAmB,GAAGd,eAAe,CAAC,CAAC;EAC7C,MAAMe,cAAc,GAAGR,iBAAiB,CAAC,CAAC;EAC1C,MAAM,CAACS,YAAY,EAAEC,eAAe,CAAC,GAAGhB,QAAQ,CAAkB;IAChEiB,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJR,KAAK,EAAE,CAAC;IACRS,MAAM,EAAE;EACV,CAAC,CAAC;EACF,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGrB,QAAQ,CAAkB;IAC1EiB,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJR,KAAK,EAAE,CAAC;IACRS,MAAM,EAAE;EACV,CAAC,CAAC;EACF,MAAM,CAACG,qBA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ACvB,CAAC,IAAIH,YAAY,CAACI,MAAM,GAAGN,mBAAmB,GAAG,CAAC,GAClE,CAAC,GACD,CAAC;EACT,CAAC,CAAC;EAEF,OAAO;IACL0B,aAAa;IACb1B,mBAAmB;IACnBE,YAAY;IACZC,eAAe;IACfI,iBAAiB;IACjBC,oBAAoB;IACpBC,qBAAqB;IACrBC,wBAAwB;IACxBK,4BAA4B;IAC5BG,wBAAwB;IACxBI,yBAAyB;IACzBC,0BAA0B;IAC1BC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { AnimatedHeaderFlatList } from "./components/AnimatedHeaderFlatList.js";
4
+ export { AnimatedHeaderFlatList };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AnimatedHeaderFlatList"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,wCAAqC;AAE5E,SAASA,sBAAsB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
3
+ import type { FlatListPropsWithLayout } from 'react-native-reanimated';
4
+ import { type NavigationProp } from '@react-navigation/native';
5
+ interface Props {
6
+ navigation: NavigationProp<any>;
7
+ title: string;
8
+ headerTitleStyle?: StyleProp<TextStyle>;
9
+ navigationTitleStyle?: StyleProp<TextStyle>;
10
+ HeaderBackground: React.ComponentType<any>;
11
+ HeaderContent?: React.ComponentType<any>;
12
+ StickyComponent?: React.ComponentType<any>;
13
+ style?: StyleProp<ViewStyle>;
14
+ }
15
+ type AnimatedHeaderFlatListProps<T> = Omit<FlatListPropsWithLayout<T>, keyof Props> & Props;
16
+ export declare function AnimatedHeaderFlatList<T>({ navigation, title, headerTitleStyle, navigationTitleStyle, HeaderBackground, HeaderContent, StickyComponent, style, ...flatListProps }: AnimatedHeaderFlatListProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=AnimatedHeaderFlatList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedHeaderFlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/AnimatedHeaderFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D,UAAU,KAAK;IACb,UAAU,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,oBAAoB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,KAAK,2BAA2B,CAAC,CAAC,IAAI,IAAI,CACxC,uBAAuB,CAAC,CAAC,CAAC,EAC1B,MAAM,KAAK,CACZ,GACC,KAAK,CAAC;AAER,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,EACxC,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,2BAA2B,CAAC,CAAC,CAAC,2CA8MhC"}
@@ -0,0 +1,24 @@
1
+ import { type LayoutRectangle, type ViewStyle } from 'react-native';
2
+ import { type AnimatedStyle, type ScrollHandlerProcessed } from 'react-native-reanimated';
3
+ type AnimatedHeaderFlatListAnimatedStylesProps = {
4
+ headerTitleFontSize?: number;
5
+ navigationTitleFontSize?: number;
6
+ };
7
+ type AnimatedHeaderFlatListAnimatedStyles = {
8
+ scrollHandler: ScrollHandlerProcessed<Record<string, unknown>>;
9
+ navigationBarHeight: number;
10
+ headerLayout: LayoutRectangle;
11
+ setHeaderLayout: (layout: LayoutRectangle) => void;
12
+ headerTitleLayout: LayoutRectangle;
13
+ setHeaderTitleLayout: (layout: LayoutRectangle) => void;
14
+ stickyComponentLayout: LayoutRectangle;
15
+ setStickyComponentLayout: (layout: LayoutRectangle) => void;
16
+ navigationTitleAnimatedStyle: AnimatedStyle<ViewStyle>;
17
+ headerTitleAnimatedStyle: AnimatedStyle<ViewStyle>;
18
+ stickyHeaderAnimatedStyle: AnimatedStyle<ViewStyle>;
19
+ headerContentAnimatedStyle: AnimatedStyle<ViewStyle>;
20
+ headerBackgroundAnimatedStyle: AnimatedStyle<ViewStyle>;
21
+ };
22
+ export declare const useAnimatedHeaderFlatListAnimatedStyles: ({ headerTitleFontSize, navigationTitleFontSize, }: AnimatedHeaderFlatListAnimatedStylesProps) => AnimatedHeaderFlatListAnimatedStyles;
23
+ export {};
24
+ //# sourceMappingURL=useAnimatedHeaderFlatListAnimatedStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedHeaderFlatListAnimatedStyles.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useAnimatedHeaderFlatListAnimatedStyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAGjC,KAAK,yCAAyC,GAAG;IAC/C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,KAAK,oCAAoC,GAAG;IAC1C,aAAa,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,eAAe,CAAC;IAC9B,eAAe,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACnD,iBAAiB,EAAE,eAAe,CAAC;IACnC,oBAAoB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACxD,qBAAqB,EAAE,eAAe,CAAC;IACvC,wBAAwB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,4BAA4B,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,wBAAwB,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnD,yBAAyB,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACpD,0BAA0B,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACrD,6BAA6B,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,uCAAuC,sDAGjD,yCAAyC,KAAG,oCAyI9C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AnimatedHeaderFlatList } from './components/AnimatedHeaderFlatList';
2
+ export { AnimatedHeaderFlatList };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
3
+ import type { FlatListPropsWithLayout } from 'react-native-reanimated';
4
+ import { type NavigationProp } from '@react-navigation/native';
5
+ interface Props {
6
+ navigation: NavigationProp<any>;
7
+ title: string;
8
+ headerTitleStyle?: StyleProp<TextStyle>;
9
+ navigationTitleStyle?: StyleProp<TextStyle>;
10
+ HeaderBackground: React.ComponentType<any>;
11
+ HeaderContent?: React.ComponentType<any>;
12
+ StickyComponent?: React.ComponentType<any>;
13
+ style?: StyleProp<ViewStyle>;
14
+ }
15
+ type AnimatedHeaderFlatListProps<T> = Omit<FlatListPropsWithLayout<T>, keyof Props> & Props;
16
+ export declare function AnimatedHeaderFlatList<T>({ navigation, title, headerTitleStyle, navigationTitleStyle, HeaderBackground, HeaderContent, StickyComponent, style, ...flatListProps }: AnimatedHeaderFlatListProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=AnimatedHeaderFlatList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedHeaderFlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/AnimatedHeaderFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D,UAAU,KAAK;IACb,UAAU,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,oBAAoB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,KAAK,2BAA2B,CAAC,CAAC,IAAI,IAAI,CACxC,uBAAuB,CAAC,CAAC,CAAC,EAC1B,MAAM,KAAK,CACZ,GACC,KAAK,CAAC;AAER,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,EACxC,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,2BAA2B,CAAC,CAAC,CAAC,2CA8MhC"}
@@ -0,0 +1,24 @@
1
+ import { type LayoutRectangle, type ViewStyle } from 'react-native';
2
+ import { type AnimatedStyle, type ScrollHandlerProcessed } from 'react-native-reanimated';
3
+ type AnimatedHeaderFlatListAnimatedStylesProps = {
4
+ headerTitleFontSize?: number;
5
+ navigationTitleFontSize?: number;
6
+ };
7
+ type AnimatedHeaderFlatListAnimatedStyles = {
8
+ scrollHandler: ScrollHandlerProcessed<Record<string, unknown>>;
9
+ navigationBarHeight: number;
10
+ headerLayout: LayoutRectangle;
11
+ setHeaderLayout: (layout: LayoutRectangle) => void;
12
+ headerTitleLayout: LayoutRectangle;
13
+ setHeaderTitleLayout: (layout: LayoutRectangle) => void;
14
+ stickyComponentLayout: LayoutRectangle;
15
+ setStickyComponentLayout: (layout: LayoutRectangle) => void;
16
+ navigationTitleAnimatedStyle: AnimatedStyle<ViewStyle>;
17
+ headerTitleAnimatedStyle: AnimatedStyle<ViewStyle>;
18
+ stickyHeaderAnimatedStyle: AnimatedStyle<ViewStyle>;
19
+ headerContentAnimatedStyle: AnimatedStyle<ViewStyle>;
20
+ headerBackgroundAnimatedStyle: AnimatedStyle<ViewStyle>;
21
+ };
22
+ export declare const useAnimatedHeaderFlatListAnimatedStyles: ({ headerTitleFontSize, navigationTitleFontSize, }: AnimatedHeaderFlatListAnimatedStylesProps) => AnimatedHeaderFlatListAnimatedStyles;
23
+ export {};
24
+ //# sourceMappingURL=useAnimatedHeaderFlatListAnimatedStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedHeaderFlatListAnimatedStyles.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useAnimatedHeaderFlatListAnimatedStyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAGjC,KAAK,yCAAyC,GAAG;IAC/C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,KAAK,oCAAoC,GAAG;IAC1C,aAAa,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,eAAe,CAAC;IAC9B,eAAe,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACnD,iBAAiB,EAAE,eAAe,CAAC;IACnC,oBAAoB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACxD,qBAAqB,EAAE,eAAe,CAAC;IACvC,wBAAwB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,4BAA4B,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,wBAAwB,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnD,yBAAyB,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACpD,0BAA0B,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACrD,6BAA6B,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,uCAAuC,sDAGjD,yCAAyC,KAAG,oCAyI9C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AnimatedHeaderFlatList } from './components/AnimatedHeaderFlatList';
2
+ export { AnimatedHeaderFlatList };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,199 @@
1
+ {
2
+ "name": "react-native-animated-header-flat-list",
3
+ "version": "1.1.0",
4
+ "description": "A React Native FlatList component with an animated collapsible header, featuring parallax effects, smooth title transitions, sticky component support, and customizable styles. Built with TypeScript and separate background/content layers in header.",
5
+ "source": "./src/index.tsx",
6
+ "main": "./lib/commonjs/index.js",
7
+ "module": "./lib/module/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./lib/typescript/module/src/index.d.ts",
12
+ "default": "./lib/module/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./lib/typescript/commonjs/src/index.d.ts",
16
+ "default": "./lib/commonjs/index.js"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "src",
22
+ "lib",
23
+ "android",
24
+ "ios",
25
+ "cpp",
26
+ "*.podspec",
27
+ "react-native.config.js",
28
+ "!ios/build",
29
+ "!android/build",
30
+ "!android/gradle",
31
+ "!android/gradlew",
32
+ "!android/gradlew.bat",
33
+ "!android/local.properties",
34
+ "!**/__tests__",
35
+ "!**/__fixtures__",
36
+ "!**/__mocks__",
37
+ "!**/.*"
38
+ ],
39
+ "scripts": {
40
+ "example": "yarn workspace react-native-animated-header-flat-list-example",
41
+ "test": "jest",
42
+ "typecheck": "tsc",
43
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
44
+ "clean": "del-cli lib",
45
+ "prepare": "bob build",
46
+ "release": "release-it"
47
+ },
48
+ "keywords": [
49
+ "react-native",
50
+ "ios",
51
+ "android",
52
+ "flat-list",
53
+ "animated"
54
+ ],
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/lukailun/react-native-animated-header-flat-list.git"
58
+ },
59
+ "author": "Karen <957458041@qq.com> (https://github.com/lukailun)",
60
+ "license": "MIT",
61
+ "bugs": {
62
+ "url": "https://github.com/lukailun/react-native-animated-header-flat-list/issues"
63
+ },
64
+ "homepage": "https://github.com/lukailun/react-native-animated-header-flat-list#readme",
65
+ "publishConfig": {
66
+ "registry": "https://registry.npmjs.org/"
67
+ },
68
+ "devDependencies": {
69
+ "@commitlint/config-conventional": "^17.0.2",
70
+ "@evilmartians/lefthook": "^1.5.0",
71
+ "@react-native/eslint-config": "^0.73.1",
72
+ "@react-navigation/elements": "^2.1.1",
73
+ "@react-navigation/native": "^7.0.4",
74
+ "@react-navigation/native-stack": "^7.1.1",
75
+ "@release-it/conventional-changelog": "^9.0.2",
76
+ "@types/jest": "^29.5.5",
77
+ "@types/react": "^18.2.44",
78
+ "commitlint": "^17.0.2",
79
+ "del-cli": "^5.1.0",
80
+ "eslint": "^8.51.0",
81
+ "eslint-config-prettier": "^9.0.0",
82
+ "eslint-plugin-prettier": "^5.0.1",
83
+ "jest": "^29.7.0",
84
+ "prettier": "^3.0.3",
85
+ "react": "18.3.1",
86
+ "react-native": "0.76.2",
87
+ "react-native-builder-bob": "^0.32.1",
88
+ "react-native-reanimated": "^3.16.2",
89
+ "react-native-safe-area-context": "^4.14.0",
90
+ "release-it": "^17.10.0",
91
+ "typescript": "^5.2.2"
92
+ },
93
+ "resolutions": {
94
+ "@types/react": "^18.2.44"
95
+ },
96
+ "peerDependencies": {
97
+ "@react-navigation/elements": ">=2.0.0",
98
+ "@react-navigation/native": ">=7.0.0",
99
+ "@react-navigation/native-stack": ">=7.0.0",
100
+ "react": "*",
101
+ "react-native": "*",
102
+ "react-native-reanimated": ">=3.0.0",
103
+ "react-native-safe-area-context": ">=4.0.0"
104
+ },
105
+ "workspaces": [
106
+ "example"
107
+ ],
108
+ "packageManager": "yarn@3.6.1",
109
+ "jest": {
110
+ "preset": "react-native",
111
+ "modulePathIgnorePatterns": [
112
+ "<rootDir>/example/node_modules",
113
+ "<rootDir>/lib/"
114
+ ]
115
+ },
116
+ "commitlint": {
117
+ "extends": [
118
+ "@commitlint/config-conventional"
119
+ ]
120
+ },
121
+ "release-it": {
122
+ "git": {
123
+ "commitMessage": "chore: release ${version}",
124
+ "tagName": "v${version}"
125
+ },
126
+ "npm": {
127
+ "publish": true
128
+ },
129
+ "github": {
130
+ "release": true
131
+ },
132
+ "plugins": {
133
+ "@release-it/conventional-changelog": {
134
+ "preset": "angular"
135
+ }
136
+ }
137
+ },
138
+ "eslintConfig": {
139
+ "root": true,
140
+ "extends": [
141
+ "@react-native",
142
+ "prettier"
143
+ ],
144
+ "rules": {
145
+ "react/react-in-jsx-scope": "off",
146
+ "prettier/prettier": [
147
+ "error",
148
+ {
149
+ "quoteProps": "consistent",
150
+ "singleQuote": true,
151
+ "tabWidth": 2,
152
+ "trailingComma": "es5",
153
+ "useTabs": false
154
+ }
155
+ ]
156
+ }
157
+ },
158
+ "eslintIgnore": [
159
+ "node_modules/",
160
+ "lib/"
161
+ ],
162
+ "prettier": {
163
+ "quoteProps": "consistent",
164
+ "singleQuote": true,
165
+ "tabWidth": 2,
166
+ "trailingComma": "es5",
167
+ "useTabs": false
168
+ },
169
+ "react-native-builder-bob": {
170
+ "source": "src",
171
+ "output": "lib",
172
+ "targets": [
173
+ [
174
+ "commonjs",
175
+ {
176
+ "esm": true
177
+ }
178
+ ],
179
+ [
180
+ "module",
181
+ {
182
+ "esm": true
183
+ }
184
+ ],
185
+ [
186
+ "typescript",
187
+ {
188
+ "project": "tsconfig.build.json",
189
+ "esm": true
190
+ }
191
+ ]
192
+ ]
193
+ },
194
+ "create-react-native-library": {
195
+ "languages": "js",
196
+ "type": "library",
197
+ "version": "0.44.2"
198
+ }
199
+ }