react-native-animated-header-flat-list 1.6.8 → 1.6.10
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/LICENSE +1 -1
- package/lib/module/components/AnimatedHeaderFlatList.js +14 -20
- package/lib/module/components/AnimatedHeaderFlatList.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/AnimatedHeaderFlatList.d.ts.map +1 -1
- package/lib/typescript/src/utils/styleUtils.d.ts +1 -1
- package/lib/typescript/src/utils/styleUtils.d.ts.map +1 -1
- package/package.json +64 -58
- package/src/components/AnimatedHeaderFlatList.tsx +73 -75
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Karen
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useLayoutEffect, useCallback, useMemo } from 'react';
|
|
4
|
-
import { StatusBar, StyleSheet, View
|
|
4
|
+
import { StatusBar, StyleSheet, View } from 'react-native';
|
|
5
5
|
import Animated from 'react-native-reanimated';
|
|
6
6
|
import { useAnimatedHeaderFlatListAnimatedStyles } from "../hooks/useAnimatedHeaderFlatListAnimatedStyles.js";
|
|
7
7
|
import { getFontSizeFromStyle } from "../utils/styleUtils.js";
|
|
@@ -43,13 +43,10 @@ function AnimatedHeaderFlatListInner({
|
|
|
43
43
|
navigationTitleTranslateX,
|
|
44
44
|
navigationTitleTranslateY
|
|
45
45
|
});
|
|
46
|
-
const navigationTitle = useCallback(() => /*#__PURE__*/_jsx(Animated.
|
|
47
|
-
style: navigationTitleAnimatedStyle,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
numberOfLines: 1,
|
|
51
|
-
children: title
|
|
52
|
-
})
|
|
46
|
+
const navigationTitle = useCallback(() => /*#__PURE__*/_jsx(Animated.Text, {
|
|
47
|
+
style: [navigationTitleAnimatedStyle, navigationTitleStyle],
|
|
48
|
+
numberOfLines: 1,
|
|
49
|
+
children: title
|
|
53
50
|
}), [navigationTitleAnimatedStyle, navigationTitleStyle, title]);
|
|
54
51
|
useLayoutEffect(() => {
|
|
55
52
|
navigation.setOptions({
|
|
@@ -61,7 +58,7 @@ function AnimatedHeaderFlatListInner({
|
|
|
61
58
|
headerTitleAlign: 'center'
|
|
62
59
|
});
|
|
63
60
|
}, [navigationTitle, navigation]);
|
|
64
|
-
const
|
|
61
|
+
const ListHeaderComponent = useMemo(() => {
|
|
65
62
|
return /*#__PURE__*/_jsx(View, {
|
|
66
63
|
style: styles.headerWrapper,
|
|
67
64
|
children: /*#__PURE__*/_jsxs(View, {
|
|
@@ -84,19 +81,16 @@ function AnimatedHeaderFlatListInner({
|
|
|
84
81
|
style: [navigationBarAnimatedStyle, styles.animatedNavigationBar, {
|
|
85
82
|
backgroundColor: navigationBarColor
|
|
86
83
|
}]
|
|
87
|
-
}), /*#__PURE__*/_jsx(Animated.
|
|
88
|
-
style: headerTitleAnimatedStyle,
|
|
84
|
+
}), /*#__PURE__*/_jsx(Animated.Text, {
|
|
89
85
|
onLayout: event => {
|
|
90
86
|
setHeaderTitleLayout(event.nativeEvent.layout);
|
|
91
87
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
children: title
|
|
96
|
-
})
|
|
88
|
+
numberOfLines: 1,
|
|
89
|
+
style: [headerTitleAnimatedStyle, styles.headerTitle, headerTitleStyle],
|
|
90
|
+
children: title
|
|
97
91
|
})]
|
|
98
92
|
})
|
|
99
|
-
}
|
|
93
|
+
});
|
|
100
94
|
}, [navigationBarHeight, parallax, headerBackgroundAnimatedStyle, HeaderBackground, HeaderContent, headerContentAnimatedStyle, headerTitleAnimatedStyle, headerTitleStyle, title, setHeaderLayout, setHeaderTitleLayout, navigationBarAnimatedStyle, navigationBarColor]);
|
|
101
95
|
const renderItem = useCallback(({
|
|
102
96
|
item
|
|
@@ -110,7 +104,7 @@ function AnimatedHeaderFlatListInner({
|
|
|
110
104
|
style: [stickyHeaderAnimatedStyle, styles.stickyHeader, {
|
|
111
105
|
bottom: headerLayout.height - navigationBarHeight * 2 + stickyComponentLayout.height
|
|
112
106
|
}],
|
|
113
|
-
children:
|
|
107
|
+
children: ListHeaderComponent
|
|
114
108
|
}), StickyComponent && /*#__PURE__*/_jsx(Animated.View, {
|
|
115
109
|
style: [styles.stickyComponentContainer, stickyComponentAnimatedStyle],
|
|
116
110
|
onLayout: event => {
|
|
@@ -123,7 +117,7 @@ function AnimatedHeaderFlatListInner({
|
|
|
123
117
|
return flatListProps.renderItem && typeof flatListProps.renderItem === 'function' ? flatListProps.renderItem({
|
|
124
118
|
item
|
|
125
119
|
}) : null;
|
|
126
|
-
}, [flatListProps, navigationBarHeight, stickyComponentLayout.height, stickyComponentAnimatedStyle, stickyHeaderAnimatedStyle, headerLayout.height,
|
|
120
|
+
}, [flatListProps, navigationBarHeight, stickyComponentLayout.height, stickyComponentAnimatedStyle, stickyHeaderAnimatedStyle, headerLayout.height, ListHeaderComponent, StickyComponent, setStickyComponentLayout]);
|
|
127
121
|
const data = useMemo(() => {
|
|
128
122
|
const listData = Array.isArray(flatListProps.data) ? flatListProps.data : [];
|
|
129
123
|
return [HEADER_ITEM, ...listData];
|
|
@@ -143,7 +137,7 @@ function AnimatedHeaderFlatListInner({
|
|
|
143
137
|
translateY: navigationBarHeight
|
|
144
138
|
}]
|
|
145
139
|
}],
|
|
146
|
-
children:
|
|
140
|
+
children: ListHeaderComponent
|
|
147
141
|
}),
|
|
148
142
|
onScroll: scrollHandler,
|
|
149
143
|
data: data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useLayoutEffect","useCallback","useMemo","StatusBar","StyleSheet","View","
|
|
1
|
+
{"version":3,"names":["forwardRef","useLayoutEffect","useCallback","useMemo","StatusBar","StyleSheet","View","Animated","useAnimatedHeaderFlatListAnimatedStyles","getFontSizeFromStyle","useNavigation","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","HEADER_ITEM","AnimatedHeaderFlatListInner","title","navigationBarColor","headerTitleStyle","navigationTitleStyle","HeaderBackground","HeaderContent","StickyComponent","parallax","navigationTitleTranslateX","navigationTitleTranslateY","flatListProps","ref","navigation","scrollHandler","navigationBarHeight","headerLayout","setHeaderLayout","setHeaderTitleLayout","stickyComponentLayout","setStickyComponentLayout","stickyComponentAnimatedStyle","navigationBarAnimatedStyle","navigationTitleAnimatedStyle","headerTitleAnimatedStyle","stickyHeaderAnimatedStyle","headerContentAnimatedStyle","headerBackgroundAnimatedStyle","headerTitleFontSize","navigationTitleFontSize","navigationTitle","Text","style","numberOfLines","children","setOptions","headerShown","headerStyle","styles","navigationBar","headerShadowVisible","headerTransparent","headerTitle","headerTitleAlign","ListHeaderComponent","headerWrapper","headerContainer","top","onLayout","event","nativeEvent","layout","height","undefined","headerContentContainer","animatedNavigationBar","backgroundColor","renderItem","item","stickyHeaderContainer","stickyHeader","bottom","stickyComponentContainer","data","listData","Array","isArray","translucent","FlatList","stickyHeaderIndices","mainHeaderContainer","transform","translateY","onScroll","create","overflow","position","left","right","width","AnimatedHeaderFlatList"],"sourceRoot":"../../../src","sources":["components/AnimatedHeaderFlatList.tsx"],"mappings":";;AAAA,SAGEA,UAAU,EACVC,eAAe,EACfC,WAAW,EACXC,OAAO,QAIF,OAAO;AACd,SAEEC,SAAS,EACTC,UAAU,EACVC,IAAI,QAMC,cAAc;AAErB,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,uCAAuC,QAAQ,qDAAkD;AAC1G,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,aAAa,QAAQ,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,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1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedHeaderFlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/AnimatedHeaderFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"AnimatedHeaderFlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/AnimatedHeaderFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EAMd,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AACf,OAAO,EACL,QAAQ,EAIR,KAAK,UAAU,EAGf,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAMvE,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,UAAU,CAAC;IAChC,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,oBAAoB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C,gBAAgB,EAAE,aAAa,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,KAAK,2BAA2B,CAAC,CAAC,IAAI,IAAI,CACxC,uBAAuB,CAAC,CAAC,CAAC,EAC1B,MAAM,KAAK,CACZ,GACC,KAAK,CAAC;AAuRR,eAAO,MAAM,sBAAsB,EAE9B,CAAC,CAAC,EACL,KAAK,EAAE,2BAA2B,CAAC,CAAC,CAAC,GAAG;IACtC,GAAG,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CACrC,KACE,YAAY,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type StyleProp, type TextStyle } from 'react-native';
|
|
2
|
-
export declare const getFontSizeFromStyle: (textStyle: StyleProp<TextStyle>) =>
|
|
2
|
+
export declare const getFontSizeFromStyle: (textStyle: StyleProp<TextStyle>) => any;
|
|
3
3
|
//# sourceMappingURL=styleUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/styleUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,WAAW,SAAS,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"styleUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/styleUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,WAAW,SAAS,CAAC,SAAS,CAAC,QAgBnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-animated-header-flat-list",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.10",
|
|
4
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
5
|
"main": "./lib/module/index.js",
|
|
7
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
8
7
|
"exports": {
|
|
9
8
|
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
10
|
"types": "./lib/typescript/src/index.d.ts",
|
|
11
11
|
"default": "./lib/module/index.js"
|
|
12
12
|
},
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
35
|
"example": "yarn workspace react-native-animated-header-flat-list-example",
|
|
36
|
-
"test": "jest",
|
|
37
|
-
"typecheck": "tsc",
|
|
38
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
39
36
|
"clean": "del-cli lib",
|
|
40
37
|
"prepare": "bob build",
|
|
41
|
-
"
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"release": "release-it --only-version"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"react-native",
|
|
@@ -62,32 +62,33 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@commitlint/config-conventional": "^19.8.1",
|
|
65
|
-
"@eslint/compat": "^1.3.
|
|
65
|
+
"@eslint/compat": "^1.3.2",
|
|
66
66
|
"@eslint/eslintrc": "^3.3.1",
|
|
67
|
-
"@eslint/js": "^9.
|
|
68
|
-
"@
|
|
69
|
-
"@react-native/eslint-config": "
|
|
70
|
-
"@react-navigation/elements": "^2.
|
|
71
|
-
"@react-navigation/native": "^7.1.
|
|
72
|
-
"@react-navigation/native-stack": "^7.
|
|
73
|
-
"@release-it/conventional-changelog": "^
|
|
74
|
-
"@types/jest": "^
|
|
75
|
-
"@types/react": "^19.1.
|
|
67
|
+
"@eslint/js": "^9.35.0",
|
|
68
|
+
"@react-native/babel-preset": "0.83.0",
|
|
69
|
+
"@react-native/eslint-config": "0.83.0",
|
|
70
|
+
"@react-navigation/elements": "^2.9.10",
|
|
71
|
+
"@react-navigation/native": "^7.1.33",
|
|
72
|
+
"@react-navigation/native-stack": "^7.14.5",
|
|
73
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
74
|
+
"@types/jest": "^29.5.14",
|
|
75
|
+
"@types/react": "^19.1.12",
|
|
76
76
|
"commitlint": "^19.8.1",
|
|
77
|
-
"del-cli": "^
|
|
78
|
-
"eslint": "^9.
|
|
77
|
+
"del-cli": "^6.0.0",
|
|
78
|
+
"eslint": "^9.35.0",
|
|
79
79
|
"eslint-config-prettier": "^10.1.8",
|
|
80
|
-
"eslint-plugin-ft-flow": "^3.0.11",
|
|
81
80
|
"eslint-plugin-prettier": "^5.5.4",
|
|
82
|
-
"jest": "^
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"react
|
|
86
|
-
"react-native
|
|
87
|
-
"react-native-
|
|
88
|
-
"react-native-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
81
|
+
"jest": "^29.7.0",
|
|
82
|
+
"lefthook": "^2.0.3",
|
|
83
|
+
"prettier": "^2.8.8",
|
|
84
|
+
"react": "19.2.0",
|
|
85
|
+
"react-native": "0.83.2",
|
|
86
|
+
"react-native-builder-bob": "^0.40.13",
|
|
87
|
+
"react-native-reanimated": "^4.2.2",
|
|
88
|
+
"react-native-safe-area-context": "^5.7.0",
|
|
89
|
+
"release-it": "^19.0.4",
|
|
90
|
+
"turbo": "^2.5.6",
|
|
91
|
+
"typescript": "^5.9.2"
|
|
91
92
|
},
|
|
92
93
|
"peerDependencies": {
|
|
93
94
|
"@react-navigation/elements": ">=2.0.0",
|
|
@@ -101,7 +102,32 @@
|
|
|
101
102
|
"workspaces": [
|
|
102
103
|
"example"
|
|
103
104
|
],
|
|
104
|
-
"packageManager": "yarn@
|
|
105
|
+
"packageManager": "yarn@4.11.0",
|
|
106
|
+
"react-native-builder-bob": {
|
|
107
|
+
"source": "src",
|
|
108
|
+
"output": "lib",
|
|
109
|
+
"targets": [
|
|
110
|
+
[
|
|
111
|
+
"module",
|
|
112
|
+
{
|
|
113
|
+
"esm": true
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"typescript",
|
|
118
|
+
{
|
|
119
|
+
"project": "tsconfig.build.json"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"prettier": {
|
|
125
|
+
"quoteProps": "consistent",
|
|
126
|
+
"singleQuote": true,
|
|
127
|
+
"tabWidth": 2,
|
|
128
|
+
"trailingComma": "es5",
|
|
129
|
+
"useTabs": false
|
|
130
|
+
},
|
|
105
131
|
"jest": {
|
|
106
132
|
"preset": "react-native",
|
|
107
133
|
"modulePathIgnorePatterns": [
|
|
@@ -129,39 +155,19 @@
|
|
|
129
155
|
"@release-it/conventional-changelog": {
|
|
130
156
|
"preset": {
|
|
131
157
|
"name": "angular"
|
|
132
|
-
}
|
|
133
|
-
"infile": "CHANGELOG.md"
|
|
158
|
+
}
|
|
134
159
|
}
|
|
135
160
|
}
|
|
136
161
|
},
|
|
137
|
-
"prettier": {
|
|
138
|
-
"quoteProps": "consistent",
|
|
139
|
-
"singleQuote": true,
|
|
140
|
-
"tabWidth": 2,
|
|
141
|
-
"trailingComma": "es5",
|
|
142
|
-
"useTabs": false
|
|
143
|
-
},
|
|
144
|
-
"react-native-builder-bob": {
|
|
145
|
-
"source": "src",
|
|
146
|
-
"output": "lib",
|
|
147
|
-
"targets": [
|
|
148
|
-
[
|
|
149
|
-
"module",
|
|
150
|
-
{
|
|
151
|
-
"esm": true
|
|
152
|
-
}
|
|
153
|
-
],
|
|
154
|
-
[
|
|
155
|
-
"typescript",
|
|
156
|
-
{
|
|
157
|
-
"project": "tsconfig.build.json"
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
]
|
|
161
|
-
},
|
|
162
162
|
"create-react-native-library": {
|
|
163
|
-
"languages": "js",
|
|
164
163
|
"type": "library",
|
|
165
|
-
"
|
|
164
|
+
"languages": "js",
|
|
165
|
+
"tools": [
|
|
166
|
+
"eslint",
|
|
167
|
+
"jest",
|
|
168
|
+
"lefthook",
|
|
169
|
+
"release-it"
|
|
170
|
+
],
|
|
171
|
+
"version": "0.57.2"
|
|
166
172
|
}
|
|
167
173
|
}
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
useLayoutEffect,
|
|
6
6
|
useCallback,
|
|
7
7
|
useMemo,
|
|
8
|
-
type ComponentType,
|
|
9
8
|
type ForwardedRef,
|
|
9
|
+
type ComponentType,
|
|
10
|
+
type ReactNode,
|
|
10
11
|
} from 'react';
|
|
11
12
|
import {
|
|
12
13
|
FlatList,
|
|
13
14
|
StatusBar,
|
|
14
15
|
StyleSheet,
|
|
15
16
|
View,
|
|
16
|
-
Text,
|
|
17
17
|
type ColorValue,
|
|
18
18
|
type LayoutChangeEvent,
|
|
19
19
|
type ListRenderItemInfo,
|
|
@@ -88,11 +88,12 @@ function AnimatedHeaderFlatListInner<T>(
|
|
|
88
88
|
|
|
89
89
|
const navigationTitle = useCallback(
|
|
90
90
|
() => (
|
|
91
|
-
<Animated.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
<Animated.Text
|
|
92
|
+
style={[navigationTitleAnimatedStyle, navigationTitleStyle]}
|
|
93
|
+
numberOfLines={1}
|
|
94
|
+
>
|
|
95
|
+
{title}
|
|
96
|
+
</Animated.Text>
|
|
96
97
|
),
|
|
97
98
|
[navigationTitleAnimatedStyle, navigationTitleStyle, title]
|
|
98
99
|
);
|
|
@@ -108,81 +109,78 @@ function AnimatedHeaderFlatListInner<T>(
|
|
|
108
109
|
});
|
|
109
110
|
}, [navigationTitle, navigation]);
|
|
110
111
|
|
|
111
|
-
const
|
|
112
|
-
(
|
|
113
|
-
|
|
114
|
-
<View
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
const ListHeaderComponent = useMemo(() => {
|
|
113
|
+
return (
|
|
114
|
+
<View style={styles.headerWrapper}>
|
|
115
|
+
<View
|
|
116
|
+
style={[styles.headerContainer, { top: -navigationBarHeight }]}
|
|
117
|
+
onLayout={(event: LayoutChangeEvent) => {
|
|
118
|
+
setHeaderLayout({
|
|
119
|
+
...event.nativeEvent.layout,
|
|
120
|
+
height: event.nativeEvent.layout.height + navigationBarHeight,
|
|
121
|
+
});
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<Animated.View
|
|
125
|
+
style={parallax ? headerBackgroundAnimatedStyle : undefined}
|
|
123
126
|
>
|
|
127
|
+
<HeaderBackground />
|
|
128
|
+
</Animated.View>
|
|
129
|
+
{HeaderContent && (
|
|
124
130
|
<Animated.View
|
|
125
|
-
style={
|
|
131
|
+
style={[
|
|
132
|
+
headerContentAnimatedStyle,
|
|
133
|
+
styles.headerContentContainer,
|
|
134
|
+
]}
|
|
126
135
|
>
|
|
127
|
-
<
|
|
136
|
+
<HeaderContent />
|
|
128
137
|
</Animated.View>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
style={[
|
|
132
|
-
headerContentAnimatedStyle,
|
|
133
|
-
styles.headerContentContainer,
|
|
134
|
-
]}
|
|
135
|
-
>
|
|
136
|
-
<HeaderContent />
|
|
137
|
-
</Animated.View>
|
|
138
|
-
)}
|
|
139
|
-
{navigationBarColor && (
|
|
140
|
-
<Animated.View
|
|
141
|
-
style={[
|
|
142
|
-
navigationBarAnimatedStyle,
|
|
143
|
-
styles.animatedNavigationBar,
|
|
144
|
-
{ backgroundColor: navigationBarColor },
|
|
145
|
-
]}
|
|
146
|
-
/>
|
|
147
|
-
)}
|
|
138
|
+
)}
|
|
139
|
+
{navigationBarColor && (
|
|
148
140
|
<Animated.View
|
|
149
|
-
style={
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
141
|
+
style={[
|
|
142
|
+
navigationBarAnimatedStyle,
|
|
143
|
+
styles.animatedNavigationBar,
|
|
144
|
+
{ backgroundColor: navigationBarColor },
|
|
145
|
+
]}
|
|
146
|
+
/>
|
|
147
|
+
)}
|
|
148
|
+
<Animated.Text
|
|
149
|
+
onLayout={(event: LayoutChangeEvent) => {
|
|
150
|
+
setHeaderTitleLayout(event.nativeEvent.layout);
|
|
151
|
+
}}
|
|
152
|
+
numberOfLines={1}
|
|
153
|
+
style={[
|
|
154
|
+
headerTitleAnimatedStyle,
|
|
155
|
+
styles.headerTitle,
|
|
156
|
+
headerTitleStyle,
|
|
157
|
+
]}
|
|
158
|
+
>
|
|
159
|
+
{title}
|
|
160
|
+
</Animated.Text>
|
|
162
161
|
</View>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
162
|
+
</View>
|
|
163
|
+
);
|
|
164
|
+
}, [
|
|
165
|
+
navigationBarHeight,
|
|
166
|
+
parallax,
|
|
167
|
+
headerBackgroundAnimatedStyle,
|
|
168
|
+
HeaderBackground,
|
|
169
|
+
HeaderContent,
|
|
170
|
+
headerContentAnimatedStyle,
|
|
171
|
+
headerTitleAnimatedStyle,
|
|
172
|
+
headerTitleStyle,
|
|
173
|
+
title,
|
|
174
|
+
setHeaderLayout,
|
|
175
|
+
setHeaderTitleLayout,
|
|
176
|
+
navigationBarAnimatedStyle,
|
|
177
|
+
navigationBarColor,
|
|
178
|
+
]);
|
|
181
179
|
|
|
182
180
|
type CustomItem = typeof HEADER_ITEM | T;
|
|
183
181
|
|
|
184
182
|
const renderItem = useCallback(
|
|
185
|
-
({ item }: ListRenderItemInfo<CustomItem>):
|
|
183
|
+
({ item }: ListRenderItemInfo<CustomItem>): ReactNode => {
|
|
186
184
|
if (item === HEADER_ITEM) {
|
|
187
185
|
return (
|
|
188
186
|
<View
|
|
@@ -205,7 +203,7 @@ function AnimatedHeaderFlatListInner<T>(
|
|
|
205
203
|
},
|
|
206
204
|
]}
|
|
207
205
|
>
|
|
208
|
-
{
|
|
206
|
+
{ListHeaderComponent}
|
|
209
207
|
</Animated.View>
|
|
210
208
|
{StickyComponent && (
|
|
211
209
|
<Animated.View
|
|
@@ -235,7 +233,7 @@ function AnimatedHeaderFlatListInner<T>(
|
|
|
235
233
|
stickyComponentAnimatedStyle,
|
|
236
234
|
stickyHeaderAnimatedStyle,
|
|
237
235
|
headerLayout.height,
|
|
238
|
-
|
|
236
|
+
ListHeaderComponent,
|
|
239
237
|
StickyComponent,
|
|
240
238
|
setStickyComponentLayout,
|
|
241
239
|
]
|
|
@@ -265,7 +263,7 @@ function AnimatedHeaderFlatListInner<T>(
|
|
|
265
263
|
},
|
|
266
264
|
]}
|
|
267
265
|
>
|
|
268
|
-
{
|
|
266
|
+
{ListHeaderComponent}
|
|
269
267
|
</Animated.View>
|
|
270
268
|
}
|
|
271
269
|
onScroll={scrollHandler}
|