diff --git a/src/view/com/util/List.web.tsx b/src/view/com/util/List.web.tsx index e5613ddd01..10c515f2ac 100644 --- a/src/view/com/util/List.web.tsx +++ b/src/view/com/util/List.web.tsx @@ -1,4 +1,4 @@ -import React, {memo, useRef, startTransition} from 'react' +import React, {isValidElement, memo, useRef, startTransition} from 'react' import {FlatListProps, StyleSheet, View, ViewProps} from 'react-native' import {addStyle} from 'lib/styles' import {usePalette} from 'lib/hooks/usePalette' @@ -56,21 +56,21 @@ function ListImpl( let header: JSX.Element | null = null if (ListHeaderComponent != null) { - if (typeof ListHeaderComponent === 'object') { + if (isValidElement(ListHeaderComponent)) { header = ListHeaderComponent - } else if (typeof ListHeaderComponent === 'function') { - // @ts-ignore We aren't using classes so it's a render function. - header = ListHeaderComponent() + } else { + // @ts-ignore Nah it's fine. + header = } } let footer: JSX.Element | null = null if (ListFooterComponent != null) { - if (typeof ListFooterComponent === 'object') { + if (isValidElement(ListFooterComponent)) { footer = ListFooterComponent - } else if (typeof ListFooterComponent === 'function') { - // @ts-ignore We aren't using classes so it's a render function. - footer = ListFooterComponent() + } else { + // @ts-ignore Nah it's fine. + footer = } }