diff options
Diffstat (limited to 'src/screens/Messages/Conversation/index.tsx')
-rw-r--r-- | src/screens/Messages/Conversation/index.tsx | 74 |
1 files changed, 28 insertions, 46 deletions
diff --git a/src/screens/Messages/Conversation/index.tsx b/src/screens/Messages/Conversation/index.tsx index 4a7c4ce9b..070175d47 100644 --- a/src/screens/Messages/Conversation/index.tsx +++ b/src/screens/Messages/Conversation/index.tsx @@ -1,8 +1,5 @@ import React, {useCallback} from 'react' import {TouchableOpacity, View} from 'react-native' -import {KeyboardProvider} from 'react-native-keyboard-controller' -import {KeyboardAvoidingView} from 'react-native-keyboard-controller' -import {useSafeAreaInsets} from 'react-native-safe-area-context' import {AppBskyActorDefs, moderateProfile, ModerationOpts} from '@atproto/api' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {msg} from '@lingui/macro' @@ -18,7 +15,7 @@ import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useProfileQuery} from '#/state/queries/profile' import {BACK_HITSLOP} from 'lib/constants' import {sanitizeDisplayName} from 'lib/strings/display-names' -import {isIOS, isNative, isWeb} from 'platform/detection' +import {isWeb} from 'platform/detection' import {ConvoProvider, isConvoActive, useConvo} from 'state/messages/convo' import {ConvoStatus} from 'state/messages/convo/types' import {useSetMinimalShellMode} from 'state/shell' @@ -39,8 +36,8 @@ type Props = NativeStackScreenProps< > export function MessagesConversationScreen({route}: Props) { const gate = useGate() - const setMinimalShellMode = useSetMinimalShellMode() const {gtMobile} = useBreakpoints() + const setMinimalShellMode = useSetMinimalShellMode() const convoId = route.params.conversation const {setCurrentConvoId} = useCurrentConvoId() @@ -57,7 +54,7 @@ export function MessagesConversationScreen({route}: Props) { setCurrentConvoId(undefined) setMinimalShellMode(false) } - }, [convoId, gtMobile, setCurrentConvoId, setMinimalShellMode]), + }, [gtMobile, convoId, setCurrentConvoId, setMinimalShellMode]), ) if (!gate('dms')) return <ClipClopGate /> @@ -76,9 +73,6 @@ function Inner() { const [hasInitiallyRendered, setHasInitiallyRendered] = React.useState(false) - const {bottom: bottomInset, top: topInset} = useSafeAreaInsets() - const nativeBottomBarHeight = isIOS ? 42 : 60 - // HACK: Because we need to scroll to the bottom of the list once initial items are added to the list, we also have // to take into account that scrolling to the end of the list on native will happen asynchronously. This will cause // a little flicker when the items are first renedered at the top and immediately scrolled to the bottom. to prevent @@ -111,45 +105,33 @@ function Inner() { /* * Any other convo states (atm) are "ready" states */ - return ( - <KeyboardProvider> - <KeyboardAvoidingView - style={[ - a.flex_1, - isNative && {marginBottom: bottomInset + nativeBottomBarHeight}, - ]} - keyboardVerticalOffset={isIOS ? topInset : 0} - behavior="padding" - contentContainerStyle={a.flex_1}> - <CenteredView style={a.flex_1} sideBorders> - <Header profile={convoState.recipients?.[0]} /> - <View style={[a.flex_1]}> - {isConvoActive(convoState) ? ( - <MessagesList /> - ) : ( - <ListMaybePlaceholder isLoading /> - )} - {!hasInitiallyRendered && ( - <View - style={[ - a.absolute, - a.z_10, - a.w_full, - a.h_full, - a.justify_center, - a.align_center, - t.atoms.bg, - ]}> - <View style={[{marginBottom: 75}]}> - <Loader size="xl" /> - </View> - </View> - )} + <CenteredView style={[a.flex_1]} sideBorders> + <Header profile={convoState.recipients?.[0]} /> + <View style={[a.flex_1]}> + {isConvoActive(convoState) ? ( + <MessagesList /> + ) : ( + <ListMaybePlaceholder isLoading /> + )} + {!hasInitiallyRendered && ( + <View + style={[ + a.absolute, + a.z_10, + a.w_full, + a.h_full, + a.justify_center, + a.align_center, + t.atoms.bg, + ]}> + <View style={[{marginBottom: 75}]}> + <Loader size="xl" /> + </View> </View> - </CenteredView> - </KeyboardAvoidingView> - </KeyboardProvider> + )} + </View> + </CenteredView> ) } |