fix composer SafeAreaView

zio/stable
Ansh Nanda 2023-04-12 20:28:01 -07:00
parent 0d22767609
commit c88903dad4
1 changed files with 12 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import {
TouchableWithoutFeedback, TouchableWithoutFeedback,
View, View,
} from 'react-native' } from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
import LinearGradient from 'react-native-linear-gradient' import LinearGradient from 'react-native-linear-gradient'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {RichText} from '@atproto/api' import {RichText} from '@atproto/api'
@ -75,6 +75,8 @@ export const ComposePost = observer(function ComposePost({
[store], [store],
) )
const insets = useSafeAreaInsets()
// HACK // HACK
// there's a bug with @mattermost/react-native-paste-input where if the input // there's a bug with @mattermost/react-native-paste-input where if the input
// is focused during unmount, an exception will throw (seems that a blur method isnt implemented) // is focused during unmount, an exception will throw (seems that a blur method isnt implemented)
@ -209,7 +211,14 @@ export const ComposePost = observer(function ComposePost({
behavior={Platform.OS === 'ios' ? 'padding' : 'height'} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={styles.outer}> style={styles.outer}>
<TouchableWithoutFeedback onPressIn={onPressContainer}> <TouchableWithoutFeedback onPressIn={onPressContainer}>
<SafeAreaView style={[s.flex1]}> <View
style={[
s.flex1,
{
paddingBottom: Platform.OS === 'android' ? insets.bottom : 0,
paddingTop: Platform.OS === 'android' ? insets.top : 15,
},
]}>
<View style={styles.topbar}> <View style={styles.topbar}>
<TouchableOpacity <TouchableOpacity
testID="composerCancelButton" testID="composerCancelButton"
@ -339,7 +348,7 @@ export const ComposePost = observer(function ComposePost({
<View style={s.flex1} /> <View style={s.flex1} />
<CharProgress count={graphemeLength} /> <CharProgress count={graphemeLength} />
</View> </View>
</SafeAreaView> </View>
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
</KeyboardAvoidingView> </KeyboardAvoidingView>
) )