FIX: Allow manage list to be scrollable

This commit is contained in:
Marcos Rodriguez Velez 2025-01-07 22:20:09 -04:00
parent 0ee3da9dc0
commit 56f3ac22c2
2 changed files with 10 additions and 6 deletions

View File

@ -38,6 +38,7 @@ interface ManageWalletsListItemProps {
handleDeleteWallet: (wallet: TWallet) => void; handleDeleteWallet: (wallet: TWallet) => void;
handleToggleHideBalance: (wallet: TWallet) => void; handleToggleHideBalance: (wallet: TWallet) => void;
isActive?: boolean; isActive?: boolean;
style?: ViewStyle;
} }
interface SwipeContentProps { interface SwipeContentProps {
@ -74,6 +75,7 @@ const ManageWalletsListItem: React.FC<ManageWalletsListItemProps> = ({
onPressIn, onPressIn,
onPressOut, onPressOut,
isActive, isActive,
style,
}) => { }) => {
const { colors } = useTheme(); const { colors } = useTheme();
@ -114,7 +116,7 @@ const ManageWalletsListItem: React.FC<ManageWalletsListItemProps> = ({
<ListItem.Swipeable <ListItem.Swipeable
leftWidth={80} leftWidth={80}
rightWidth={90} rightWidth={90}
containerStyle={{ backgroundColor: colors.background }} containerStyle={[{ backgroundColor: colors.background }, style]}
leftContent={leftContent} leftContent={leftContent}
rightContent={rightContent} rightContent={rightContent}
Component={TouchableOpacityWrapper} Component={TouchableOpacityWrapper}
@ -158,7 +160,6 @@ const ManageWalletsListItem: React.FC<ManageWalletsListItemProps> = ({
); );
} }
console.error('Unrecognized item type:', item);
return null; return null;
}; };

View File

@ -430,14 +430,15 @@ const ManageWallets: React.FC = () => {
}, },
[goBack, navigate], [goBack, navigate],
); );
const renderItem = useCallback( const renderItem = useCallback(
(info: DragListRenderItemInfo<Item>) => { (info: DragListRenderItemInfo<Item>) => {
const { item, onDragStart, onDragEnd, isActive } = info; const { item, onDragStart, isActive } = info;
return ( return (
<ManageWalletsListItem <ManageWalletsListItem
item={item} item={item}
onPressIn={state.isSearchFocused || state.searchQuery.length > 0 ? undefined : onDragStart} onPressIn={state.isSearchFocused || state.searchQuery.length > 0 ? undefined : undefined}
onPressOut={state.isSearchFocused || state.searchQuery.length > 0 ? undefined : onDragEnd} onPressOut={state.isSearchFocused || state.searchQuery.length > 0 ? undefined : undefined}
isDraggingDisabled={state.searchQuery.length > 0 || state.isSearchFocused} isDraggingDisabled={state.searchQuery.length > 0 || state.isSearchFocused}
state={state} state={state}
navigateToWallet={navigateToWallet} navigateToWallet={navigateToWallet}
@ -445,7 +446,7 @@ const ManageWallets: React.FC = () => {
handleDeleteWallet={handleDeleteWallet} handleDeleteWallet={handleDeleteWallet}
handleToggleHideBalance={handleToggleHideBalance} handleToggleHideBalance={handleToggleHideBalance}
isActive={isActive} isActive={isActive}
drag={state.isSearchFocused || state.searchQuery.length > 0 ? undefined : onDragStart} drag={onDragStart}
/> />
); );
}, },
@ -457,6 +458,8 @@ const ManageWallets: React.FC = () => {
const copy = [...state.order]; const copy = [...state.order];
const removed = copy.splice(fromIndex, 1); const removed = copy.splice(fromIndex, 1);
copy.splice(toIndex, 0, removed[0]); copy.splice(toIndex, 0, removed[0]);
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
dispatch({ type: SET_TEMP_ORDER, payload: copy }); dispatch({ type: SET_TEMP_ORDER, payload: copy });
dispatch({ dispatch({
type: SET_INITIAL_ORDER, type: SET_INITIAL_ORDER,