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

Reexport `createSVGPath` from utils #34

Closed cerven closed 2 years ago

cerven commented 2 years ago

I am saving just coordinates of draw. When I want to show original drawing(pass initialValues.paths), it is not possible just passing there coordinates(and color, thickness,...), it is required pass also path as SVG string. This SVG string is internally generated when drawing by function in utils createSVGPath.

It would be good to reexport this function so it can be used for generating SVG path, or add method for generate drawing just from coordinates without SVG path variable(call createSVGPath internally).

Now I am importing this function directly with import { createSVGPath } from "../node_modules/@benjeau/react-native-draw/src/utils"; which is not ideal

BenJeau commented 2 years ago

You are right that this is a weird situation, I can re-export that function, but what I had in mind was a bit more user friendly - simply not caring about the SVG path creation.

I will work a bit on the code to make it so that the path is not required for the initialValues.

cerven commented 2 years ago

Even #35 fixes mentioned issue, still will be good to reexport this function, it can be sometimes handy. (in my app I need it again in another usecase).

Actually I need to generate SVG from points(as preview) without rendering "Draw".

My options are:

BenJeau commented 2 years ago

Ok sounds good, I will re-export it

BenJeau commented 2 years ago

This is now available in version 0.5.0 :tada: