BenJeau / react-native-draw

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

Generate IDs for paths for better performance #47

Open BenJeau opened 2 years ago

BenJeau commented 2 years ago

This is not currently a problem, but with https://github.com/BenJeau/react-native-draw/issues/46, if this is not implemented, it will become a problem since the keys for SVG paths is simply the index, and it will not be linear like it is right now once layering is implemented.

Implementation

Generate a random ID and add it to the path:

BenJeau commented 2 years ago

I think that the current time that the stroke was drawn is a good addition and we should still add a uuid to the paths or a counter (but a uuid would be easier implementation-wise)