diff --git a/native/user-profile/user-profile.react.js b/native/user-profile/user-profile.react.js --- a/native/user-profile/user-profile.react.js +++ b/native/user-profile/user-profile.react.js @@ -6,6 +6,7 @@ import { View, Text, TouchableOpacity } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; +import { useENSName } from 'lib/hooks/ens-cache.js'; import { relationshipBlockedInEitherDirection } from 'lib/shared/relationship-utils.js'; import { useUserProfileThreadInfo } from 'lib/shared/thread-utils.js'; import { stringForUserExplicit } from 'lib/shared/user-utils.js'; @@ -37,6 +38,7 @@ const userProfileThreadInfo = useUserProfileThreadInfo(userInfo); const usernameText = stringForUserExplicit(userInfo); + const resolvedUsernameText = useENSName(usernameText); const [usernameCopied, setUsernameCopied] = React.useState(false); @@ -97,11 +99,11 @@ }, [userProfileThreadInfo]); const onPressCopyUsername = React.useCallback(async () => { - Clipboard.setString(usernameText); + Clipboard.setString(resolvedUsernameText); setUsernameCopied(true); await sleep(3000); setUsernameCopied(false); - }, [usernameText]); + }, [resolvedUsernameText]); const copyUsernameButton = React.useMemo(() => { if (usernameCopied) { @@ -177,7 +179,9 @@ - {usernameText} + + {resolvedUsernameText} + {copyUsernameButton} diff --git a/web/modals/user-profile/user-profile.react.js b/web/modals/user-profile/user-profile.react.js --- a/web/modals/user-profile/user-profile.react.js +++ b/web/modals/user-profile/user-profile.react.js @@ -4,6 +4,7 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; +import { useENSName } from 'lib/hooks/ens-cache.js'; import { relationshipBlockedInEitherDirection } from 'lib/shared/relationship-utils.js'; import { stringForUserExplicit } from 'lib/shared/user-utils.js'; import type { UserProfileThreadInfo } from 'lib/types/thread-types'; @@ -27,6 +28,7 @@ const { pushModal } = useModalContext(); const usernameText = stringForUserExplicit(userInfo); + const resolvedUsernameText = useENSName(usernameText); const [usernameCopied, setUsernameCopied] = React.useState(false); @@ -39,11 +41,11 @@ return; } - await navigator.clipboard.writeText(usernameText); + await navigator.clipboard.writeText(resolvedUsernameText); setUsernameCopied(true); await sleep(3000); setUsernameCopied(false); - }, [usernameCopied, usernameText]); + }, [usernameCopied, resolvedUsernameText]); const actionButtons = React.useMemo(() => { if ( @@ -66,7 +68,9 @@
- {usernameText} + + {resolvedUsernameText} +