Skip to content

Commit d29e42c

Browse files
aharwood9e-younan
authored andcommitted
fix: ensure large header subtitle doesn't rely on large header
1 parent 160ff01 commit d29e42c

File tree

4 files changed

+35
-39
lines changed

4 files changed

+35
-39
lines changed

src/components/containers/FlashList.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ const FlashListWithHeadersInputComp = <ItemT extends any = any>(
131131
...scrollIndicatorInsets,
132132
}}
133133
ListHeaderComponent={
134-
LargeHeaderComponent ? (
135-
<>
134+
<>
135+
{LargeHeaderComponent && (
136136
<View
137137
onLayout={(e) => {
138138
largeHeaderHeight.value = e.nativeEvent.layout.height;
@@ -150,10 +150,9 @@ const FlashListWithHeadersInputComp = <ItemT extends any = any>(
150150
</View>
151151
)}
152152
</View>
153-
{LargeHeaderSubtitleComponent &&
154-
LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
155-
</>
156-
) : undefined
153+
)}
154+
{LargeHeaderSubtitleComponent && LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
155+
</>
157156
}
158157
inverted={inverted}
159158
{...rest}

src/components/containers/FlatList.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ const FlatListWithHeadersInputComp = <ItemT extends unknown>(
130130
...scrollIndicatorInsets,
131131
}}
132132
ListHeaderComponent={
133-
LargeHeaderComponent ? (
134-
<>
133+
<>
134+
{LargeHeaderComponent && (
135135
<View
136136
onLayout={(e) => {
137137
largeHeaderHeight.value = e.nativeEvent.layout.height;
@@ -149,10 +149,9 @@ const FlatListWithHeadersInputComp = <ItemT extends unknown>(
149149
</View>
150150
)}
151151
</View>
152-
{LargeHeaderSubtitleComponent &&
153-
LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
154-
</>
155-
) : undefined
152+
)}
153+
{LargeHeaderSubtitleComponent && LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
154+
</>
156155
}
157156
inverted={inverted}
158157
{...rest}

src/components/containers/ScrollView.tsx

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -130,28 +130,27 @@ const ScrollViewWithHeadersInputComp = (
130130
}}
131131
{...rest}
132132
>
133-
{LargeHeaderComponent ? (
134-
<>
135-
<View
136-
onLayout={(e) => {
137-
largeHeaderHeight.value = e.nativeEvent.layout.height;
133+
{LargeHeaderComponent && (
134+
<View
135+
onLayout={(e) => {
136+
largeHeaderHeight.value = e.nativeEvent.layout.height;
137+
138+
if (onLargeHeaderLayout) onLargeHeaderLayout(e.nativeEvent.layout);
139+
}}
140+
>
141+
{!disableLargeHeaderFadeAnim ? (
142+
<FadingView opacity={largeHeaderOpacity} style={largeHeaderContainerStyle}>
143+
{LargeHeaderComponent({ scrollY, showNavBar })}
144+
</FadingView>
145+
) : (
146+
<View style={largeHeaderContainerStyle}>
147+
{LargeHeaderComponent({ scrollY, showNavBar })}
148+
</View>
149+
)}
150+
</View>
151+
)}
152+
{LargeHeaderSubtitleComponent && LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
138153

139-
if (onLargeHeaderLayout) onLargeHeaderLayout(e.nativeEvent.layout);
140-
}}
141-
>
142-
{!disableLargeHeaderFadeAnim ? (
143-
<FadingView opacity={largeHeaderOpacity} style={largeHeaderContainerStyle}>
144-
{LargeHeaderComponent({ scrollY, showNavBar })}
145-
</FadingView>
146-
) : (
147-
<View style={largeHeaderContainerStyle}>
148-
{LargeHeaderComponent({ scrollY, showNavBar })}
149-
</View>
150-
)}
151-
</View>
152-
{LargeHeaderSubtitleComponent && LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
153-
</>
154-
) : null}
155154
{children}
156155
</AnimatedScrollView>
157156

src/components/containers/SectionList.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ const SectionListWithHeadersInputComp = <ItemT extends any = any, SectionT = Def
134134
...scrollIndicatorInsets,
135135
}}
136136
ListHeaderComponent={
137-
LargeHeaderComponent ? (
138-
<>
137+
<>
138+
{LargeHeaderComponent && (
139139
<View
140140
onLayout={(e) => {
141141
largeHeaderHeight.value = e.nativeEvent.layout.height;
@@ -153,10 +153,9 @@ const SectionListWithHeadersInputComp = <ItemT extends any = any, SectionT = Def
153153
</View>
154154
)}
155155
</View>
156-
{LargeHeaderSubtitleComponent &&
157-
LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
158-
</>
159-
) : undefined
156+
)}
157+
{LargeHeaderSubtitleComponent && LargeHeaderSubtitleComponent({ showNavBar, scrollY })}
158+
</>
160159
}
161160
inverted={inverted}
162161
{...rest}

0 commit comments

Comments
 (0)