Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Expo camera zoom

$
0
0

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?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>