diff --git a/native/components/user-profile.react.js b/native/components/user-profile.react.js --- a/native/components/user-profile.react.js +++ b/native/components/user-profile.react.js @@ -4,7 +4,8 @@ import * as React from 'react'; import { View, Text, TouchableOpacity } from 'react-native'; -import type { AccountUserInfo } from 'lib/types/user-types'; +import { stringForUserExplicit } from 'lib/shared/user-utils.js'; +import type { UserInfo } from 'lib/types/user-types'; import sleep from 'lib/utils/sleep.js'; import SWMansionIcon from './swmansion-icon.react.js'; @@ -13,22 +14,24 @@ import { useStyles } from '../themes/colors.js'; type Props = { - +userInfo: AccountUserInfo, + +userInfo: UserInfo, }; function UserProfile(props: Props): React.Node { const { userInfo } = props; + const usernameText = stringForUserExplicit(userInfo); + const [usernameCopied, setUsernameCopied] = React.useState(false); const styles = useStyles(unboundStyles); const onPressCopyUsername = React.useCallback(async () => { - Clipboard.setString(userInfo.username); + Clipboard.setString(usernameText); setUsernameCopied(true); await sleep(3000); setUsernameCopied(false); - }, [userInfo.username]); + }, [usernameText]); const copyUsernameButton = React.useMemo(() => { if (usernameCopied) { @@ -67,9 +70,7 @@ - - {userInfo.username} - + {usernameText} {copyUsernameButton}