Focus the text input on tap during the composer

zio/stable
Paul Frazee 2023-01-18 13:21:23 -06:00
parent 302acaccb6
commit 726ff6bb01
1 changed files with 154 additions and 144 deletions

View File

@ -9,6 +9,7 @@ import {
StyleSheet,
TextInput,
TouchableOpacity,
TouchableWithoutFeedback,
View,
} from 'react-native'
import LinearGradient from 'react-native-linear-gradient'
@ -88,6 +89,9 @@ export const ComposePost = observer(function ComposePost({
}
}, [])
const onPressContainer = () => {
textInput.current?.focus()
}
const onPressSelectPhotos = () => {
if (isSelectingPhotos) {
setIsSelectingPhotos(false)
@ -183,6 +187,7 @@ export const ComposePost = observer(function ComposePost({
testID="composePostView"
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={[pal.view, styles.outer]}>
<TouchableWithoutFeedback onPressIn={onPressContainer}>
<SafeAreaView style={s.flex1}>
<View style={styles.topbar}>
<TouchableOpacity
@ -255,7 +260,11 @@ export const ComposePost = observer(function ComposePost({
</View>
) : undefined}
<View
style={[pal.border, styles.textInputLayout, selectTextInputLayout]}>
style={[
pal.border,
styles.textInputLayout,
selectTextInputLayout,
]}>
<UserAvatar
handle={store.me.handle || ''}
displayName={store.me.displayName}
@ -333,6 +342,7 @@ export const ComposePost = observer(function ComposePost({
onSelect={onSelectAutocompleteItem}
/>
</SafeAreaView>
</TouchableWithoutFeedback>
</KeyboardAvoidingView>
)
})