()
| 3 | import { PanGestureHandler, State } from 'react-native-gesture-handler' |
| 4 | |
| 5 | export default function MyComponent() { |
| 6 | const translationY = useRef(new Animated.Value(0)) |
| 7 | |
| 8 | const event = useRef( |
| 9 | Animated.event([{ nativeEvent: { translationY: translationY.current } }], { |
| 10 | useNativeDriver: true, |
| 11 | }) |
| 12 | ) |
| 13 | |
| 14 | return ( |
| 15 | <PanGestureHandler |
| 16 | onGestureEvent={event.current} |
| 17 | onHandlerStateChange={(event) => { |
| 18 | if (event.nativeEvent.state === State.ACTIVE) { |
| 19 | // Do something |
| 20 | } |
| 21 | }} |
| 22 | > |
| 23 | <Animated.View |
| 24 | style={{ transform: [{ translateY: translationY.current }] }} |
| 25 | /> |
| 26 | </PanGestureHandler> |
| 27 | ) |
| 28 | } |
nothing calls this directly
no outgoing calls
no test coverage detected