|
| 1 | +import {FlashList} from '@shopify/flash-list'; |
1 | 2 | import lodashSortBy from 'lodash/sortBy'; |
2 | 3 | import type {ReactElement, Ref} from 'react'; |
3 | 4 | import React, {useCallback, useMemo} from 'react'; |
4 | 5 | import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native'; |
5 | | -import {FlatList, View} from 'react-native'; |
| 6 | +import {View} from 'react-native'; |
6 | 7 | import type {SvgProps} from 'react-native-svg/lib/typescript/ReactNativeSVG'; |
7 | 8 | import type {ValueOf} from 'type-fest'; |
8 | 9 | import type {RenderSuggestionMenuItemProps} from '@components/AutoCompleteSuggestions/types'; |
@@ -71,9 +72,6 @@ type PaymentMethodListProps = { |
71 | 72 | /** React ref being forwarded to the PaymentMethodList Button */ |
72 | 73 | buttonRef?: Ref<View>; |
73 | 74 |
|
74 | | - /** To enable/disable scrolling */ |
75 | | - shouldEnableScroll?: boolean; |
76 | | - |
77 | 75 | /** List container style */ |
78 | 76 | style?: StyleProp<ViewStyle>; |
79 | 77 |
|
@@ -187,7 +185,6 @@ function PaymentMethodList({ |
187 | 185 | shouldShowAssignedCards = false, |
188 | 186 | selectedMethodID = '', |
189 | 187 | onListContentSizeChange = () => {}, |
190 | | - shouldEnableScroll = true, |
191 | 188 | style = {}, |
192 | 189 | listItemStyle = {}, |
193 | 190 | shouldShowRightIcon = true, |
@@ -475,14 +472,14 @@ function PaymentMethodList({ |
475 | 472 | return ( |
476 | 473 | <> |
477 | 474 | <View style={[style, {minHeight: (filteredPaymentMethods.length + (shouldShowAddBankAccount ? 1 : 0)) * variables.optionRowHeight}]}> |
478 | | - <FlatList |
| 475 | + <FlashList |
| 476 | + estimatedItemSize={variables.optionRowHeight} |
479 | 477 | data={filteredPaymentMethods} |
480 | 478 | renderItem={renderItem} |
481 | 479 | keyExtractor={keyExtractor} |
482 | 480 | ListEmptyComponent={shouldShowEmptyListMessage ? renderListEmptyComponent : null} |
483 | 481 | ListHeaderComponent={listHeaderComponent} |
484 | 482 | onContentSizeChange={onListContentSizeChange} |
485 | | - scrollEnabled={shouldEnableScroll} |
486 | 483 | /> |
487 | 484 | {shouldShowAddBankAccount && renderListFooterComponent()} |
488 | 485 | </View> |
|
0 commit comments