Show/hide controls on zoom
This commit is contained in:
@@ -180,13 +180,18 @@ const ImageItem = ({
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
(isScaledNow, wasScaledBefore) => {
|
(nextIsScaled, prevIsScaled) => {
|
||||||
if (isScaledNow !== wasScaledBefore) {
|
if (nextIsScaled !== prevIsScaled) {
|
||||||
runOnJS(setIsScaled)(isScaledNow)
|
runOnJS(handleZoom)(nextIsScaled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function handleZoom(nextIsScaled) {
|
||||||
|
setIsScaled(nextIsScaled)
|
||||||
|
onZoom(nextIsScaled)
|
||||||
|
}
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => {
|
const animatedStyle = useAnimatedStyle(() => {
|
||||||
let t = createTransform();
|
let t = createTransform();
|
||||||
prependPan(t, panTranslation.value);
|
prependPan(t, panTranslation.value);
|
||||||
|
|||||||
@@ -87,8 +87,6 @@ function ImageViewing({
|
|||||||
|
|
||||||
const onZoom = useCallback(
|
const onZoom = useCallback(
|
||||||
(isScaled: boolean) => {
|
(isScaled: boolean) => {
|
||||||
// @ts-ignore
|
|
||||||
imageList?.current?.setNativeProps({scrollEnabled: !isScaled})
|
|
||||||
toggleBarsVisible(!isScaled)
|
toggleBarsVisible(!isScaled)
|
||||||
},
|
},
|
||||||
[toggleBarsVisible],
|
[toggleBarsVisible],
|
||||||
|
|||||||
Reference in New Issue
Block a user