While working on LongPress I've noticed that currently check if pointer is inside view is implemented inside NativeViewGestureHandler. I've decided to move it to GestureHandler to be able to use it in other places.
HitSlop
Current implementation of containsPointInView also takes into consideration HitSlop property. The only problem is that on macOS we cannot detect clicks outside of view using mouseDown. This means that HitSlop will work only if click was started inside view - clicking on HitSlop area won't activate handlers.
Test plan
Tested on example app. You can simply see that RectButtons navigate to examples - it doesn't work if pointerInside is false.
Also tested on the following code:
```tsx
export default function App() {
return (
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'space-around',
alignItems: 'center',
},
button: {
width: 100,
height: 30,
borderRadius: 15,
backgroundColor: 'crimson',
},
});
```
Description
While working on
LongPress
I've noticed that currently check if pointer is inside view is implemented insideNativeViewGestureHandler
. I've decided to move it toGestureHandler
to be able to use it in other places.HitSlop
Current implementation of
containsPointInView
also takes into considerationHitSlop
property. The only problem is that onmacOS
we cannot detect clicks outside of view usingmouseDown
. This means thatHitSlop
will work only if click was started inside view - clicking onHitSlop
area won't activate handlers.Test plan
Tested on example app. You can simply see that
RectButtons
navigate to examples - it doesn't work ifpointerInside
isfalse
.Also tested on the following code:
```tsx export default function App() { return (