Skip to content

Instantly share code, notes, and snippets.

@JoBerkner
Last active July 31, 2020 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoBerkner/1b813d72f294ae0728e1b2ecf06d7b24 to your computer and use it in GitHub Desktop.
Save JoBerkner/1b813d72f294ae0728e1b2ecf06d7b24 to your computer and use it in GitHub Desktop.
Gesture handlers inside return statement for panning and pinch-zooming
return (
<View style={styles.container}>
<PanGestureHandler
onGestureEvent={(e) => panGestureHandler(e)}
onHandlerStateChange={(e) => panStateHandler(e)}
>
<PinchGestureHandler
onGestureEvent={(e) => pinchGestureHandler(e)}
onHandlerStateChange={(e) => pinchStateHandler(e)}
>
<Svg
width={dimensions.width}
height={dimensions.height / 2}>
<G
transform={`scale(${scale}) translate(${-translateX},${-translateY})`}
>
<Circle
cx={dimensions.width / 2}
cy={mapExtent / 2}
r={mapExtent / 2}
fill={"#3b454f"}
/>
{countryList.map(x => x)}
</G>
</Svg>
</PinchGestureHandler>
</PanGestureHandler>
</View>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment