Merge pull request #6561 from BlueWallet/memo

REF: Use react memo on carousel item to avoid rerenders
This commit is contained in:
GLaDOS 2024-05-16 02:40:41 +00:00 committed by GitHub
commit 66e724f281
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -154,7 +154,7 @@ const iStyles = StyleSheet.create({
},
});
export const WalletCarouselItem = ({ item, _, onPress, handleLongPress, isSelectedWallet, customStyle }) => {
export const WalletCarouselItem = React.memo(({ item, _, onPress, handleLongPress, isSelectedWallet, customStyle }) => {
const scaleValue = new Animated.Value(1.0);
const { colors } = useTheme();
const { walletTransactionUpdateStatus } = useContext(BlueStorageContext);
@ -251,7 +251,7 @@ export const WalletCarouselItem = ({ item, _, onPress, handleLongPress, isSelect
</Pressable>
</Animated.View>
);
};
});
WalletCarouselItem.propTypes = {
item: PropTypes.any,
@ -292,7 +292,7 @@ const WalletsCarousel = forwardRef((props, ref) => {
<NewWalletPanel onPress={onPress} />
),
// eslint-disable-next-line react-hooks/exhaustive-deps
[horizontal, selectedWallet, handleLongPress, onPress, preferredFiatCurrency, language],
[horizontal, selectedWallet, preferredFiatCurrency, language],
);
const flatListRef = useRef();