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

Error [CoreGraphics] clip: empty path. #36

Closed cerven closed 2 years ago

cerven commented 2 years ago

I am showing react-native-draw with predefined paths.

In react native console it always log message "Error [CoreGraphics] clip: empty path.".

It looks like this error is because SVGRenderer it rendering "memoized"(currentPath) path even when it does not exists(is empty): https://github.com/BenJeau/react-native-draw/blob/master/src/components/renderer/SVGRenderer.tsx#L49

BenJeau commented 2 years ago

Would you have more information on the crash (version of React Native, if you are using Expo, version of Expo, version of react-native-svg, maybe logs)? I can create a simple fix, but I would like to know the root cause of this bug first.

I am unable to reproduce this error. It seems related to this https://github.com/react-native-svg/react-native-svg/issues/987 and https://github.com/react-native-svg/react-native-svg/issues/901.

cerven commented 2 years ago

App will not crash, you are right, it is related to react-native-svg. If I run it in expo, it is ok, but if i run it in custom build of expo(expo run:ios), or from xcode as native app, it will print this warning/error.

<Svg height={100} width={100}>
    <Path  d='' stroke='black' strokeLinejoin="round" />
</Svg>

attributes "d", "stroke" and "strokeLinejoin" are required for this to happen("d" has to be empty string).

It means in react-native-draw this will happen as I described above. It is not bug in this package.

BenJeau commented 2 years ago

Ok makes sense, I'll still merge the PR to remove that error/log for those who are using old versions

BenJeau commented 2 years ago

The fix for older versions of react-native-svg is now available in version 0.5.0 :tada: