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