From 3d4b390a8a9c4a7c52354a0c7bd4bc0a8e12f9f8 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 11 Jun 2024 20:50:56 +0100 Subject: Only enable keyboard controller when necessary (#4483) * Only enable keyboard controller when necessary * make it screen only * rm keyboard padding * rm keyboardpadding file * revert using keyboard controller in composer * remove styles.outer (unnecessary for revert) * continue to use keyboard padding in the report dialog for dms --------- Co-authored-by: Hailey --- src/view/com/composer/Composer.tsx | 347 +++++++++++++++++-------------------- 1 file changed, 163 insertions(+), 184 deletions(-) (limited to 'src/view/com/composer/Composer.tsx') diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index e8ea5189f..9bb704012 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -10,16 +10,12 @@ import { ActivityIndicator, BackHandler, Keyboard, + KeyboardAvoidingView, LayoutChangeEvent, StyleSheet, TouchableOpacity, View, } from 'react-native' -import { - KeyboardAvoidingView, - KeyboardStickyView, - useKeyboardController, -} from 'react-native-keyboard-controller' import Animated, { interpolateColor, useAnimatedStyle, @@ -131,17 +127,6 @@ export const ComposePost = observer(function ComposePost({ const {closeAllModals} = useModalControls() const t = useTheme() - // Disable this in the composer to prevent any extra keyboard height being applied. - // See https://github.com/bluesky-social/social-app/pull/4399 - const {setEnabled} = useKeyboardController() - React.useEffect(() => { - if (!isAndroid) return - setEnabled(false) - return () => { - setEnabled(true) - } - }, [setEnabled]) - const [isKeyboardVisible] = useIsKeyboardVisible({iosUseWillEvents: true}) const [isProcessing, setIsProcessing] = useState(false) const [processingState, setProcessingState] = useState('') @@ -431,181 +416,175 @@ export const ComposePost = observer(function ComposePost({ } = useAnimatedBorders() return ( - <> - - - - - - - Cancel - - - - {isProcessing ? ( - <> - {processingState} - - - - - ) : ( - <> - - {canPost ? ( - - - - {replyTo ? ( - Reply - ) : ( - Post - )} - - - - ) : ( - - - Post - - - )} - + + + + + - - {isAltTextRequiredAndMissing && ( - - - + hitSlop={HITSLOP_10}> + + Cancel + + + + {isProcessing ? ( + <> + {processingState} + + - - One or more images is missing alt text. - - + + ) : ( + <> + + {canPost ? ( + + + + {replyTo ? ( + Reply + ) : ( + Post + )} + + + + ) : ( + + + Post + + + )} + )} - {error !== '' && ( - - - - - {error} + + + {isAltTextRequiredAndMissing && ( + + + - )} - - - {replyTo ? : undefined} - - - + One or more images is missing alt text. + + + )} + {error !== '' && ( + + + + + {error} + + )} + + + {replyTo ? : undefined} + + + + + + + + {gallery.isEmpty && extLink && ( + + { + setExtLink(undefined) + setExtGif(undefined) + }} /> - + )} - - {gallery.isEmpty && extLink && ( - - { - setExtLink(undefined) - setExtGif(undefined) - }} - /> - - - )} - {quote ? ( - - - - - {quote.uri !== initQuote?.uri && ( - setQuote(undefined)} /> - )} + {quote ? ( + + + - ) : undefined} - - - - - + {quote.uri !== initQuote?.uri && ( + setQuote(undefined)} /> + )} + + ) : undefined} + + + {replyTo ? null : ( - + - + ) }) -- cgit 1.4.1