BenJeau / react-native-draw

SVG based data-driven React Native drawing component 🎨
https://www.npmjs.com/package/@benjeau/react-native-draw
MIT License
131 stars 41 forks source link

Be able to draw single dots #66

Open simonrahm opened 2 years ago

simonrahm commented 2 years ago

Is your feature request related to a problem?

Right now when drawing dots (so just tapping the canvas), it will create a simplified line between those dots, and continue drawing this path with every new tap on the canvas.

Desired solution (feature)

It should be possible to draw dots, so every tap on the canvas should create a dot.

Alternatives considered

There is this closed issue #5 but it seems like it is not solved yet. I also tried screwing around in react-natuve-draw/src/utils.ts , but i was not able to get it working. Would appreciate any help! :)

Anything else?

No response

simonrahm commented 2 years ago

EDIT: Seems like I found a (at least temporary) solution to this, to whoever faces the same problem:

In Canvas.tsx, replace the function onEnd() with onTouchesUp(). (https://docs.swmansion.com/react-native-gesture-handler/docs/api/gestures/tap-gesture/#ontouchesupcallback)

It seems like onEnd() does not properly recognise a single tap, whereas onTouchesUp() does.

BenJeau commented 2 years ago

Thanks @simonrahm for looking into this! I'm not aware of the usage of the new react-native-gesture-handler, if you'd like for this to be introduced in the library, I would accept a PR with the change.