From 9c5cd391dd890d20bcf65294d9b440c18be5348e Mon Sep 17 00:00:00 2001 From: Hailey Date: Fri, 23 Feb 2024 16:05:54 -0800 Subject: [PATCH] use `showControls` to show/hide live text icon on ios (#2982) --- .../components/ImageItem/ImageItem.android.tsx | 1 + .../components/ImageItem/ImageItem.ios.tsx | 11 +++++++++-- .../ImageViewing/components/ImageItem/ImageItem.tsx | 1 + src/view/com/lightbox/ImageViewing/index.tsx | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx index 003ad61ba6..414f98a611 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx @@ -37,6 +37,7 @@ type Props = { onTap: () => void onZoom: (isZoomed: boolean) => void isScrollViewBeingDragged: boolean + showControls: boolean } const ImageItem = ({ imageSrc, diff --git a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx index cf4ba71df2..383490f4f1 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx @@ -37,11 +37,18 @@ type Props = { onTap: () => void onZoom: (scaled: boolean) => void isScrollViewBeingDragged: boolean + showControls: boolean } const AnimatedImage = Animated.createAnimatedComponent(Image) -const ImageItem = ({imageSrc, onTap, onZoom, onRequestClose}: Props) => { +const ImageItem = ({ + imageSrc, + onTap, + onZoom, + onRequestClose, + showControls, +}: Props) => { const scrollViewRef = useAnimatedRef() const translationY = useSharedValue(0) const [loaded, setLoaded] = useState(false) @@ -144,7 +151,7 @@ const ImageItem = ({imageSrc, onTap, onZoom, onRequestClose}: Props) => { accessibilityLabel={imageSrc.alt} accessibilityHint="" onLoad={() => setLoaded(true)} - enableLiveTextInteraction={!scaled} + enableLiveTextInteraction={showControls && !scaled} /> diff --git a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx index 16688b820e..08b99bf9ee 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx @@ -10,6 +10,7 @@ type Props = { onTap: () => void onZoom: (scaled: boolean) => void isScrollViewBeingDragged: boolean + showControls: boolean } const ImageItem = (_props: Props) => { diff --git a/src/view/com/lightbox/ImageViewing/index.tsx b/src/view/com/lightbox/ImageViewing/index.tsx index b6835793d1..ff8fdb86d3 100644 --- a/src/view/com/lightbox/ImageViewing/index.tsx +++ b/src/view/com/lightbox/ImageViewing/index.tsx @@ -122,6 +122,7 @@ function ImageViewing({ imageSrc={imageSrc} onRequestClose={onRequestClose} isScrollViewBeingDragged={isDragging} + showControls={showControls} /> ))}