diff --git a/src/components/KeyboardPadding.android.tsx b/src/components/KeyboardPadding.android.tsx deleted file mode 100644 index 40dec30017..0000000000 --- a/src/components/KeyboardPadding.android.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import React from 'react' -import {useKeyboardHandler} from 'react-native-keyboard-controller' -import Animated, { - useAnimatedStyle, - useSharedValue, -} from 'react-native-reanimated' - -export function KeyboardPadding({maxHeight}: {maxHeight?: number}) { - const keyboardHeight = useSharedValue(0) - - useKeyboardHandler( - { - onMove: e => { - 'worklet' - - if (maxHeight && e.height > maxHeight) { - keyboardHeight.value = maxHeight - } else { - keyboardHeight.value = e.height - } - }, - }, - [maxHeight], - ) - - const animatedStyle = useAnimatedStyle(() => ({ - height: keyboardHeight.value, - })) - - return -} diff --git a/src/components/KeyboardPadding.tsx b/src/components/KeyboardPadding.tsx index 797d42ba0a..7ecbdf930b 100644 --- a/src/components/KeyboardPadding.tsx +++ b/src/components/KeyboardPadding.tsx @@ -1,3 +1,40 @@ -export function KeyboardPadding({maxHeight: _}: {maxHeight?: number}) { - return null +import React from 'react' +import {useKeyboardHandler} from 'react-native-keyboard-controller' +import Animated, { + useAnimatedStyle, + useSharedValue, +} from 'react-native-reanimated' + +import {isAndroid} from 'platform/detection' + +export function KeyboardPadding({androidOnly = true}: {androidOnly?: boolean}) { + if (!isAndroid && androidOnly) { + return null + } + return +} + +function KeyboardPaddingInner({maxHeight}: {maxHeight?: number}) { + const keyboardHeight = useSharedValue(0) + + useKeyboardHandler( + { + onMove: e => { + 'worklet' + + if (maxHeight && e.height > maxHeight) { + keyboardHeight.value = maxHeight + } else { + keyboardHeight.value = e.height + } + }, + }, + [maxHeight], + ) + + const animatedStyle = useAnimatedStyle(() => ({ + height: keyboardHeight.value, + })) + + return } diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 2618c51a3d..a1398fbd53 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -13,10 +13,7 @@ import { TouchableOpacity, View, } from 'react-native' -import { - KeyboardAvoidingView, - KeyboardStickyView, -} from 'react-native-keyboard-controller' +import {KeyboardStickyView} from 'react-native-keyboard-controller' import Animated, { interpolateColor, useAnimatedStyle, @@ -70,6 +67,7 @@ import {ComposerReplyTo} from 'view/com/composer/ComposerReplyTo' import {atoms as a, useTheme} from '#/alf' import {Button} from '#/components/Button' import {EmojiArc_Stroke2_Corner0_Rounded as EmojiSmile} from '#/components/icons/Emoji' +import {KeyboardPadding} from '#/components/KeyboardPadding' import * as Prompt from '#/components/Prompt' import {QuoteEmbed, QuoteX} from '../util/post-embeds/QuoteEmbed' import {Text} from '../util/text/Text' @@ -401,175 +399,174 @@ export const ComposePost = observer(function ComposePost({ return ( <> - - - - - - Cancel - - - - {isProcessing ? ( - <> - {processingState} - - - - - ) : ( - <> - - {canPost ? ( - - - - {replyTo ? ( - Reply - ) : ( - Post - )} - - - - ) : ( - - - Post + + + + + Cancel + + + + {isProcessing ? ( + <> + {processingState} + + + + + ) : ( + <> + + {canPost ? ( + + + + {replyTo ? ( + Reply + ) : ( + Post + )} - - )} - - )} - - {isAltTextRequiredAndMissing && ( - - - - - - One or more images is missing alt text. - - - )} - {error !== '' && ( - - - - - {error} - - )} - - {replyTo ? : undefined} - - - - - - - - {gallery.isEmpty && extLink && ( - - { - setExtLink(undefined) - setExtGif(undefined) - }} - /> - - - )} - {quote ? ( - - - + + + ) : ( + + + Post + - {quote.uri !== initQuote?.uri && ( - setQuote(undefined)} /> - )} + )} + + )} + + {isAltTextRequiredAndMissing && ( + + + + + + One or more images is missing alt text. + + + )} + {error !== '' && ( + + + + + {error} + + )} + + {replyTo ? : undefined} + + + + + + + + {gallery.isEmpty && extLink && ( + + { + setExtLink(undefined) + setExtGif(undefined) + }} + /> + + + )} + {quote ? ( + + + - ) : undefined} - - - - + {quote.uri !== initQuote?.uri && ( + setQuote(undefined)} /> + )} + + ) : undefined} + + + + {replyTo ? null : (