BenJeau / react-native-draw

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

Be able to draw single dots #66

Open simonrahm opened 1 year ago

simonrahm commented 1 year 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 1 year 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 1 year 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.