react-native-svg icon indicating copy to clipboard operation
react-native-svg copied to clipboard

Tried to register two views with the same name RNSVGPath

Open obetomuniz opened this issue 8 years ago • 44 comments

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

obetomuniz avatar Jan 30 '18 18:01 obetomuniz

Probably similar issue to this: https://stackoverflow.com/questions/46613149/tried-to-register-two-views-with-the-same-name-progressbarandroid and https://github.com/invertase/react-native-firebase/commit/54c92d0640e8765e4ab3d624dc1577bcc4ed7bfa

msand avatar Jan 30 '18 20:01 msand

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.

ewalti avatar Jan 31 '18 17:01 ewalti

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

sibelius avatar Feb 12 '18 12:02 sibelius

Alright, I'll go ahead and close this.

msand avatar Feb 12 '18 13:02 msand

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?

HarmJan1990 avatar Mar 31 '18 01:03 HarmJan1990

+1

yogeshR5 avatar Jun 12 '18 06:06 yogeshR5

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

viewsing avatar Jul 27 '18 03:07 viewsing

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

jean-noelp avatar Sep 05 '18 12:09 jean-noelp

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

matteocollina avatar Sep 05 '18 19:09 matteocollina

Getting this issue. Is there a working solution?

tmswartz12 avatar Nov 09 '18 21:11 tmswartz12

+1

sftgf avatar Nov 11 '18 14:11 sftgf

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

msand avatar Nov 11 '18 20:11 msand

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

vjsingh avatar Jan 04 '19 17:01 vjsingh

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

msand avatar Jan 06 '19 10:01 msand

@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.

vjsingh avatar Jan 07 '19 15:01 vjsingh

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

abduraufsherkulov avatar Feb 10 '19 12:02 abduraufsherkulov

@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.

msand avatar Feb 10 '19 12:02 msand

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.

https://github.com/vjsingh/react-native-svg-charts/commit/298f3718b147358a68f07a1104d657ab1540bf86

vjsingh avatar Feb 11 '19 15:02 vjsingh

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

msand avatar Feb 11 '19 16:02 msand

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/

msand avatar Feb 11 '19 16:02 msand