Skip to content

Commit

Permalink
fix(ui-ux): copy evm address when evm domain is toggled on (#4043)
Browse files Browse the repository at this point in the history
  • Loading branch information
lykalabrada authored Oct 6, 2023
1 parent e13ad96 commit c63796e
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ export const BottomSheetAddressDetailV2 = (
const { getAddressUrl } = useDeFiScanContext();

const onActiveAddressPress = useCallback(
debounce(() => {
debounce((addressToCopy: string) => {
if (showToast) {
return;
}
Clipboard.setString(addressToCopy);
setShowToast(true);
setTimeout(() => setShowToast(false), TOAST_DURATION);
}, 500),
Expand All @@ -117,7 +118,6 @@ export const BottomSheetAddressDetailV2 = (

useEffect(() => {
if (showToast) {
Clipboard.setString(props.address);
toast.show(translate("components/toaster", "Address copied"), {
type: "wallet_toast",
placement: "top",
Expand All @@ -126,7 +126,7 @@ export const BottomSheetAddressDetailV2 = (
} else {
toast.hideAll();
}
}, [showToast, props.address]);
}, [showToast]);

// Getting addresses
const fetchAddresses = async (): Promise<void> => {
Expand Down Expand Up @@ -349,6 +349,8 @@ export const BottomSheetAddressDetailV2 = (
const activeAddress = availableAddresses.find(
({ dvm }) => dvm === props.address,
);
const activeDomainAddress =
domain === DomainType.DVM ? activeAddress?.dvm : activeAddress?.evm;
return (
<ThemedViewV2
style={tailwind("flex flex-col w-full px-5 py-2 items-center")}
Expand All @@ -367,12 +369,8 @@ export const BottomSheetAddressDetailV2 = (
</View>
)}
<ActiveAddress
address={
(domain === DomainType.DVM
? activeAddress?.dvm
: activeAddress?.evm) ?? ""
}
onPress={onActiveAddressPress}
address={activeDomainAddress ?? ""}
onPress={() => onActiveAddressPress(activeDomainAddress ?? "")}
/>
<View
style={tailwind(
Expand Down

0 comments on commit c63796e

Please sign in to comment.