[UI > AddonPage] Move back to FlatList

This commit is contained in:
Beef 2023-05-13 00:15:11 +01:00
parent 0dae5b17e5
commit 63fd59e826

View file

@ -18,7 +18,9 @@ export default function AddonPage<T>({ items, safeModeMessage, safeModeExtras, c
return ( return (
<ErrorBoundary> <ErrorBoundary>
<RN.ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: 10 }}> {/* TODO: Implement better searching than just by ID */}
<RN.FlatList
ListHeaderComponent={<>
{settings.safeMode?.enabled && <RN.View style={{ marginBottom: 10 }}> {settings.safeMode?.enabled && <RN.View style={{ marginBottom: 10 }}>
<HelpMessage messageType={0}>{safeModeMessage}</HelpMessage> <HelpMessage messageType={0}>{safeModeMessage}</HelpMessage>
{safeModeExtras} {safeModeExtras}
@ -28,10 +30,12 @@ export default function AddonPage<T>({ items, safeModeMessage, safeModeExtras, c
onChangeText={(v: string) => setSearch(v.toLowerCase())} onChangeText={(v: string) => setSearch(v.toLowerCase())}
placeholder="Search" placeholder="Search"
/> />
{/* TODO: When I am more awake, implement better searching than just by ID */} </>}
{/* TODO: Also when I am more awake, make the search bar not scroll with the cards */} style={{ paddingHorizontal: 10, paddingTop: 10 }}
{Object.values(items).filter(i => i.id?.toLowerCase().includes(search)).map((i, id) => <CardComponent item={i} index={id} />)} contentContainerStyle={{ paddingBottom: 20 }}
</RN.ScrollView> data={Object.values(items).filter(i => i.id?.toLowerCase().includes(search))}
renderItem={({ item, index }) => <CardComponent item={item} index={index} />}
/>
</ErrorBoundary> </ErrorBoundary>
) )
} }