use `showControls` to show/hide live text icon on ios (#2982)

zio/stable
Hailey 2024-02-23 16:05:54 -08:00 committed by GitHub
parent bdb63fff6d
commit 9c5cd391dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 2 deletions

View File

@ -37,6 +37,7 @@ type Props = {
onTap: () => void
onZoom: (isZoomed: boolean) => void
isScrollViewBeingDragged: boolean
showControls: boolean
}
const ImageItem = ({
imageSrc,

View File

@ -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)
@ -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>

View File

@ -10,6 +10,7 @@ type Props = {
onTap: () => void
onZoom: (scaled: boolean) => void
isScrollViewBeingDragged: boolean
showControls: boolean
}
const ImageItem = (_props: Props) => {

View File

@ -122,6 +122,7 @@ function ImageViewing({
imageSrc={imageSrc}
onRequestClose={onRequestClose}
isScrollViewBeingDragged={isDragging}
showControls={showControls}
/>
</View>
))}