From b789f98ba16b22be61fda1eefad388f43db7eb34 Mon Sep 17 00:00:00 2001 From: Samuel Holmes Date: Tue, 23 Jan 2024 15:11:36 -0800 Subject: [PATCH] Fix "done footer" render for sorting mode on WalletListScene --- src/components/scenes/WalletListScene.tsx | 35 ++++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/components/scenes/WalletListScene.tsx b/src/components/scenes/WalletListScene.tsx index 24eecdbc887..1c3a3d670e6 100644 --- a/src/components/scenes/WalletListScene.tsx +++ b/src/components/scenes/WalletListScene.tsx @@ -4,7 +4,7 @@ import { View } from 'react-native' import { updateWalletsSort } from '../../actions/WalletListActions' import { useHandler } from '../../hooks/useHandler' import { lstrings } from '../../locales/strings' -import { useSceneFooterRender } from '../../state/SceneFooterState' +import { useFooterOpenRatio, useSceneFooterRender } from '../../state/SceneFooterState' import { useDispatch, useSelector } from '../../types/reactRedux' import { EdgeSceneProps } from '../../types/routerTypes' import { CrossFade } from '../common/CrossFade' @@ -12,13 +12,13 @@ import { SceneWrapper } from '../common/SceneWrapper' import { SortOption, WalletListSortModal } from '../modals/WalletListSortModal' import { Airship, showError } from '../services/AirshipInstance' import { cacheStyles, Theme, useTheme } from '../services/ThemeContext' -import { MainButton } from '../themed/MainButton' import { SceneFooterWrapper } from '../themed/SceneFooterWrapper' import { SearchFooter } from '../themed/SearchFooter' import { WalletListHeader } from '../themed/WalletListHeader' import { WalletListSortable } from '../themed/WalletListSortable' import { WalletListSwipeable } from '../themed/WalletListSwipeable' import { WiredProgressBar } from '../themed/WiredProgressBar' +import { ButtonUi4 } from '../ui4/ButtonUi4' interface Props extends EdgeSceneProps<'walletList'> {} @@ -34,12 +34,21 @@ export function WalletListScene(props: Props) { const sortOption = useSelector(state => state.ui.settings.walletsSort) + const { setKeepOpen } = useFooterOpenRatio() + + // + // Handlers + // + const handleSort = useHandler(() => { Airship.show(bridge => ) .then(sort => { if (sort == null) return if (sort !== sortOption) dispatch(updateWalletsSort(sort)) - if (sort === 'manual') setSorting(true) + if (sort === 'manual') { + setKeepOpen(true) + setSorting(true) + } }) .catch(showError) }) @@ -66,20 +75,25 @@ export function WalletListScene(props: Props) { setSearchText(value) }) - // rendering ------------------------------------------------------------- + const handlePressDone = useHandler(() => { + setKeepOpen(true) + setSorting(false) + }) - const header = React.useMemo(() => { + // + // Renders + // + + const renderHeader = React.useMemo(() => { return }, [handleSort, navigation, isSearching, sorting]) - const handlePressDone = useHandler(() => setSorting(false)) - useSceneFooterRender( sceneWrapperInfo => { return sorting ? ( - + - + ) : ( @@ -105,7 +119,7 @@ export function WalletListScene(props: Props) { ({ sortFooterContainer: { + padding: theme.rem(0.5), flexDirection: 'column', alignItems: 'center' },