terrylinla / react-native-sketch-canvas

A React Native component for drawing by touching on both iOS and Android.
MIT License
697 stars 453 forks source link

Fix: `onPathsChange()` callback no longer fires on iOS after update to 0.7.0 #96

Open toblerpwn opened 5 years ago

toblerpwn commented 5 years ago

Fixes #95

I have found the source of the problem; addPath() and more specifically the onLayout() callback in the render function of SketchCanvas.js is no longer triggered except at launch, where no paths exist. This is probably due to some of the optimizations done in 0.7.0, but I actually couldn't deduce the exact cause--the rendering code on iOS has grown outside of my expertise!

The result is that addPath:strokeColor:strokeWidth:points: is no longer being called. As a workaround (but also maybe a better fix), I have added a call to the onPathsChange() event when endPath() is triggered.

Additional suggestion @terrylinla - we should probably pull out the entire addPath:strokeColor:strokeWidth:points: function, as well as its up & downstream stuff. I just didn't want to do this because I am a little out of date on the repo in general.

stephenlaughton commented 5 years ago

ran into this issue as well. any chance this will be merged soon?