Invariant Violation: requireNtiveComponent: "RNSVGRect" was not found in the UIManager
See original GitHub issueHello.
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.
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.
Update: When running project via xcode, I get:
What’s happening?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:17
Top GitHub Comments
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.
it supports autolink now just
cd ios
and dopod install