change header and footer to be in line with emptyComponent
This commit is contained in:
@@ -73,23 +73,23 @@ function ListImpl<ItemT>(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let header: JSX.Element | null = null
|
let headerComponent: JSX.Element | null = null
|
||||||
if (ListHeaderComponent != null) {
|
if (ListHeaderComponent != null) {
|
||||||
if (isValidElement(ListHeaderComponent)) {
|
if (isValidElement(ListHeaderComponent)) {
|
||||||
header = ListHeaderComponent
|
headerComponent = ListHeaderComponent
|
||||||
} else {
|
} else {
|
||||||
// @ts-ignore Nah it's fine.
|
// @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 (ListFooterComponent != null) {
|
||||||
if (isValidElement(ListFooterComponent)) {
|
if (isValidElement(ListFooterComponent)) {
|
||||||
footer = ListFooterComponent
|
footerComponent = ListFooterComponent
|
||||||
} else {
|
} else {
|
||||||
// @ts-ignore Nah it's fine.
|
// @ts-ignore Nah it's fine.
|
||||||
footer = <ListFooterComponent />
|
footerComponent = <ListFooterComponent />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ function ListImpl<ItemT>(
|
|||||||
topMargin={(onStartReachedThreshold ?? 0) * 100 + '%'}
|
topMargin={(onStartReachedThreshold ?? 0) * 100 + '%'}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{header}
|
{headerComponent}
|
||||||
{!data || data.length === 0
|
{!data || data.length === 0
|
||||||
? emptyComponent
|
? emptyComponent
|
||||||
: (data as Array<ItemT>)?.map((item, index) => {
|
: (data as Array<ItemT>)?.map((item, index) => {
|
||||||
@@ -365,7 +365,7 @@ function ListImpl<ItemT>(
|
|||||||
bottomMargin={(onEndReachedThreshold ?? 0) * 100 + '%'}
|
bottomMargin={(onEndReachedThreshold ?? 0) * 100 + '%'}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{footer}
|
{footerComponent}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user