Commit d3631c4
authored
[Android] Correct
## Description
Follow up for #4078
I've noticed that when `Rotation` does not activate, but pointers are
released, `onFinalize` is called with `true`. This happens because we
try to move it to `END` state, but our internal logic does not send
`onDeactivate`.
Code in `onHandle` that I removed was effectively dead, as `ACTION_UP`
was handled in rotation detector - the only possible branch was `else`
statement which fails handler if only one pointer was present.
## Test plan
<details>
<summary>Tested on Transformations example and the following
code:</summary>
```tsx
import { StyleSheet, View } from 'react-native';
import {
GestureDetector,
GestureHandlerRootView,
usePinchGesture,
useRotationGesture,
} from 'react-native-gesture-handler';
export default function App() {
const g = useRotationGesture({
onBegin: () => console.log('onBegin'),
onActivate: () => console.log('onActivate'),
onUpdate: (e) => console.log('onUpdate', e.rotation),
onDeactivate: () => console.log('onDeactivate'),
onFinalize: (_, s) => console.log('onFinalize', s),
});
return (
<GestureHandlerRootView style={styles.container}>
<GestureDetector gesture={g}>
<View style={styles.box} />
</GestureDetector>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
box: {
width: 200,
height: 200,
backgroundColor: 'blue',
borderRadius: 12,
},
});
```
</details>Rotation handler (#4079)1 parent 9a6c609 commit d3631c4
1 file changed
Lines changed: 10 additions & 7 deletions
File tree
- packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| |||
0 commit comments