gluestack-ui: Invariant Violation: Tried to register two views with the same name RNSVGSvgView
Description
Using GluestackUI in a clean new projekt with Expo SDK 49 causes a rendering issue when implementing the provider
CodeSandbox/Snack link
https://github.com/AllBitsEqual/Prototyping/tree/gluestack/gluestack
Steps to reproduce
either follow the link above for my demo repo with a clean new project or complete the following steps:
- create new expo project:
npx create-expo-app@latest --template expo-template-blank-typescript@sdk-49 - install missing packages, pick name, cd into project
- install expo router requirements
yarn expo install expo-router react-native-safe-area-context react-native-screens expo-linking expo-constants expo-status-bar react-native-gesture-handler - (optional) install requirements for web
yarn expo install react-native-web@~0.19.6 react-dom@18.2.0 - follow other changes from https://docs.expo.dev/routing/installation/ (change package.json, app.json and babel.config.js as described)
- install gluestack UI
npx gluestack-ui@latest - start project and run it in your emulator (web doesn’t seem to be affected)
- make a page (optional with a base _layout.tsx) and implement the provider
<GluestackUIProvider config={config.theme}> - update the app in your emulator and the error should occur
gluestack-ui Version
latest
Platform
- Android
- Expo
- iOS
- Next
Other Platform
No response
Additional Information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 24 (3 by maintainers)
a temporary fix is to downgrade
react-native-svgto13.4.0When I downgrade
react-native-svgto13.4.0, I get another error:Invariant Violation: requireNativeComponent: "RNSVGSvgView" was not found in the UIManager.Has anyone found a solution that doesn’t lead you right back toTried to register two views with the same name RNSVGSvgView? This is only happening on Android for me.@Viraj-10 nice! Thanks for responding so quickly.
Hey @njt1982, you are right it should have been linked to some other issue. I have created #995 for that. We will post updates there.
Hey @bvisserbb, Thanks for pointing out it has been updated now.
Hey @bvisserbb, This issue is different. It is comes under critical issue since this crashes your app. Moving from locking version doesn’t come under this. I have reported this internally and we have it in our roadmap. Sorry I didn’t create a issue on github which points the same. #995 here I have created a issue.
@Viraj-10 this lock to 13.4.0 is the issue being reported here. Why close this ticket when this issue isn’t resolved? Are you able to link to another issue that is tracking the removal of the 13.4.0 lock?
At least update the documentation for themed to say it won’t work if you have a different version of react-native-svg?
Unfortunately, it didn’t work for me. I cleared package-lock.json as well. No luck.
Kudos to @surajahmed for this, I only spread their genious quick fix solution for others.
This fixed it for me. Thanks @AllBitsEqual!