({
item,
isDraggingDisabled,
drag,
state,
isPlaceHolder = false,
navigateToWallet,
navigateToAddress,
renderHighlightedText,
onPressIn,
onPressOut,
handleToggleHideBalance,
isActive,
globalDragActive,
style,
})
| 74 | } |
| 75 | |
| 76 | const ManageWalletsListItem: React.FC<ManageWalletsListItemProps> = ({ |
| 77 | item, |
| 78 | isDraggingDisabled, |
| 79 | drag, |
| 80 | state, |
| 81 | isPlaceHolder = false, |
| 82 | navigateToWallet, |
| 83 | navigateToAddress, |
| 84 | renderHighlightedText, |
| 85 | onPressIn, |
| 86 | onPressOut, |
| 87 | handleToggleHideBalance, |
| 88 | isActive, |
| 89 | globalDragActive, |
| 90 | style, |
| 91 | }) => { |
| 92 | const { colors, dark } = useTheme(); |
| 93 | const { direction } = useLocale(); |
| 94 | const [isLoading, setIsLoading] = useState(false); |
| 95 | |
| 96 | const prevIsActive = useRef(isActive); |
| 97 | const swipeableRef = useRef<Swipeable | null>(null); |
| 98 | const swipeInProgressRef = useRef(false); |
| 99 | |
| 100 | useEffect(() => { |
| 101 | if (isActive !== prevIsActive.current) { |
| 102 | triggerHapticFeedback(HapticFeedbackTypes.ImpactMedium); |
| 103 | } |
| 104 | prevIsActive.current = isActive; |
| 105 | }, [isActive]); |
| 106 | |
| 107 | const onPress = useCallback(() => { |
| 108 | if (swipeInProgressRef.current) return; |
| 109 | if (item.type === ItemType.WalletSection) { |
| 110 | setIsLoading(true); |
| 111 | navigateToWallet(item.data); |
| 112 | setIsLoading(false); |
| 113 | } else if (item.type === ItemType.AddressSection) { |
| 114 | navigateToAddress(item.data.address, item.data.walletID); |
| 115 | } |
| 116 | }, [item, navigateToWallet, navigateToAddress]); |
| 117 | |
| 118 | const startDrag = useCallback(() => { |
| 119 | if (swipeInProgressRef.current) { |
| 120 | swipeableRef.current?.close?.(); |
| 121 | return; |
| 122 | } |
| 123 | triggerHapticFeedback(HapticFeedbackTypes.ImpactMedium); |
| 124 | if (drag) { |
| 125 | drag(); |
| 126 | } |
| 127 | }, [drag]); |
| 128 | |
| 129 | if (isLoading) { |
| 130 | return <ActivityIndicator size="large" color={colors.brandingColor} />; |
| 131 | } |
| 132 | |
| 133 | if (item.type === ItemType.WalletSection) { |
nothing calls this directly
no test coverage detected