question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invariant Violation: requireNtiveComponent: "RNSVGRect" was not found in the UIManager

See original GitHub issue

Hello.

react-native link react-native-svg - done. react-native link - done. yarn cache clean - done. reinstalling of react-native-svg - done. react-native run-ios after every action - done.

Manual linking:

To install react-native-svg on iOS visit the link referenced above or do the following:

Open your project in XCode and drag the RNSVG.xcodeproj file (located in …/node_modules/react-native-svg/ios) into the Libraries directory shown in XCode. Expand the RNSVG.xcodeproj file you just added to XCode until you see: libRNSVG.a (located in RNSVG.xcodeproj > Products ) Drag libRNSVG.a into the Link Binary With Libraries section (located in Build Phases which may be found at the top of the XCode window)

DONE.

scr

Versions:

“react-native-svg”: “^6.5.1”, “react-native”: “0.56.0”,

Code block that causes error:

<Svg height={this.state.maskedElHeight} width={this.state.maskedElWidth} style={{ position: "absolute", top: 0, left: 0, }}>

   <Defs>

       <ClipPath id="clip">

           <Rect x="0" y="0" width="100%" height="100%" />
           <Polygon x="0" y="0" points={`
               ${Math.round(this.state.maskedElWidth / 2)},0 
               0,${Math.round(this.state.maskedElHeight * 0.25)}
               0,${Math.round(this.state.maskedElHeight * 0.75)} 
               ${Math.round(this.state.maskedElWidth / 2)},${Math.round(this.state.maskedElHeight)} 
               ${Math.round(this.state.maskedElWidth)},${Math.round(this.state.maskedElHeight * 0.75)} 
               ${Math.round(this.state.maskedElWidth)},${Math.round(this.state.maskedElHeight * 0.25)} 
               `} 
           />
       </ClipPath>

   </Defs>

   <Rect
       x="0"
       y="0"
       width="100%"
       height="50%"
       fill="#FF187C"
       opacity="1"
       clipPath="url(#clip)"
   />

   <Rect
       x="0"
       y="50%"
       width="100%"
       height="50%"
       fill="white"
       opacity="1"
       clipPath="url(#clip)"
   />
   
</Svg>

Android is ok, but iOS shows me the error.

scr2

Update: When running project via xcode, I get:

err

What’s happening?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:17

github_iconTop GitHub Comments

23reactions
creative-gitcommented, Nov 23, 2018

react-native link is missing the last step. it is not adding “new SvgPackage()

Open up `android/app/src/main/java/[…]/MainApplication.java Add new SvgPackage() to the list returned by the getPackages() method. Add a comma to the previous item if there’s already something there.

i think this is a bug and need to be fixed.

10reactions
haode333commented, Aug 5, 2019

it supports autolink now just cd ios and do pod install

Read more comments on GitHub >

github_iconTop Results From Across the Web

requireNtiveComponent: "RNSVGRect" was not found in the ...
P.S. As I am new to react native and using native code there, it was not so obvious for me. It would be...
Read more >
Invariant Violation: requireNativeComponent: "RNSVGPath ...
I fixed the problem by explicitly installing the corresponding dependency. yarn add react-native-svg.
Read more >
"RNSVGRect" was not found in the UIManager - Bountysource
Invariant Violation : requireNtiveComponent: "RNSVGRect" was not found in the UIManager.
Read more >
react-native-svg - npm
react-native-svg provides SVG support to React Native on iOS, Android, macOS, Windows, and a compatibility layer for the web.
Read more >
Invariant Violation: requireNtiveComponent: "RNSVGRect" was not ...
Invariant Violation : requireNtiveComponent: "RNSVGRect" was not found in the UIManager. This issue has been tracked since 2020-02-10. I ran 2 cmd lines:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found