Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show handle in recent searches and fix truncation #4917

Merged
merged 3 commits into from
Aug 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/view/screens/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -894,13 +894,6 @@ let AutocompleteResults = ({
}
AutocompleteResults = React.memo(AutocompleteResults)

function truncateText(text: string, maxLength: number) {
if (text.length > maxLength) {
return text.substring(0, maxLength) + '...'
}
return text
}

function SearchHistory({
searchHistory,
selectedProfiles,
Expand Down Expand Up @@ -965,8 +958,11 @@ function SearchHistory({
style={styles.profileAvatar as StyleProp<ImageStyle>}
accessibilityIgnoresInvertColors
/>
<Text style={[pal.text, styles.profileName]}>
{truncateText(profile.displayName || '', 12)}
<Text
style={[pal.text, styles.profileName]}
numberOfLines={1}
ellipsizeMode="head">
haileyok marked this conversation as resolved.
Show resolved Hide resolved
{profile.displayName || profile.handle}
</Text>
</Link>
<Pressable
Expand Down Expand Up @@ -1117,6 +1113,7 @@ const styles = StyleSheet.create({
borderRadius: 45,
},
profileName: {
width: 78,
fontSize: 12,
textAlign: 'center',
marginTop: 5,
Expand Down