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

Tried to register two views with the same name RNSVGPath #591

Closed
obetomuniz opened this issue Jan 30, 2018 · 44 comments
Closed

Tried to register two views with the same name RNSVGPath #591

obetomuniz opened this issue Jan 30, 2018 · 44 comments

Comments

@obetomuniz
Copy link

As you can see in the screenshot, I get the issue when I tried use 2 libraries that use react-native-svg as dependency. I'm using RN 0.52 and RN-svg 6.0.1-rc.2

simulator screen shot - iphone 6 - 2018-01-30 at 12 11 31

@msand
Copy link
Collaborator

msand commented Jan 30, 2018

@ewalti
Copy link

ewalti commented Jan 31, 2018

I'm back on 5.5.1 on my project but wanted to try 6.x to see if it would fix some other issues I was having. Rolling up caused this same conflict at first, because I seemingly had another library requiring the old version (react-native-pathjs-charts) and 6.x. I removed that library, as I was no longer using it, rm -rf node_modules, yarn, react-native link, and the issue went away.

@sibelius
Copy link

this happens when another lib has this package as a dependency, we can close this

@msand
Copy link
Collaborator

msand commented Feb 12, 2018

Alright, I'll go ahead and close this.

@msand msand closed this as completed Feb 12, 2018
@HarmJan1990
Copy link

Hi there,

I get this error but i only have react-native-svg included once.
There is no other library that requires it in my project but i still get this error.
Any clues?

@yogeshR5
Copy link

+1

@viewsing
Copy link

Expo also has the react-native-svg, so I remove the react-native-svg when using Expo, the error is gone

@jean-noelp
Copy link

Removing react-native-svg is just a workaround.
Me, i need last version of react-native-svg too, how to do that ?

@matteocollina
Copy link

Same issue
react-native-cli: 2.0.1
react-native: 0.55.4

npm list react-native react-native-svg :
schermata 2018-09-05 alle 21 40 19

@tmswartz12
Copy link

Getting this issue. Is there a working solution?

@sftgf
Copy link

sftgf commented Nov 11, 2018

+1

@msand
Copy link
Collaborator

msand commented Nov 11, 2018

If you're using yarn, then you can use resolutions: https://yarnpkg.com/en/docs/package-json#toc-resolutions
E.g. if you're using react-native-svg v8.0.8 and want to override it in all your dependencies, add this to your package.json file and run yarn again:

  "resolutions": {
    "react-native-svg": "8.0.8"
  }

Or, if you're using npm, then you can run: https://www.npmjs.com/package/npm-force-resolutions#how-to-use

rm -r node_modules
npx npm-force-resolutions
npm install

@vjsingh
Copy link

vjsingh commented Jan 4, 2019

This seems to be a new issue in Expo 31? None of the fixes in this thread worked for me

@msand
Copy link
Collaborator

msand commented Jan 6, 2019

@vjsingh Expo already includes react-native-svg, you shouldn't add it as a dependency.

@vjsingh
Copy link

vjsingh commented Jan 7, 2019

@msand Thanks for the advice. I'm not sure what it was since I removed my dependency on react-native-svg. It may be related to https://github.com/JesperLekland/react-native-svg-charts which I used, but that library appears to load react-native-svg as a peer dependency which looks to be the right way to do it?

Anyway, for now I am just going to stick with Expo 30 until I have some more time. Thank you again for the help.

@abduraufsherkulov
Copy link

I have a similar issue here. Expo 32, as soon as it renders the component, expo crashes.

@msand
Copy link
Collaborator

msand commented Feb 10, 2019

@abduraufsherkulov if you use expo, then this library comes built in and you shouldn't add it as a dependency, also make sure none of your other dependencies depend on it. Or, eject the project.

@vjsingh
Copy link

vjsingh commented Feb 11, 2019

I'm not sure if I set my package.json wrong somehow, but after upgrading to Expo 31 I had to change all imports of react-native-svg in a package I depend on to import from Expo instead.

vjsingh/react-native-svg-charts@298f371

@msand
Copy link
Collaborator

msand commented Feb 11, 2019

That sounds correct, Expo should probably change their setup, such that they also expose the react-native-svg module.

@msand
Copy link
Collaborator

msand commented Feb 11, 2019

You can find examples of ejecting from expo: https://github.com/msand/InfiniDrawExpo
to ExpoKit: https://github.com/msand/InfiniDrawExpo/tree/expokiteject
or to plain react-native: https://github.com/msand/InfiniDrawExpo/tree/nativeeject
And the original project which has both web (using react-native-web) and plain react-native here: https://github.com/msand/InfiniDraw/

@gtiongco95
Copy link

gtiongco95 commented Apr 2, 2019

I've tried removing the react-native-svg dependency and updated my imports to use expo instead but when I run my app I get a: "React.isMemo is not a function. (In 'React.isMemo(component)', 'React.isMemo' is undefined)"

Has anyone else experienced this or know what is wrong?

@msand
Copy link
Collaborator

msand commented Apr 2, 2019

Are you using react-redux or react-is? Perhaps this thread can help you: vercel/next.js#6117

@gtiongco95
Copy link

gtiongco95 commented Apr 2, 2019

Using react-redux. Tried the approach of pinning my version to 4.4.9 from 5.1.0 which it was initially. However, I'm met with other issues so don't really think that would be a feasible approach for me..

EDIT making the changes to use expo's svg, clearing node_modules, removing package-lock.json, running npm install and running expo start -c (with the clear cache flag) worked for me.

@lylest
Copy link

lylest commented Apr 26, 2019

i am still facing the same issue

@akshaygore06
Copy link

 npmPackages:
      react: 16.8.6 => 16.8.6 
      react-native: ^0.59.5 => 0.59.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-shimmer: 0.5.0
      react-native: 0.59.8

still facing same issue.. tried npm-force-resolutions but no results.

Screen Shot 2019-05-14 at 10 35 59 AM

@astw
Copy link

astw commented Jun 7, 2019

My case,
If I remove react-native-svg, I got an error complaining there is no react-native-svg,
If I include I got 'register two views with the same name RNSVGPath' error.
npm-force-resolutions doesn't help.

@martinfrouin
Copy link

I'm facing this issue as well
[fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Tried to register two views with the same name RNSVGPath

I'm using react-native@0.59.9 and react-native-svg@5.5.1

I'm not using Expo, and the @msand solution doesn't work for me.

Please reopen this issue

@msand
Copy link
Collaborator

msand commented Jul 2, 2019

Can you make a minimal reproduction first?

@Jimexa
Copy link

Jimexa commented Jul 12, 2019

@astw I am facing the same issue. Have you figured it out yet?

@dragslag
Copy link

@Jimexa I went through every file in react-native-svg-charts and changed import Svg {Line, etc,etc} from 'react-native-svg' to import Svg {Line, etc, etc} from 'expo' and that works for now.

@vjsingh
Copy link

vjsingh commented Jul 12, 2019

@dragslag You may want to look into Victory charts. I used react-native-svg-charts for a while, and it's a great library but not actively maintained anymore. The switch didn't take too long

@dragslag
Copy link

Thanks @vjsingh I'll check it out

@Vincetroid
Copy link

What should you do if you want to use react-native-qrcode-svg in Expo?

@RikusWiehahn
Copy link

How I fixed this:

  1. Make sure react-native-svg is not in package.json
  2. Delete package-lock.json
  3. Delete node_modules
  4. Run npm install

@nandorojo
Copy link

expo-install react-native-svg caused this issue for me since it appears to install the wrong version. This fixed it:

rm -rf node_modules
npm i react-native-svg@9.11.1
npm i
expo start -c

Answer from StackOverflow

@chanonroy
Copy link

I was able to solve this issue by installing the appropriate version using:

expo install react-native-svg

@Egizas
Copy link

Egizas commented May 11, 2020

My case,
If I remove react-native-svg, I got an error complaining there is no react-native-svg,
If I include I got 'register two views with the same name RNSVGPath' error.
npm-force-resolutions doesn't help.

I have exactly the same situation. Did you manage to solve it?

@chanonroy
Copy link

My case,
If I remove react-native-svg, I got an error complaining there is no react-native-svg,
If I include I got 'register two views with the same name RNSVGPath' error.
npm-force-resolutions doesn't help.

I have exactly the same situation. Did you manage to solve it?

@Egizas, try installing using expo install react-native-svg and then reference it as seen here

@daihovey
Copy link

This issue is back in 1.6.5

"dependencies": {
    ...
    "react-native-svg": "9.6.4",
    ...
  },

@dcsan
Copy link

dcsan commented Aug 24, 2022

I have a similar issue.

if i remove it from package.json the app will complain it doesn't exist
if i add it, i get the duplication error

$ yarn why react-native-svg   
yarn why v1.22.19
warning ../../../../package.json: No license field
[1/4] 🤔  Why do we have the module "react-native-svg"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "react-native-svg@12.3.0"
info Has been hoisted to "react-native-svg"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "18.59MB"
info Disk size with unique dependencies: "20.15MB"
info Disk size with transitive dependencies: "22.29MB"
info Number of shared dependencies: 3
=> Found "@walletconnect/react-native-dapp#react-native-svg@9.6.4"
info This module exists because "@walletconnect#react-native-dapp" depends on it.
info Disk size without dependencies: "1.54MB"
info Disk size with unique dependencies: "1.54MB"
info Disk size with transitive dependencies: "1.54MB"
info Number of shared dependencies: 0
✨  Done in 0.34s.

so there are two versions, the peer dep of another package is using an older version.
if i install that version at the top level it now works:

yarn add react-native-svg@9.6.4

✅ ok from then

@R-Art-project
Copy link

moving react-native-svg towards the peerDependencies solved this problem for me.

"peerDependencies": {
"react-native-svg": "13.8.0"
},

@AftabUfaq
Copy link

this issue is basically due to the different react-native-svg dependencies. for example I was using a package react-native-cool-speedometer it was using a different version 12.x.x and I was using 13.5.0 after upgrading the react-native-coolspeedometer it was going

@Aswanth-c
Copy link

I had the same issue.
I had to uninstall the react-native-svg package using the npm command
but at the same time, it caused another issue, which is
"Invariant Violation: requireNativeComponent: "RNSVGPath" was not found in the UIManager."
then I did an expo install react-native-svg instead of npm install react-native-svg
Which fixes the issue

@mad-dogy
Copy link

Make sure you set the width and height for the svg icon

I had the same issue and it helps me :)

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