Akhil Jasrotia
Akhil Jasrotia

Reputation: 181

Invariant Violation: requireNativeComponent: "RNSVGPath" was not found in the UIManager

I've already tried using React-native Link as well as Manual linking but the error is still persisting. React-native-svg Version : 8.0.8

Upvotes: 17

Views: 42514

Answers (13)

nanotart
nanotart

Reputation: 11

Tried every solution above...None of them worked. I'm using expo with an eas build. What ended up working at the end was rerunning the build command (mind you this is for ios).

eas build --profile development-simulator --platform ios

Upvotes: 1

dntrplytch
dntrplytch

Reputation: 159

Using expo, I had installed react-native-svg-transformer using

npm install --save react-native-svg-transformer

(I believe the following command had failed to install the package)

npx expo install react-native-svg-transformer

My app was simply showing a white screen after the initial splash screen.

adb logcat revealed the error message in this post title and the solution posted here, namely to install react-native-svg, worked.

Upvotes: 0

iskandar47
iskandar47

Reputation: 301

if you are using expo: remove the package that have react-native-svg as dependency

npm uninstall <package name>
npm expo install <package name>

using expo install allows Expo CLI to pick a compatible version of a library when possible and also warn you about known incompatibilities, more here in docs

Upvotes: 0

Soumik Chakraborty
Soumik Chakraborty

Reputation: 253

Install this package https://www.npmjs.com/package/react-native-svg

npm i react-native-svg

npx react-native run-android

Upvotes: 0

testing_22
testing_22

Reputation: 2585

Reinstall your Android app with yarn by issuing

yarn run android

which is

npx react-native run-android

Upvotes: 0

Thanh Toan
Thanh Toan

Reputation: 41

you don't need to add any code, just use the command

npx react-native run-android

to run the project again

Upvotes: 4

Elavarasan r
Elavarasan r

Reputation: 1285

The below steps solved my issue.

npm install react-native-svg
npm install react-native-svg-transformer

Uninstall your exist app

react-native-run-android

I hope, It will help someone.

Upvotes: 6

Ho&#224;ng L&#226;m
Ho&#224;ng L&#226;m

Reputation: 480

Should run npx pod-install instead pod install. It worked for me

Upvotes: 0

Marvelous Ikechi
Marvelous Ikechi

Reputation: 2043

running npx pod-install should solve it.

Upvotes: 6

Diomidis Spinellis
Diomidis Spinellis

Reputation: 19325

I fixed the problem by explicitly installing the corresponding dependency.

yarn add react-native-svg

Upvotes: 25

AjinkyaSharma
AjinkyaSharma

Reputation: 1979

If on iOS, might try doing a pod install after you have done an npm install

  1. Go to the iOS directory in your project.
  2. Do a pod install
  3. Open xcode and run again.

Upvotes: 14

Guilherme
Guilherme

Reputation: 31

Import package at MainApplication.java

import com.horcrux.svg.SvgPackage;

Then add package to list

new SvgPackage()

Upvotes: 1

Julian K
Julian K

Reputation: 2001

See discussion and solutions here: https://github.com/react-native-community/react-native-svg/issues/834

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.

this is a bug and need to be fixed.

and

In iOS this bug appeared in 7.0.2. To fix, in xcode go to Your_Project / Build Phases / Link Binary With Libraries and add "libRNSVG.a"

Upvotes: 3

Related Questions