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