Skip to content
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 'strokeWidth' in shadow node of type: RNSVGLine #583

Closed
tanmaybhatt opened this issue Jan 21, 2018 · 5 comments

Comments

@tanmaybhatt
Copy link

I was working on Expo for quite some time. It uses react-native-svg version 5.5.1. So when I updated to version 6.0.1-rc.3, it started giving this error:

screenshot_20180121-180718

I went into the extractStroke source code and change strokeWidth to parseFloat(strokeWidth) in the return object and it started to work.
Then, I realized that these lines were not there in version 5.5.1 .

if (!strokeWidth || typeof strokeWidth !== 'string') {
        strokeWidth = `${strokeWidth || 1}`;
    }

Maybe changing strokeWidth to a floating number would solve this issue.
Am I right or am I missing something here?

react-native-svg@6.0.1-rc.3
react-native@0.50.3

@msand
Copy link
Collaborator

msand commented Jan 21, 2018

Your native bundle is old, and doesn't use the latest version, which supports units in the strokewidth. The units require a string to be passed, as a number cannot represent it.

@tanmaybhatt
Copy link
Author

Oh, Thanx, I did not know about this update, i'll try updating the version or may be ejecting from expo.

@tanmaybhatt
Copy link
Author

tanmaybhatt commented Jan 21, 2018

Okay, Thank you so much, it took some time but got it to work after making a new project from react-native init and following the steps over here
#584 and here #581

@lovelyKarthi
Copy link

@tanmaybhatt Provided link is not working, i have same issue please suggest how to fix this
i'm using
"react": "^16.0.0",
"react-native": "0.51.0",
victory-native@~0.16.2
react-native-svg@6.0.1-rc.1

@tanmaybhatt
Copy link
Author

tanmaybhatt commented Jan 24, 2018

@lovelyKarthi , I have updated my comment , Are you using Expo? if that's the case then you have to eject from Expo first. In my case after ejecting I updated react-native to 0.52.0 and react-native-svg to 6.0.1-rc.3. Remember to link react-native-svg if you haven't.
Then I changed my compileSdkVersion to 27, buildToolsVersion to "27.0.1" and changed android support dependency version to "com.android.support:appcompat-v7:27.0.1" in android/app/build.gradle file.

...
android {
    compileSdkVersion 27
    buildToolsVersion "27.0.1"
    ....
    dependencies {
         compile project(':react-native-svg')
         compile fileTree(dir: "libs", include: ["*.jar"])
         compile "com.android.support:appcompat-v7:27.0.1"
         compile "com.facebook.react:react-native:+"  // From node_modules
    }
    ....

Then updated my gradle distribution to 4.1 in android/gradle/wrapper/gradle-wrapper.properties file

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

Then added google() in buildscript repositories and allproject repositories in android/build.gradle file and change classpath in the same file to com.android.tools.build:gradle:3.0.1

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

And I guess that was pretty much it and it started to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants