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 onTap: () => void
onZoom: (isZoomed: boolean) => void onZoom: (isZoomed: boolean) => void
isScrollViewBeingDragged: boolean isScrollViewBeingDragged: boolean
showControls: boolean
} }
const ImageItem = ({ const ImageItem = ({
imageSrc, imageSrc,

View File

@ -37,11 +37,18 @@ type Props = {
onTap: () => void onTap: () => void
onZoom: (scaled: boolean) => void onZoom: (scaled: boolean) => void
isScrollViewBeingDragged: boolean isScrollViewBeingDragged: boolean
showControls: boolean
} }
const AnimatedImage = Animated.createAnimatedComponent(Image) 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 scrollViewRef = useAnimatedRef<Animated.ScrollView>()
const translationY = useSharedValue(0) const translationY = useSharedValue(0)
const [loaded, setLoaded] = useState(false) const [loaded, setLoaded] = useState(false)
@ -144,7 +151,7 @@ const ImageItem = ({imageSrc, onTap, onZoom, onRequestClose}: Props) => {
accessibilityLabel={imageSrc.alt} accessibilityLabel={imageSrc.alt}
accessibilityHint="" accessibilityHint=""
onLoad={() => setLoaded(true)} onLoad={() => setLoaded(true)}
enableLiveTextInteraction={!scaled} enableLiveTextInteraction={showControls && !scaled}
/> />
</Animated.ScrollView> </Animated.ScrollView>
</GestureDetector> </GestureDetector>

View File

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

View File

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