diff --git a/src/view/com/composer/photos/Gallery.tsx b/src/view/com/composer/photos/Gallery.tsx index 044264fa03..1f3fb01325 100644 --- a/src/view/com/composer/photos/Gallery.tsx +++ b/src/view/com/composer/photos/Gallery.tsx @@ -1,7 +1,7 @@ -import React from 'react' +import React, {useState} from 'react' import { + findNodeHandle, type ImageStyle, - Keyboard, type LayoutChangeEvent, StyleSheet, TouchableOpacity, @@ -144,6 +144,14 @@ const GalleryItem = ({ const altTextControl = Dialog.useDialogControl() const editControl = Dialog.useDialogControl() + const [altBtnViewTag, setAltBtnViewTag] = useState() + + const altBtnRef = (node: View | null) => { + if (node) { + const tag = findNodeHandle(node) + if (tag != null) setAltBtnViewTag(tag) + } + } const onImageEdit = () => { if (IS_NATIVE) { @@ -156,12 +164,12 @@ const GalleryItem = ({ } const onAltTextEdit = () => { - Keyboard.dismiss() altTextControl.open() } return ( @@ -240,6 +248,7 @@ const GalleryItem = ({ control={altTextControl} image={image} onChange={onChange} + sourceViewTag={altBtnViewTag} /> void + sourceViewTag?: number } export const ImageAltTextDialog = ({ control, image, onChange, + sourceViewTag, }: Props): React.ReactNode => { const {height: minHeight} = useWindowDimensions() const [altText, setAltText] = useState(image.alt) @@ -42,7 +44,7 @@ export const ImageAltTextDialog = ({ alt: enforceLen(altText, MAX_ALT_TEXT, true), }) }} - nativeOptions={{minHeight}}> + nativeOptions={{minHeight, sourceViewTag}}>