react-native-svg: Upgrade to react-native 0.59 breaks react-native-svg

Steps: Upgrade to react-native 0.59.0, build and run App, and get the following:

TypeError: method.bind is not a function. (In 'method.bind((0, _assertThisInitialized2.default)(_this))', 'method.bind' is undefined)

This error is located at:
    in Svg (at NumberCircle.js:7)
    in NumberCircle (at Overview.js:12)
    in RCTView (at View.js:45)
    in View (at Overview.js:10)
    in Overview (at LandingScreen.js:238)
    in RCTView (at View.js:45)
    in View (at LandingScreen.js:237)
    in RCTView (at View.js:45)
    in View (at LandingScreen.js:220)
    in LandingScreen (at SceneView.js:9)
    in SceneView (at StackViewLayout.js:574)
    in RCTView (at View.js:45)
    in View (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewCard.js:12)
    in Card (at createPointerEventsContainer.js:28)
    in Container (at StackViewLayout.js:612)
    in RCTView (at View.js:45)
    in View (at StackViewLayout.js:470)
    in RCTView (at View.js:45)
    in View (at StackViewLayout.js:469)
    in StackViewLayout (at withOrientation.js:30)
    in withOrientation (at StackView.js:63)
    in RCTView (at View.js:45)
    in View (at Transitioner.js:169)
    in Transitioner (at StackView.js:21)
    in StackView (at createNavigator.js:59)
    in Navigator (at createKeyboardAwareNavigator.js:11)
    in KeyboardAwareNavigator (at createNavigationContainer.js:376)
    in NavigationContainer (at App.js:60)
    in RCTView (at View.js:45)
    in View (at Root.js:13)
    in Root (at connectStyle.js:384)
    in Styled(Root) (at App.js:59)
    in Sidekick (at renderApplication.js:35)
    in RCTView (at View.js:45)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:45)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:34)
...

IMG_0919

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 20

Most upvoted comments

also had missing “RNSVGVectorEffect.h” downgrading to 9.2.4 worked for me

@marcorm I think something like the following should help: rm -rf node_modules npm install npm start – --reset-cache

none of these suggestions worked on Android

I upgraded react-native-svg from 8.0.10 to 9.3.3 and was able to build it for iOS. Since it appears to have been either an issue with an older version of r-n-svg or an issue with clearing out caches while upgrading I am closing this for now.

@teekirol Can you make a reproduction?

react-native unlink react-native-svg
react-native link react-native-svg

Should be enough to link the new files after upgrading.

This error appears also in Android. EDIT: upgrading to version 9.3.7 fix the problem!

@iagorm You have 9.3.7 working in Android or just iOS? Still having issues with 9.3.7 in Android 😢

Here the svg is working but I’m using only Svg and Polygon components from it, try to clean your gradle cache, remove your node modules and gradlew --stop to see if it works.

I found one way to make it work for iOS:

  1. Open the iOS project in the iOS folder
  2. Drag the RNSVGVectorEffect.h file into the Utils folder
  3. Close the project, and open the RN project in XCode
  4. Remove the RNSVG library, and add it again from the node modules
  5. Add the RNSVG to the Link with Binary

Hope this helps some people until this get’s fixed in a new build

@tehOPEologist I had the same issue and ended up downgrading react-native-svg to 9.2.4

@tehOPEologist try relinking (unlink and link again)