diff --git a/src/__swaps__/screens/Swap/components/SearchInputButton.tsx b/src/__swaps__/screens/Swap/components/SearchInputButton.tsx index 887d367c3d2..aa89ce65023 100644 --- a/src/__swaps__/screens/Swap/components/SearchInputButton.tsx +++ b/src/__swaps__/screens/Swap/components/SearchInputButton.tsx @@ -36,6 +36,7 @@ export const SearchInputButton = ({ outputSearchRef, AnimatedSwapStyles, } = useSwapContext(); + const { hasClipboardData } = useClipboard(); const btnText = useDerivedValue(() => { @@ -74,7 +75,7 @@ export const SearchInputButton = ({ const isInputSearchFocused = inputProgress.value === NavigationSteps.SEARCH_FOCUSED; const isOutputSearchFocused = outputProgress.value === NavigationSteps.SEARCH_FOCUSED; const isOutputTokenListFocused = outputProgress.value === NavigationSteps.TOKEN_LIST_FOCUSED; - + const clipboardDataAvailable = hasClipboardData || IS_ANDROID; const isPasteDisabled = output && !internalSelectedOutputAsset.value && isOutputTokenListFocused && !clipboardDataAvailable; diff --git a/src/components/fields/CheckboxField.tsx b/src/components/fields/CheckboxField.tsx index 4b79dbfc815..3f9d5fb1148 100644 --- a/src/components/fields/CheckboxField.tsx +++ b/src/components/fields/CheckboxField.tsx @@ -48,7 +48,7 @@ export default function CheckboxField({ - + {label} diff --git a/src/components/send/SendHeader.js b/src/components/send/SendHeader.js index f93e6b7fdbc..fe4ef3c7047 100644 --- a/src/components/send/SendHeader.js +++ b/src/components/send/SendHeader.js @@ -117,17 +117,15 @@ export default function SendHeader({ const isPreExistingContact = (contact?.nickname?.length || 0) > 0; const name = - removeFirstEmojiFromString(userWallet?.label || contact?.nickname || nickname) || userWallet?.ens || contact?.ens || recipient; + removeFirstEmojiFromString(contact?.nickname || userWallet?.label || nickname) || userWallet?.ens || contact?.ens || recipient; const handleNavigateToContact = useCallback(() => { - let nickname = profilesEnabled ? (!isHexString(recipient) ? recipient : null) : recipient; let color = ''; + const nickname = !isHexString(name) ? name : ''; if (!profilesEnabled) { color = contact?.color; if (color !== 0 && !color) { - const emoji = profileUtils.addressHashedEmoji(hexAddress); color = profileUtils.addressHashedColorIndex(hexAddress) || 0; - nickname = isHexString(recipient) ? emoji : `${emoji} ${recipient}`; } } @@ -142,7 +140,7 @@ export default function SendHeader({ onRefocusInput, type: 'contact_profile', }); - }, [contact, hexAddress, navigate, onRefocusInput, profilesEnabled, recipient]); + }, [contact, hexAddress, name, navigate, onRefocusInput, profilesEnabled, recipient]); const handleOpenContactActionSheet = useCallback(async () => { return showActionSheetWithOptions( @@ -162,7 +160,7 @@ export default function SendHeader({ address: hexAddress, nickname: name, onDelete: () => { - onChangeAddressInput(contact?.ens); + onChangeAddressInput(contact?.ens ? contact?.ens : contact?.address); }, removeContact: removeContact, }); @@ -175,7 +173,17 @@ export default function SendHeader({ } } ); - }, [contact?.ens, handleNavigateToContact, hexAddress, onRefocusInput, removeContact, setClipboard, name, onChangeAddressInput]); + }, [ + hexAddress, + name, + removeContact, + onChangeAddressInput, + contact?.ens, + contact?.address, + handleNavigateToContact, + onRefocusInput, + setClipboard, + ]); const onChange = useCallback( text => { diff --git a/src/screens/SendConfirmationSheet.tsx b/src/screens/SendConfirmationSheet.tsx index 411434521cc..579946fb0b7 100644 --- a/src/screens/SendConfirmationSheet.tsx +++ b/src/screens/SendConfirmationSheet.tsx @@ -420,7 +420,7 @@ export const SendConfirmationSheet = () => { return existingAcct; }, [toAddress, userAccounts, watchedAccounts]); - let avatarName = removeFirstEmojiFromString(existingAccount?.label || contact?.nickname); + let avatarName = removeFirstEmojiFromString(contact?.nickname || existingAccount?.label); if (!avatarName) { if (isValidDomainFormat(to)) { diff --git a/src/screens/SendSheet.js b/src/screens/SendSheet.js index ad0f897c0be..330776eb0f4 100644 --- a/src/screens/SendSheet.js +++ b/src/screens/SendSheet.js @@ -588,7 +588,7 @@ export default function SendSheet(props) { })(); } }, - [amountDetails.assetAmount, goBack, isENS, isHardwareWallet, navigate, onSubmit, recipient, selected?.name, selected?.network] + [amountDetails, goBack, isENS, isHardwareWallet, navigate, onSubmit, recipient, selected?.name, selected?.network] ); const { buttonDisabled, buttonLabel } = useMemo(() => { @@ -713,8 +713,8 @@ export default function SendSheet(props) { const isValid = checkIsValidAddressOrDomainFormat(text); if (!isValid) { setIsValidAddress(); + setToAddress(); } - setToAddress(); setCurrentInput(text); setRecipient(text); setNickname(text); @@ -764,7 +764,6 @@ export default function SendSheet(props) { if ( !!accountAddress && - amountDetails.assetAmount !== '' && Object.entries(selected).length && assetChainId === currentChainId && currentProviderChainId === currentChainId && @@ -813,6 +812,12 @@ export default function SendSheet(props) { const isEmptyWallet = !sortedAssets?.length && !sendableUniqueTokens?.length; + const filteredUserAccountsFromContacts = useMemo(() => { + return userAccounts.filter( + account => !filteredContacts.some(contact => contact.address.toLowerCase() === account.address.toLowerCase()) + ); + }, [userAccounts, filteredContacts]); + return ( @@ -832,7 +837,7 @@ export default function SendSheet(props) { recipientFieldRef={recipientFieldRef} removeContact={onRemoveContact} showAssetList={showAssetList} - userAccounts={userAccounts} + userAccounts={filteredUserAccountsFromContacts} watchedAccounts={watchedAccounts} /> {showEmptyState && ( @@ -848,7 +853,7 @@ export default function SendSheet(props) { setNickname(nickname); }} removeContact={onRemoveContact} - userAccounts={userAccounts} + userAccounts={filteredUserAccountsFromContacts} watchedAccounts={watchedAccounts} /> )}