From f7c05c2df44bec9feebbcb8f888cdcb49d6095d3 Mon Sep 17 00:00:00 2001 From: Chenyu Huang Date: Wed, 20 Aug 2025 12:31:12 -0700 Subject: use Dialog.InnerFlatlist --- src/components/dialogs/StarterPackDialog.tsx | 171 ++++++++++++++------------- 1 file changed, 89 insertions(+), 82 deletions(-) (limited to 'src/components') diff --git a/src/components/dialogs/StarterPackDialog.tsx b/src/components/dialogs/StarterPackDialog.tsx index f9076001f..a8e775958 100644 --- a/src/components/dialogs/StarterPackDialog.tsx +++ b/src/components/dialogs/StarterPackDialog.tsx @@ -19,7 +19,6 @@ import { useListMembershipAddMutation, useListMembershipRemoveMutation, } from '#/state/queries/list-memberships' -import {List} from '#/view/com/util/List' import * as Toast from '#/view/com/util/Toast' import {UserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, useTheme} from '#/alf' @@ -72,38 +71,15 @@ export function StarterPackDialog({ ], }) - const onClose = React.useCallback(() => { - control.close() - }, [control]) - - const t = useTheme() - return ( - - - - - Add to starter packs - - - - - - - + ) } @@ -113,8 +89,7 @@ function Empty({onStartWizard}: {onStartWizard: () => void}) { const t = useTheme() return ( - + void}) { - + + + ) } function StarterPackList({ + control, onStartWizard, targetDid, enabled, }: { + control: Dialog.DialogControlProps onStartWizard: () => void targetDid: string enabled?: boolean }) { const {_} = useLingui() + const t = useTheme() const { data, @@ -187,54 +167,81 @@ function StarterPackList({ [targetDid], ) - const ListHeaderComponent = React.useCallback( - () => ( - <> - - - New starter pack - - - - - - ), - [_, onStartWizard], + const onClose = React.useCallback(() => { + control.close() + }, [control]) + + const listHeader = ( + <> + + + Add to starter packs + + + + {membershipItems.length > 0 && ( + <> + + + New starter pack + + + + + + )} + ) if (isLoading) { return ( - - - + <> + + + + + ) } return ( - - item.starterPack.uri || index.toString() - } - refreshing={false} - onRefresh={_onRefresh} - onEndReached={_onEndReached} - onEndReachedThreshold={0.1} - ListHeaderComponent={ - membershipItems.length > 0 ? ListHeaderComponent : null - } - ListEmptyComponent={} - /> + <> + + + item.starterPack.uri || index.toString() + } + refreshing={false} + onRefresh={_onRefresh} + onEndReached={_onEndReached} + onEndReachedThreshold={0.1} + ListHeaderComponent={listHeader} + ListEmptyComponent={} + contentContainerStyle={[a.px_2xl, a.pt_lg]} + /> + ) } -- cgit 1.4.1