Created
May 17, 2021 08:02
-
-
Save Karthik-B-06/d6b67ae77308ce2b90658e3073c1bdac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <TapGestureHandler | |
| onHandlerStateChange={(event) => { | |
| if (event.nativeEvent.state === State.BEGAN) { | |
| spring(springValue, { | |
| toValue: 1, | |
| mass: 1, | |
| damping: 20, | |
| stiffness: 150, | |
| overshootClamping: false, | |
| restSpeedThreshold: 0.001, | |
| restDisplacementThreshold: 0.001, | |
| }).start(); | |
| } else if (event.nativeEvent.state === State.END) { | |
| spring(springValue, { | |
| toValue: 0, | |
| mass: 1, | |
| damping: 20, | |
| stiffness: 150, | |
| overshootClamping: false, | |
| restSpeedThreshold: 0.001, | |
| restDisplacementThreshold: 0.001, | |
| }).start(); | |
| // The function you want to perform at the end of the Gesture | |
| } else { | |
| spring(springValue, { | |
| toValue: 0, | |
| mass: 1, | |
| damping: 20, | |
| stiffness: 150, | |
| overshootClamping: false, | |
| restSpeedThreshold: 0.001, | |
| restDisplacementThreshold: 0.001, | |
| }).start(); | |
| } | |
| }} | |
| > | |
| <Animated.View | |
| style={[ | |
| { | |
| transform: [ | |
| { | |
| scale: interpolate(springValue, { | |
| inputRange: [0, 0.5], | |
| outputRange: [1, 0.95], | |
| }), | |
| }, | |
| ], | |
| }, | |
| ]} | |
| > | |
| { /* Your Component */ } | |
| </Animated.View> | |
| </TapGestureHandler> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment