Last active
July 31, 2020 04:11
-
-
Save JoBerkner/1b813d72f294ae0728e1b2ecf06d7b24 to your computer and use it in GitHub Desktop.
Gesture handlers inside return statement for panning and pinch-zooming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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