change header and footer to be in line with emptyComponent

This commit is contained in:
Hailey
2024-06-06 16:14:34 -07:00
parent 5b976972f5
commit b0315cb558
+8 -8
View File
@@ -73,23 +73,23 @@ function ListImpl<ItemT>(
)
}
let header: JSX.Element | null = null
let headerComponent: JSX.Element | null = null
if (ListHeaderComponent != null) {
if (isValidElement(ListHeaderComponent)) {
header = ListHeaderComponent
headerComponent = ListHeaderComponent
} else {
// @ts-ignore Nah it's fine.
header = <ListHeaderComponent />
headerComponent = <ListHeaderComponent />
}
}
let footer: JSX.Element | null = null
let footerComponent: JSX.Element | null = null
if (ListFooterComponent != null) {
if (isValidElement(ListFooterComponent)) {
footer = ListFooterComponent
footerComponent = ListFooterComponent
} else {
// @ts-ignore Nah it's fine.
footer = <ListFooterComponent />
footerComponent = <ListFooterComponent />
}
}
@@ -341,7 +341,7 @@ function ListImpl<ItemT>(
topMargin={(onStartReachedThreshold ?? 0) * 100 + '%'}
/>
)}
{header}
{headerComponent}
{!data || data.length === 0
? emptyComponent
: (data as Array<ItemT>)?.map((item, index) => {
@@ -365,7 +365,7 @@ function ListImpl<ItemT>(
bottomMargin={(onEndReachedThreshold ?? 0) * 100 + '%'}
/>
)}
{footer}
{footerComponent}
</View>
</View>
)