Skip to content

Commit 2a84f6a

Browse files
committed
fix: Wallet - Unable to scroll the page from assigned cards mid section
1 parent 233790a commit 2a84f6a

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/pages/settings/Wallet/PaymentMethodList.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import {FlashList} from '@shopify/flash-list';
12
import lodashSortBy from 'lodash/sortBy';
23
import type {ReactElement, Ref} from 'react';
34
import React, {useCallback, useMemo} from 'react';
45
import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native';
5-
import {FlatList, View} from 'react-native';
6+
import {View} from 'react-native';
67
import type {SvgProps} from 'react-native-svg/lib/typescript/ReactNativeSVG';
78
import type {ValueOf} from 'type-fest';
89
import type {RenderSuggestionMenuItemProps} from '@components/AutoCompleteSuggestions/types';
@@ -71,9 +72,6 @@ type PaymentMethodListProps = {
7172
/** React ref being forwarded to the PaymentMethodList Button */
7273
buttonRef?: Ref<View>;
7374

74-
/** To enable/disable scrolling */
75-
shouldEnableScroll?: boolean;
76-
7775
/** List container style */
7876
style?: StyleProp<ViewStyle>;
7977

@@ -187,7 +185,6 @@ function PaymentMethodList({
187185
shouldShowAssignedCards = false,
188186
selectedMethodID = '',
189187
onListContentSizeChange = () => {},
190-
shouldEnableScroll = true,
191188
style = {},
192189
listItemStyle = {},
193190
shouldShowRightIcon = true,
@@ -475,14 +472,14 @@ function PaymentMethodList({
475472
return (
476473
<>
477474
<View style={[style, {minHeight: (filteredPaymentMethods.length + (shouldShowAddBankAccount ? 1 : 0)) * variables.optionRowHeight}]}>
478-
<FlatList
475+
<FlashList
476+
estimatedItemSize={variables.optionRowHeight}
479477
data={filteredPaymentMethods}
480478
renderItem={renderItem}
481479
keyExtractor={keyExtractor}
482480
ListEmptyComponent={shouldShowEmptyListMessage ? renderListEmptyComponent : null}
483481
ListHeaderComponent={listHeaderComponent}
484482
onContentSizeChange={onListContentSizeChange}
485-
scrollEnabled={shouldEnableScroll}
486483
/>
487484
{shouldShowAddBankAccount && renderListFooterComponent()}
488485
</View>

src/pages/settings/Wallet/WalletPage/WalletPage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ function WalletPage({shouldListenForResize = false}: WalletPageProps) {
441441
activePaymentMethodID={shouldShowDefaultDeleteMenu ? getSelectedPaymentMethodID() : ''}
442442
buttonRef={addPaymentMethodAnchorRef}
443443
onListContentSizeChange={shouldShowAddPaymentMenu || shouldShowDefaultDeleteMenu ? setMenuPosition : () => {}}
444-
shouldEnableScroll={false}
445444
style={[styles.mt5, [shouldUseNarrowLayout ? styles.mhn5 : styles.mhn8]]}
446445
listItemStyle={shouldUseNarrowLayout ? styles.ph5 : styles.ph8}
447446
/>
@@ -460,7 +459,6 @@ function WalletPage({shouldListenForResize = false}: WalletPageProps) {
460459
shouldShowAddPaymentMethodButton={false}
461460
shouldShowAssignedCards
462461
shouldShowEmptyListMessage={false}
463-
shouldEnableScroll={false}
464462
onPress={assignedCardPressed}
465463
style={[styles.mt5, [shouldUseNarrowLayout ? styles.mhn5 : styles.mhn8]]}
466464
listItemStyle={shouldUseNarrowLayout ? styles.ph5 : styles.ph8}

src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps)
191191
activePaymentMethodID={transferBankAccountID}
192192
actionPaymentMethodType={shouldShowDefaultDeleteMenu ? paymentMethod.selectedPaymentMethodType : ''}
193193
buttonRef={addPaymentMethodAnchorRef}
194-
shouldEnableScroll={false}
195194
style={[styles.mt5, hasBankAccount && [shouldUseNarrowLayout ? styles.mhn5 : styles.mhn8]]}
196195
listItemStyle={shouldUseNarrowLayout ? styles.ph5 : styles.ph8}
197196
/>

0 commit comments

Comments
 (0)