Skip to content

Commit

Permalink
use showControls to show/hide live text icon on ios (#2982)
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok authored Feb 24, 2024
1 parent bdb63ff commit 9c5cd39
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Props = {
onTap: () => void
onZoom: (isZoomed: boolean) => void
isScrollViewBeingDragged: boolean
showControls: boolean
}
const ImageItem = ({
imageSrc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Animated.ScrollView>()
const translationY = useSharedValue(0)
const [loaded, setLoaded] = useState(false)
Expand Down Expand Up @@ -144,7 +151,7 @@ const ImageItem = ({imageSrc, onTap, onZoom, onRequestClose}: Props) => {
accessibilityLabel={imageSrc.alt}
accessibilityHint=""
onLoad={() => setLoaded(true)}
enableLiveTextInteraction={!scaled}
enableLiveTextInteraction={showControls && !scaled}
/>
</Animated.ScrollView>
</GestureDetector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Props = {
onTap: () => void
onZoom: (scaled: boolean) => void
isScrollViewBeingDragged: boolean
showControls: boolean
}

const ImageItem = (_props: Props) => {
Expand Down
1 change: 1 addition & 0 deletions src/view/com/lightbox/ImageViewing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function ImageViewing({
imageSrc={imageSrc}
onRequestClose={onRequestClose}
isScrollViewBeingDragged={isDragging}
showControls={showControls}
/>
</View>
))}
Expand Down

0 comments on commit 9c5cd39

Please sign in to comment.