-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while updating property 'd' in shadow node of type RNSVGPath for input string 'h' #1080
Comments
Can you give an example svg file you're having issues with? |
@msand please find the below code where I faced this issue
please be notified that I am facing this error with multiple icons and each error indicated different character. This time it indicates 'For input string I'. |
Seems your arc commands are broken: https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands Command | Name | Parameters And you have So either the path data was incorrect from the start, or svgo / svgr has optimized it incorrectly. Can you provide the original svg, not the converted one? |
That is, you have one too few parameters for the arc command to be parsed, and it finds an l instead of the last number. |
@msand seems I lost the original svg code of above mentioned. But i have the some other svg code which gives error too. But this code showing error with letter 'h',
|
SVGO added a new optimization in 1.3 that we've had to disable, see svg/svgo#1137 & svg/svgo#1138. Is this something RN SVG will support? In our case Android crashed completely and iOS displayed totally broken ones
Happy to open up a new issue if you want? |
What part of the grammar is referred to? At least what I can see, elliptical-arc-argument requires two nonnegative-numbers, one number, two flags and a coordinate-pair which consists of two numbers. Only comma-wsp? seems optional. elliptical-arc:
( "A" | "a" ) wsp* elliptical-arc-argument-sequence
elliptical-arc-argument-sequence:
elliptical-arc-argument
| elliptical-arc-argument comma-wsp? elliptical-arc-argument-sequence
elliptical-arc-argument:
nonnegative-number comma-wsp? nonnegative-number comma-wsp?
number comma-wsp flag comma-wsp? flag comma-wsp? coordinate-pair
coordinate-pair:
coordinate comma-wsp? coordinate
coordinate:
number |
I don't know the spec at all, and SVGs are a mystery to me, sorry! 😬 Maybe ask over there? The commit, if it helps at all: svg/svgo@258fecf |
So the issue is because of flags being a single digit without comma-wsp in between, and the regex matches decimal numbers. |
Here's good inspiration if you're available to work on this: https://github.com/RazrFalcon/svgtypes/blob/master/src/path/parser.rs |
Can you try with 79956a9 ? |
Both iOS and Android seems to work fine in f121497 |
@msand I have updated the package to recent version but still facing error. Do i need to clone the clone the recent commit? |
@Yandamuri Yes, |
@Yandamuri any progress? |
I'm using Expo, so it's not really easy for me to test. However, I can give you a quick app that errors on android (with "error while updating property 'd' of a view managed by: RNSVGPath") and looks wrong on ios: https://snack.expo.io/@folio/27a1af Rendering iOS screenshots: The diff between those two: diff --git i/packages/folio-native-app/App.tsx w/packages/folio-native-app/App.tsx
index 54fa98d87..d41b583a2 100644
--- i/packages/folio-native-app/App.tsx
+++ w/packages/folio-native-app/App.tsx
@@ -36,26 +36,23 @@ const Barry1Avatar = () => (
strokeMiterlimit={10}
/>
<Path
- d="M15.892 10.602l2.27 3.115A7.481 7.481 0 0 0 30.037 14l2.735-3.398c-1.271-.79-4.359-1.335-6.024.665l-2.462-5.485-2.838 5.485c-1.98-1.819-4.84-1.546-5.555-.665z"
+ d="M15.892 10.602l2.27 3.115A7.481 7.481 0 0030.037 14l2.735-3.398c-1.271-.79-4.359-1.335-6.024.665l-2.462-5.485-2.838 5.485c-1.98-1.819-4.84-1.546-5.555-.665z"
fill="#79DBC1"
stroke="currentColor"
strokeWidth={1.5}
strokeMiterlimit={10}
/>
<Path
- d="M17.61 17.705a.913.913 0 1 0 .001-1.826.913.913 0 0 0 0 1.826zM31.663 18.918a.913.913 0 1 0 0-1.827.913.913 0 0 0 0 1.826zM27.108 19.53a.913.913 0 1 0 0-1.825.913.913 0 0 0 0 1.826zM21.725 20.444a.913.913 0 1 0 0-1.826.913.913 0 0 0 0 1.826zM31.771 22.759a.913.913 0 1 0 0-1.827.913.913 0 0 0 0 1.827zM34.759 26.638a.913.913 0 1 0 0-1.826.913.913 0 0 0 0 1.826zM16.698 22.27a.913.913 0 1 0 0-1.826.913.913 0 0 0 0 1.826zM13.665 25.826a.913.913 0 1 0 0-1.826.913.913 0 0 0 0 1.826z"
+ d="M17.61 17.705a.913.913 0 10.001-1.826.913.913 0 000 1.826zM31.663 18.918a.913.913 0 100-1.827.913.913 0 000 1.826zM27.108 19.53a.913.913 0 100-1.825.913.913 0 000 1.826zM21.725 20.444a.913.913 0 100-1.826.913.913 0 000 1.826zM31.771 22.759a.913.913 0 100-1.827.913.913 0 000 1.827zM34.759 26.638a.913.913 0 100-1.826.913.913 0 000 1.826zM16.698 22.27a.913.913 0 100-1.826.913.913 0 000 1.826zM13.665 25.826a.913.913 0 100-1.826.913.913 0 000 1.826z"
fill="#fff"
/>
<Path
- d="M28.786 29.52a1.637 1.637 0 1 0-3.274 0M22.488 29.588a1.637 1.637 0 1 0-3.274 0"
+ d="M28.786 29.52a1.637 1.637 0 10-3.274 0M22.488 29.588a1.637 1.637 0 10-3.274 0"
stroke="currentColor"
strokeWidth={1.5}
strokeMiterlimit={10}
/>
- <Path
- d="M21.02 32.227a2.98 2.98 0 0 0 5.96 0h-5.96z"
- fill="currentColor"
- />
+ <Path d="M21.02 32.227a2.98 2.98 0 005.96 0h-5.96z" fill="currentColor" />
</G>
<Defs>
<ClipPath id="Barry1Avatar__clip0"> Not the easiest to read, so: |
@SimenB Unless you've ejected from expo, you cannot upgrade react-native-svg. Testing in expo without rebuilding the native bundle with the changes doesn't provide any information. |
@msand I have tested with multiple icons where i was getting this error and it's working fine. BTW i tested only in android and i hope works in ios as well. When this commit would be merged? |
Well, the commit is in the develop branch, so it's already merged, just not in the master branch yet. The change is quite significant. I'm considering if a release candidate would be appropriate. Then again, people can just revert to the version before it if there are issues. Would just like to have a bit more testing of it before cutting a new release. |
@msand Any way feeling happy now to know the root cause and having the solution for it. Thank you so much for your prompt response and effort. May i know how days will it take to have this change in master? Till then can I continue with this recent commit? |
I know, it was more so you had a full example you could run on your own device(s) to validate. I'm unable to test myself |
@Yandamuri I just published v9.8.0 with the changes, and the commits are in master now. react-native init CleanProject
cd CleanProject/
yarn add react-native-svg
cd ios && pod install && cd .. And then just add the svg components you want to test to App.js and you're done. |
For me, Android crashes with the "Error while updating property 'd' in shadow node of type RNSVGPath" error on react-native-svg v9.8.0 but not v9.7.1. This is the problematic part of one svg icon I use:
I'm using react-native v0.60.5. |
@draperunner Can you try with v9.8.1? |
Yes, that works! Thanks @msand ! :) |
@msand v9.8.1 is working fine ! :) |
Facing this issue for few icons . I have gone through many git hub and stack over flow discussions like these, But unable to figure out the exact root cause.
In my case I am down loading Flat icons in svg format and then converting the svg to react-native format by using this online converter which is suggested by react-native-svg package itself.
I am using,
"react-native": "0.60.5",
"react-native-svg": "9.4.0",
Can somebody tell me the root cause for this error and how to resolve it?
The text was updated successfully, but these errors were encountered: