Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Fling gesture ends when pointer was moved farther than minimum distance. The problem is that `onUp` method calls `endFling` after pointer was removed from tracker. This means that calling `this.tracker.getLastX(this.keyPointer)` (the same for `Y` position) inside `tryEndFling` will return undefined. It is rather cosmetic change - it doesn't really affect behavior since we call `tryEndFling` inside `onPointerMove`. This PR also changes minimum distance the pointer has to travel, since `160` is way to big. ## Test plan <details> <summary> Tested on the following code </summary> ```jsx import React from 'react'; import { View, StyleSheet } from 'react-native'; import { Gesture, GestureDetector } from 'react-native-gesture-handler'; export default function App() { const f = Gesture.Fling() .onEnd((e) => console.log(e)) .onFinalize((e, s) => console.log(e, s)); return ( <View style={styles.container}> <GestureDetector gesture={f}> <View style={styles.box} /> </GestureDetector> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: '#ecf0f1', padding: 8, }, box: { width: 500, height: 500, backgroundColor: 'blue', }, }); ``` </details>
- Loading branch information