Fix overflow issue on iOS autocomplete, among other things (#6611)
* stop using ref in render * fix display name fallback on web * use unicode ellipsis for useGrapheme * fix overflow issue * sanitize handle/displayname on web
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
import tippy, {Instance as TippyInstance} from 'tippy.js'
|
||||
|
||||
import {usePalette} from '#/lib/hooks/usePalette'
|
||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {ActorAutocompleteFn} from '#/state/queries/actor-autocomplete'
|
||||
import {Text} from '#/view/com/util/text/Text'
|
||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||
@@ -148,7 +150,9 @@ const MentionList = forwardRef<MentionListRef, SuggestionProps>(
|
||||
{items.length > 0 ? (
|
||||
items.map((item, index) => {
|
||||
const {name: displayName} = getGraphemeString(
|
||||
item.displayName ?? item.handle,
|
||||
sanitizeDisplayName(
|
||||
item.displayName || sanitizeHandle(item.handle),
|
||||
),
|
||||
30, // Heuristic value; can be modified
|
||||
)
|
||||
const isSelected = selectedIndex === index
|
||||
@@ -181,7 +185,7 @@ const MentionList = forwardRef<MentionListRef, SuggestionProps>(
|
||||
</Text>
|
||||
</View>
|
||||
<Text type="xs" style={pal.textLight} numberOfLines={1}>
|
||||
@{item.handle}
|
||||
{sanitizeHandle(item.handle, '@')}
|
||||
</Text>
|
||||
</Pressable>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user