REF: Fix virtualizedlist error

This commit is contained in:
Marcos Rodriguez Velez 2023-03-27 00:07:46 -04:00 committed by Overtorment
parent e21f79bfed
commit 7c6cc346bb
2 changed files with 35 additions and 29 deletions

View file

@ -311,7 +311,7 @@ const WalletsCarousel = forwardRef((props, ref) => {
const { width } = useWindowDimensions();
const sliderHeight = 195;
const itemWidth = width * 0.82 > 375 ? 375 : width * 0.82;
return (
return isHandset ? (
<FlatList
ref={flatListRef}
renderItem={renderItem}
@ -331,6 +331,19 @@ const WalletsCarousel = forwardRef((props, ref) => {
onScrollToIndexFailed={onScrollToIndexFailed}
{...props}
/>
) : (
<View style={cStyles.contentLargeScreen}>
{props.data.map((item, index) => (
<WalletCarouselItem
isSelectedWallet={!props.horizontal && props.selectedWallet && item ? props.selectedWallet === item.getID() : undefined}
item={item}
index={index}
handleLongPress={props.handleLongPress}
onPress={props.onPress}
key={index}
/>
))}
</View>
);
});

View file

@ -1,5 +1,5 @@
import React, { useContext, useEffect, useRef } from 'react';
import { StatusBar, View, StyleSheet } from 'react-native';
import { StatusBar, StyleSheet } from 'react-native';
import { DrawerContentScrollView } from '@react-navigation/drawer';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import PropTypes from 'prop-types';
@ -56,34 +56,27 @@ const DrawerList = props => {
return props.navigation.navigate('AddWalletRoot');
};
const ListHeaderComponent = () => {
return (
<>
<BlueHeaderDefaultMain leftText={loc.wallets.list_title} onNewWalletPress={onNewWalletPress} isDrawerList />
</>
);
};
const renderWalletsCarousel = (
<WalletsCarousel
data={wallets.concat(false)}
extraData={[wallets]}
onPress={handleClick}
handleLongPress={handleLongPress}
ref={walletsCarousel}
testID="WalletsList"
selectedWallet={selectedWallet}
ListHeaderComponent={ListHeaderComponent}
scrollEnabled={isFocused}
/>
);
return (
<DrawerContentScrollView {...props} contentInsetAdjustmentBehavior="automatic" automaticallyAdjustContentInsets>
<View styles={[styles.root, stylesHook.root]}>
<StatusBar barStyle="default" />
{renderWalletsCarousel}
</View>
<DrawerContentScrollView
{...props}
style={[styles.root, stylesHook.root]}
contentInsetAdjustmentBehavior="automatic"
automaticallyAdjustContentInsets
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}
>
<StatusBar barStyle="default" />
<BlueHeaderDefaultMain leftText={loc.wallets.list_title} onNewWalletPress={onNewWalletPress} isDrawerList />
<WalletsCarousel
data={wallets.concat(false)}
extraData={[wallets]}
onPress={handleClick}
handleLongPress={handleLongPress}
ref={walletsCarousel}
testID="WalletsList"
selectedWallet={selectedWallet}
scrollEnabled={isFocused}
/>
</DrawerContentScrollView>
);
};