walletconnect-monorepo: Invariant Violation: Tried to register two views with the same name RNSVGRect with expo
Hi, when using @walletconnect/react-native-dapp with expo, the following error occurs:
Invariant Violation: Tried to register two views with the same name RNSVGRect
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
I think the problem is that @walletconnect/react-native-dapp is used a very old version of react-native-svg. I tried to solve it like here https://stackoverflow.com/questions/54543324/react-native-svg-error-tried-to-register-two-views-with-the-same-name-rnsvgre but it didn’t work.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 21
Below changes in package.json works for me.
@sssemil Thanks for confirming.
Can you please try heading into your
node_modulesdirectory and going inside of@walletconnect/react-native-dapp/node_modules. Here, try to deletereact-native-svgand refresh your app to see if your problem is fixed.If this works, you will probably need to automate this step as a part of
postinstallin yourpackage.jsonuntil we can publish a PR that marksreact-native-svgas adevDependency.i.e something like
Overriding the package with npm v8.3+ worked for me 👍
If you have
yarnyou can useresolutionssection in package.json to override specific package, but in case ofnpmyou can do similar stuff as written below, but you need to have npm in version >=8.3 https://stackoverflow.com/a/70396201This is still an issue.
Not using expo.
This is still an issue:
what do you mean by watch out…?
Downgrade react-native-svg to 9.6.4 solves the problem. Reference: https://github.com/cawfree/create-react-native-dapp/commit/9b2f6b7b9f713006057e606fd11846c2f5a3551d
Why is not possible to fix it? react-native-dapp is not open source anymore?
When I try
rm -rf node_modules/@walletconnect/react-native-dapp/node_modules/react-native-svgI have another error:TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[17], "./NativeComponents").RNSVGSvg')