From 2330884509bb42966f85f9b44022424aefb92b47 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 14:42:23 +0300 Subject: [PATCH 1/8] move gif alt text dialog for consistency --- src/view/com/composer/Composer.tsx | 2 +- .../composer/{GifAltText.tsx => photos/GifAltTextDialog.tsx} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/view/com/composer/{GifAltText.tsx => photos/GifAltTextDialog.tsx} (100%) diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index ade37af1b6..a42338fdb0 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -91,9 +91,9 @@ import {ComposerOpts} from '#/state/shell/composer' import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' import {ComposerReplyTo} from '#/view/com/composer/ComposerReplyTo' import {ExternalEmbed} from '#/view/com/composer/ExternalEmbed' -import {GifAltText} from '#/view/com/composer/GifAltText' import {LabelsBtn} from '#/view/com/composer/labels/LabelsBtn' import {Gallery} from '#/view/com/composer/photos/Gallery' +import {GifAltText} from '#/view/com/composer/photos/GifAltTextDialog' import {OpenCameraBtn} from '#/view/com/composer/photos/OpenCameraBtn' import {SelectGifBtn} from '#/view/com/composer/photos/SelectGifBtn' import {SelectPhotoBtn} from '#/view/com/composer/photos/SelectPhotoBtn' diff --git a/src/view/com/composer/GifAltText.tsx b/src/view/com/composer/photos/GifAltTextDialog.tsx similarity index 100% rename from src/view/com/composer/GifAltText.tsx rename to src/view/com/composer/photos/GifAltTextDialog.tsx From be7ee6dcc2aa9d8331a7535647c5f25d6e01f5d9 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 14:43:45 +0300 Subject: [PATCH 2/8] fix imports --- src/view/com/composer/photos/GifAltTextDialog.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/com/composer/photos/GifAltTextDialog.tsx b/src/view/com/composer/photos/GifAltTextDialog.tsx index a05607c76c..99bacf4811 100644 --- a/src/view/com/composer/photos/GifAltTextDialog.tsx +++ b/src/view/com/composer/photos/GifAltTextDialog.tsx @@ -14,6 +14,7 @@ import { import {enforceLen} from '#/lib/strings/helpers' import {isAndroid} from '#/platform/detection' import {Gif} from '#/state/queries/tenor' +import {GifEmbed} from '#/view/com/util/post-embeds/GifEmbed' import {atoms as a, native, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' @@ -21,8 +22,7 @@ import * as TextField from '#/components/forms/TextField' import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' import {Text} from '#/components/Typography' -import {GifEmbed} from '../util/post-embeds/GifEmbed' -import {AltTextReminder} from './photos/Gallery' +import {AltTextReminder} from './Gallery' export function GifAltText({ link: linkProp, From 91d6753d4f4dbc50b01eb48cf42eba0fa64dc1ef Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 14:43:57 +0300 Subject: [PATCH 3/8] fix tab order --- src/view/com/composer/photos/ImageAltTextDialog.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/view/com/composer/photos/ImageAltTextDialog.tsx b/src/view/com/composer/photos/ImageAltTextDialog.tsx index 123e1066a5..cb71dcbb68 100644 --- a/src/view/com/composer/photos/ImageAltTextDialog.tsx +++ b/src/view/com/composer/photos/ImageAltTextDialog.tsx @@ -67,8 +67,6 @@ const ImageAltTextInner = ({ return ( - - Add alt text @@ -116,6 +114,7 @@ const ImageAltTextInner = ({ + ) } From b9452ba15ae49056666cda296def279ff7b263a9 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 15:15:13 +0300 Subject: [PATCH 4/8] stop auto hiding keyboard, allow scrollview props to handle --- src/components/Dialog/index.tsx | 22 +++++++++++++++------- src/components/Dialog/types.ts | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index d5d92048ad..cda31bae73 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -1,9 +1,8 @@ import React, {useImperativeHandle} from 'react' import { - Dimensions, - Keyboard, Pressable, StyleProp, + useWindowDimensions, View, ViewStyle, } from 'react-native' @@ -96,6 +95,7 @@ export function Outer({ const insets = useSafeAreaInsets() const closeCallbacks = React.useRef<(() => void)[]>([]) const {setDialogIsOpen} = useDialogStateControlContext() + const {height: windowHeight} = useWindowDimensions() /* * Used to manage open/closed, but index is otherwise handled internally by `BottomSheet` @@ -179,8 +179,7 @@ export function Outer({ // Android importantForAccessibility="yes" style={[a.absolute, a.inset_0]} - testID={testID} - onTouchMove={() => Keyboard.dismiss()}> + testID={testID}> @@ -243,11 +242,20 @@ export function Inner({children, style}: DialogInnerProps) { export const ScrollableInner = React.forwardRef< BottomSheetScrollViewMethods, DialogInnerProps ->(function ScrollableInner({children, style}, ref) { +>(function ScrollableInner( + { + children, + style, + keyboardShouldPersistTaps = 'handled', + keyboardDismissMode = 'on-drag', + }, + ref, +) { const insets = useSafeAreaInsets() return ( | DialogInnerPropsBase<{ label: string accessibilityLabelledBy?: undefined accessibilityDescribedBy?: undefined keyboardDismissMode?: ScrollViewProps['keyboardDismissMode'] + keyboardShouldPersistTaps?: ScrollViewProps['keyboardShouldPersistTaps'] }> From 54003e7dc57dfe3e8ac77d9f2b09104415bbafbf Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 15:16:08 +0300 Subject: [PATCH 5/8] allow scrolling with keyboard open --- src/view/com/composer/photos/GifAltTextDialog.tsx | 7 ++++--- src/view/com/composer/photos/ImageAltTextDialog.tsx | 11 ++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/view/com/composer/photos/GifAltTextDialog.tsx b/src/view/com/composer/photos/GifAltTextDialog.tsx index 99bacf4811..6cc1275ad2 100644 --- a/src/view/com/composer/photos/GifAltTextDialog.tsx +++ b/src/view/com/composer/photos/GifAltTextDialog.tsx @@ -12,7 +12,6 @@ import { parseEmbedPlayerFromUrl, } from '#/lib/strings/embed-player' import {enforceLen} from '#/lib/strings/helpers' -import {isAndroid} from '#/platform/detection' import {Gif} from '#/state/queries/tenor' import {GifEmbed} from '#/view/com/util/post-embeds/GifEmbed' import {atoms as a, native, useTheme} from '#/alf' @@ -98,7 +97,7 @@ export function GifAltText({ + nativeOptions={{sheet: {snapPoints: ['100%']}}}> + diff --git a/src/view/com/composer/photos/ImageAltTextDialog.tsx b/src/view/com/composer/photos/ImageAltTextDialog.tsx index cb71dcbb68..15c473e0df 100644 --- a/src/view/com/composer/photos/ImageAltTextDialog.tsx +++ b/src/view/com/composer/photos/ImageAltTextDialog.tsx @@ -21,7 +21,9 @@ type Props = { export const ImageAltTextDialog = (props: Props): React.ReactNode => { return ( - + @@ -66,13 +68,15 @@ const ImageAltTextInner = ({ }, [image, windim]) return ( - + Add alt text - + + ) From 867bb1c852c41e0b417460f41322ef5849d6d3b7 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 15:32:21 +0300 Subject: [PATCH 6/8] on-drag for flatlist --- src/components/Dialog/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index cda31bae73..a6a411998d 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -284,6 +284,7 @@ export const InnerFlatList = React.forwardRef< return ( From 6a1b6a9cf96efe229d22c5f65c309bfffd72043d Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 20:19:28 +0300 Subject: [PATCH 7/8] don't reopen keyboard on close gif --- src/view/com/composer/Composer.tsx | 10 +--------- src/view/com/composer/photos/SelectGifBtn.tsx | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index a42338fdb0..e0f8a329b8 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -528,10 +528,6 @@ export const ComposePost = ({ openEmojiPicker?.(textInput.current?.getCursorPosition()) }, [openEmojiPicker]) - const focusTextInput = useCallback(() => { - textInput.current?.focus() - }, []) - const onSelectGif = useCallback( (gif: Gif) => { setExtLink({ @@ -813,11 +809,7 @@ export const ComposePost = ({ setError={setError} /> - + {!isMobile ? (