Commit ba999e0
authored
[Android] Fix
## Description
`hitSlop` can be used to shrink area of the interactive part of
component. On Android, it can also be used to expand it. This is
currently broken with Native Detector, as it doesn't consider `hitSlop`
itself.
Making `recordViewHandlersForPointer` run unconditionally for native
detector resolves this issue.
> [!NOTE]
> There are additional checks inside `recordViewHandlersForPointer`, so
it should be safe.
## Test plan
<details>
<summary>Tested on the following example:</summary>
```tsx
import { View, StyleSheet } from 'react-native';
import {
Gesture,
GestureDetector,
GestureHandlerRootView,
usePanGesture,
} from 'react-native-gesture-handler';
export default function App() {
const pan = usePanGesture({
onUpdate: (e) => {
console.log('[V3]', e);
},
hitSlop: 25,
});
const oldPan = Gesture.Pan()
.onUpdate((e) => {
console.log('[V2]', e);
})
.hitSlop(25);
return (
<GestureHandlerRootView style={styles.container}>
<GestureDetector gesture={pan}>
<View style={styles.box} />
</GestureDetector>
<GestureDetector gesture={oldPan}>
<View style={styles.box} />
</GestureDetector>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
gap: 50,
},
box: {
height: 150,
width: 150,
backgroundColor: 'blue',
borderRadius: 20,
},
});
```
</details>hitSlop on native detector (#4049)1 parent 2e98457 commit ba999e0
1 file changed
Lines changed: 1 addition & 1 deletion
File tree
- packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| |||
0 commit comments