That's my first time using the Pinch Gesture Handler in React Native... I'm trying to create a zoomable camera using Expo. What i'm doing is:
const handlePinch = (nativeEvent) => {
const { scale, velocity } = nativeEvent;
let newZoom =
velocity > 0
? zoom + scale * velocity * (Platform.OS === "ios" ? 0.01 : 25)
: zoom -
scale * Math.abs(velocity) * (Platform.OS === "ios" ? 0.02 : 50);
if (newZoom < 0) newZoom = 0;
else if (newZoom > 0.5) newZoom = 0.5;
setZoom(newZoom);
};
...
<ExpoCamera
...
zoom={zoom}
...
>
Working but not too smoothy... Is there any better way to do this?