You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm following the instagram pinch zoom tutorial and even just the basic scale transform is not working when I try to set it up using onGestureEvent If I manually set the animated value scale with an onGestureEvent that I define (just taking the scale from the native event) it works fine. But when I try to switch it up to the redash helper, it does not do anything for the pinch gesture. I've tried this on android and iphone emulators and on a physical android device. Same behavior everywhere.
I'm using reanimated v1 (expo project that doesn't play well with v2) and redash v14.2.2 per the recommendations.
Here's my component (not working):
importReact,{ReactNode}from'react';import{StyleSheet}from'react-native';import{PinchGestureHandler}from'react-native-gesture-handler';importAnimated,{Value}from'react-native-reanimated';import{onGestureEvent}from'react-native-redash';interfacePinchZoomProps{children: ReactNode;}conststyles=StyleSheet.create({wrapper: {},});constPinchZoom=({ children }: PinchZoomProps)=>{constscale=newValue(1);constpinchGestureHandler=onGestureEvent({ scale });return(<PinchGestureHandler{...pinchGestureHandler}><Animated.Viewstyle={[styles.wrapper,{transform: [{scale}]}]}>{children}</Animated.View></PinchGestureHandler>);};exportdefaultPinchZoom;
Here's the working version:
importReact,{ReactNode}from'react';import{StyleSheet}from'react-native';import{PinchGestureHandler}from'react-native-gesture-handler';importAnimated,{Value}from'react-native-reanimated';interfacePinchZoomProps{children: ReactNode;}conststyles=StyleSheet.create({wrapper: {},});constPinchZoom=({ children }: PinchZoomProps)=>{constscale=newValue(1);return(<PinchGestureHandleronGestureEvent={(event)=>{if(event.nativeEvent.scale>=1){//@ts-ignore
scale.setValue(event.nativeEvent.scale);}}}><Animated.Viewstyle={[styles.wrapper,{transform: [{ scale }]}]}>{children}</Animated.View></PinchGestureHandler>);};exportdefaultPinchZoom;
The text was updated successfully, but these errors were encountered:
I'm following the instagram pinch zoom tutorial and even just the basic scale transform is not working when I try to set it up using
onGestureEvent
If I manually set the animated valuescale
with anonGestureEvent
that I define (just taking the scale from the native event) it works fine. But when I try to switch it up to the redash helper, it does not do anything for the pinch gesture. I've tried this on android and iphone emulators and on a physical android device. Same behavior everywhere.I'm using reanimated v1 (expo project that doesn't play well with v2) and redash v14.2.2 per the recommendations.
Here's my component (not working):
Here's the working version:
The text was updated successfully, but these errors were encountered: