import { FlipColors } from "@flip.id/ui-kit"; import { FactoryComponentProps, HStack, Image, Text, View, VStack, } from "native-base"; import React, { useEffect } from "react"; import { Animated, Easing, ImageSourcePropType, StyleProp, TouchableOpacity, TouchableOpacityProps, ViewStyle, } from "react-native"; import { Star } from "../../../../icons/function"; export interface BeneficiaryAccountListCardProps { as?: React.ComponentType; key?: string; title: string; bankName: string; bankAccount: string; avatar?: ImageSourcePropType; bankIcon?: ImageSourcePropType; isSelected?: boolean; disturbanceLabel?: string; isBankInDisturbance?: boolean; containerStyle?: StyleProp; onPress?: () => void; onPressRight?: () => void; avatarImgComponent?: React.ReactElement; bankIconComponent?: React.ReactElement; } export const BeneficiaryAccountListCard: React.FC< BeneficiaryAccountListCardProps & TouchableOpacityProps & FactoryComponentProps > = (props) => { const { as, key, onPress, avatar, title, bankName, bankAccount, bankIcon, isSelected, onPressRight, disturbanceLabel, isBankInDisturbance, containerStyle, avatarImgComponent, bankIconComponent, ...rest } = props; const opacity = new Animated.Value(0); const size = opacity.interpolate({ inputRange: [0, 1], outputRange: [0, 1], }); const animate = () => { Animated.timing(opacity, { toValue: 1, duration: 700, easing: Easing.elastic(1), useNativeDriver: true, }).start(); }; useEffect(() => { animate(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [avatar]); return ( {avatarImgComponent ? ( avatarImgComponent ) : ( image avatar )} {title} {bankIconComponent ? ( bankIconComponent ) : ( image bankicon )} {bankName} {isBankInDisturbance && ( {disturbanceLabel} )} {bankAccount} ); }; export default BeneficiaryAccountListCard;