FIX: Smooth transition

This commit is contained in:
Marcos Rodriguez Velez 2024-01-05 04:18:01 -04:00
parent dc44db6ec5
commit f3b4ac02b0
No known key found for this signature in database
GPG key ID: 6030B2F48CCE86D7
2 changed files with 7 additions and 11 deletions

View file

@ -145,17 +145,11 @@ const WalletCarouselItem = ({ item, _, onPress, handleLongPress, isSelectedWalle
const itemWidth = width * 0.82 > 375 ? 375 : width * 0.82;
const isLargeScreen = Platform.OS === 'android' ? isTablet() : (width >= Dimensions.get('screen').width / 2 && isTablet()) || isDesktop;
const onPressedIn = () => {
const props = { duration: 50 };
props.useNativeDriver = true;
props.toValue = 0.9;
Animated.spring(scaleValue, props).start();
Animated.spring(scaleValue, { duration: 50, useNativeDriver: true, toValue: 0.9 }).start();
};
const onPressedOut = () => {
const props = { duration: 50 };
props.useNativeDriver = true;
props.toValue = 1.0;
Animated.spring(scaleValue, props).start();
Animated.spring(scaleValue, { duration: 50, useNativeDriver: true, toValue: 1.0 }).start();
};
const opacity = isSelectedWallet === false ? 0.5 : 1.0;
@ -201,8 +195,9 @@ const WalletCarouselItem = ({ item, _, onPress, handleLongPress, isSelectedWalle
onLongPress={handleLongPress}
onPress={() => {
onPressedOut();
onPress(item);
onPressedOut();
setTimeout(() => {
onPress(item); // Replace 'onPress' with your navigation function
}, 50);
}}
>
<LinearGradient shadowColor={colors.shadowColor} colors={WalletGradient.gradientsFor(item.type)} style={iStyles.grad}>

View file

@ -1,5 +1,5 @@
import React, { useContext, useEffect, useRef } from 'react';
import { StyleSheet } from 'react-native';
import { StyleSheet, LayoutAnimation } from 'react-native';
import { DrawerContentScrollView } from '@react-navigation/drawer';
import PropTypes from 'prop-types';
import { useIsFocused } from '@react-navigation/native';
@ -32,6 +32,7 @@ const DrawerList = props => {
const handleClick = item => {
if (item?.getID) {
const walletID = item.getID();
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setSelectedWalletID(walletID);
props.navigation.navigate({
name: 'WalletTransactions',