Make autocomplete pressable (#620)
parent
5f074a21c9
commit
841ad692d3
|
@ -4,7 +4,7 @@ import React, {
|
||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
useState,
|
useState,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import {StyleSheet, View} from 'react-native'
|
import {Pressable, StyleSheet, View} from 'react-native'
|
||||||
import {ReactRenderer} from '@tiptap/react'
|
import {ReactRenderer} from '@tiptap/react'
|
||||||
import tippy, {Instance as TippyInstance} from 'tippy.js'
|
import tippy, {Instance as TippyInstance} from 'tippy.js'
|
||||||
import {
|
import {
|
||||||
|
@ -158,7 +158,7 @@ const MentionList = forwardRef<MentionListRef, SuggestionProps>(
|
||||||
const isSelected = selectedIndex === index
|
const isSelected = selectedIndex === index
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<Pressable
|
||||||
key={item.handle}
|
key={item.handle}
|
||||||
style={[
|
style={[
|
||||||
isSelected ? pal.viewLight : undefined,
|
isSelected ? pal.viewLight : undefined,
|
||||||
|
@ -169,7 +169,11 @@ const MentionList = forwardRef<MentionListRef, SuggestionProps>(
|
||||||
: index === items.length - 1
|
: index === items.length - 1
|
||||||
? styles.lastMention
|
? styles.lastMention
|
||||||
: undefined,
|
: undefined,
|
||||||
]}>
|
]}
|
||||||
|
onPress={() => {
|
||||||
|
selectItem(index)
|
||||||
|
}}
|
||||||
|
accessibilityRole="button">
|
||||||
<View style={styles.avatarAndDisplayName}>
|
<View style={styles.avatarAndDisplayName}>
|
||||||
<UserAvatar avatar={item.avatar ?? null} size={26} />
|
<UserAvatar avatar={item.avatar ?? null} size={26} />
|
||||||
<Text style={pal.text} numberOfLines={1}>
|
<Text style={pal.text} numberOfLines={1}>
|
||||||
|
@ -179,7 +183,7 @@ const MentionList = forwardRef<MentionListRef, SuggestionProps>(
|
||||||
<Text type="xs" style={pal.textLight} numberOfLines={1}>
|
<Text type="xs" style={pal.textLight} numberOfLines={1}>
|
||||||
@{item.handle}
|
@{item.handle}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</Pressable>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Reference in New Issue