react-native-chart-kit icon indicating copy to clipboard operation
react-native-chart-kit copied to clipboard

`expo start --dev-client`: Invariant Violation: requireNativeComponent: "RNSVGRect" was not found in the UIManager

Open thiskevinwang opened this issue 3 years ago β€’ 5 comments

When running with

  • expo start β€” βœ… The basic sample LineChart renders fine
  • expo start --dev-client ❌ β€” The app crashes with ~42 errors like
    • Invariant Violation: requireNativeComponent: "RNSVGRect" was not found in the UIManager

    "expo": "~45.0.0",
    "react-native-chart-kit": "^6.12.0",

Note: I tried following the steps in these other issues, with no success

  • https://github.com/react-native-svg/react-native-svg/issues/749
  • https://github.com/react-native-svg/react-native-svg/issues/834

thiskevinwang avatar Jun 15 '22 03:06 thiskevinwang

Some additional logs

Invariant Violation: requireNativeComponent: "RNSVGRect" was not found in the UIManager.

This error is located at:
    in RNSVGRect (created by Rect)
    in Rect (created by LineChart)
    in RNSVGGroup (created by G)
    in G (created by Svg)
    in RNSVGSvgView (created by Svg)
    in Svg (created by LineChart)
    in RCTView (created by View)
    in View (created by LineChart)
    in LineChart (created by TabOneScreen)
    in RCTScrollContentView (created by ScrollView)
    in RCTScrollView (created by ScrollView)
    in ScrollView (created by ScrollView)
    in ScrollView
    in Unknown (created by AnimatedComponent)
    in AnimatedComponent
    in AnimatedComponentWrapper (created by TabOneScreen)
    in RCTSafeAreaView
    in SafeAreaView (created by TabOneScreen)
    in TabOneScreen (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)
    in SceneView (created by BottomTabView)
    in RCTView (created by View)
    in View (created by Screen)
    in RCTView (created by View)
    in View (created by Background)
    in Background (created by Screen)
    in Screen (created by BottomTabView)
    in RNSScreen (created by AnimatedComponent)
    in AnimatedComponent
    in AnimatedComponentWrapper (created by Screen)
    in MaybeFreeze (created by Screen)
    in Screen (created by MaybeScreen)
    in MaybeScreen (created by BottomTabView)
    in RNSScreenNavigationContainer (created by ScreenContainer)
    in ScreenContainer (created by MaybeScreenContainer)
    in MaybeScreenContainer (created by BottomTabView)
    in RCTView (created by View)
    in View (created by SafeAreaInsetsContext)
    in SafeAreaProviderCompat (created by BottomTabView)
    in BottomTabView (created by BottomTabNavigator)
    in Unknown (created by BottomTabNavigator)
    in BottomTabNavigator (created by BottomTabNavigator)
    in BottomTabNavigator (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)
    in SceneView (created by SceneView)
    in RCTView (created by View)
    in View (created by DebugContainer)
    in DebugContainer (created by MaybeNestedStack)
    in MaybeNestedStack (created by SceneView)
    in RNSScreen (created by AnimatedComponent)
    in AnimatedComponent
    in AnimatedComponentWrapper (created by Screen)
    in MaybeFreeze (created by Screen)
    in Screen (created by SceneView)
    in SceneView (created by NativeStackViewInner)
    in RNSScreenStack (created by ScreenStack)
    in ScreenStack (created by NativeStackViewInner)
    in NativeStackViewInner (created by NativeStackView)
    in RCTView (created by View)
    in View (created by SafeAreaInsetsContext)
    in SafeAreaProviderCompat (created by NativeStackView)
    in NativeStackView (created by NativeStackNavigator)
    in Unknown (created by NativeStackNavigator)
    in NativeStackNavigator (created by RootNavigator)
    in RootNavigator (created by Navigation)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by Navigation)
    in Navigation (created by App)
    in TailwindProvider (created by App)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by App)
    in RCTView (created by View)
    in View (at ActionSheet/index.ios.tsx:16)
    in ActionSheet (at ActionSheetProvider.tsx:35)
    in ActionSheetProvider (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent)
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:4 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/ReactFiberErrorDialog.js:52:4 in showErrorDialog
at node_modules/@react-navigation/native/src/useThenable.tsx:26:18 in resolve
[Unhandled promise rejection: Invariant Violation: requireNativeComponent: "RNSVGRect" was not found in the UIManager.]
at node_modules/react-native/Libraries/ReactNative/getNativeComponentAttributes.js:28:11 in getNativeComponentAttributes
at node_modules/react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js:116:25 in exports.get
at node_modules/@react-navigation/native/src/useThenable.tsx:26:18 in resolve

thiskevinwang avatar Jun 16 '22 03:06 thiskevinwang

Maybe safe to close, with action item to update the README

I eventually got around this by publishing a new dev-client build

  • eas build --profile development --platform ios

Would be nice to have some docs for this gotcha!

thiskevinwang avatar Jun 16 '22 22:06 thiskevinwang

I have the same problem as you. I have published a new dev-client build but I still have the error. Did you do something else?

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

This error is located at: in RNSVGPath (created by Path) in Path (created by PieChart) in RNSVGGroup (created by G) in G (created by PieChart) in RNSVGGroup (created by G) in G (created by PieChart) in RNSVGGroup (created by G) in G (created by Svg) in RNSVGSvgView (created by Svg) in Svg (created by PieChart) in RCTView (created by View) in View (created by PieChart) in PieChart (created by InvoiceReportScreen) in RCTView (created by View) in View (created by InvoiceReportScreen) in RCTView (created by View) in View (created by ScrollView) in RCTScrollView (created by ScrollView) in ScrollView (created by ScrollView) in ScrollView (created by InvoiceReportScreen) in RCTView (created by View) in View in SafeAreaView (created by InvoiceReportScreen) in InvoiceReportScreen (created by SceneView) in StaticContainer in EnsureSingleNavigator (created by SceneView) in SceneView (created by SceneView) in RCTView (created by View) in View (created by DebugContainer) in DebugContainer (created by MaybeNestedStack) in MaybeNestedStack (created by SceneView) in RNSScreen (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by Screen) in MaybeFreeze (created by Screen) in Screen (created by SceneView) in SceneView (created by NativeStackViewInner) in RNSScreenStack (created by ScreenStack) in ScreenStack (created by NativeStackViewInner) in NativeStackViewInner (created by NativeStackView) in RCTView (created by View) in View (created by SafeAreaInsetsContext) in SafeAreaProviderCompat (created by NativeStackView) in NativeStackView (created by NativeStackNavigator) in Unknown (created by NativeStackNavigator) in NativeStackNavigator (created by InvoiceNavigation) in InvoiceNavigation (created by SceneView) in StaticContainer in EnsureSingleNavigator (created by SceneView) in SceneView (created by BottomTabView) in RCTView (created by View) in View (created by Screen) in RCTView (created by View) in View (created by Background) in Background (created by Screen) in Screen (created by BottomTabView) in RNSScreen (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by Screen) in MaybeFreeze (created by Screen) in Screen (created by MaybeScreen) in MaybeScreen (created by BottomTabView) in RNSScreenContainer (created by ScreenContainer) in ScreenContainer (created by MaybeScreenContainer) in MaybeScreenContainer (created by BottomTabView) in RNCSafeAreaProvider (created by SafeAreaProvider) in SafeAreaProvider (created by SafeAreaInsetsContext) in SafeAreaProviderCompat (created by BottomTabView) in BottomTabView (created by BottomTabNavigator) in Unknown (created by BottomTabNavigator) in BottomTabNavigator (created by TabNavigation) in TabNavigation (created by Navigation) in EnsureSingleNavigator in BaseNavigationContainer in ThemeProvider in NavigationContainerInner (created by Navigation) in Navigation (created by App) in PortalProvider (created by BottomSheetModalProviderWrapper) in BottomSheetModalProviderWrapper (created by App) in ThemeProvider (created by Provider) in RCTView (created by View) in View (created by Portal.Host) in Portal.Host (created by Provider) in Provider (created by App) in Provider (created by App) in AuthProvider (created by App) in SearchProvider (created by App) in ModalProvider (created by App) in QueryClientProvider (created by App) in App (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer in main(RootComponent) at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:4 in reportException at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException at node_modules/react-native/Libraries/Core/ReactFiberErrorDialog.js:52:4 in showErrorDialog`

Brice31 avatar Jul 13 '22 21:07 Brice31

Maybe you have forgot to install 'react-native-svg' as mentioned in the document.

shamsKhokhar56 avatar Aug 18 '22 06:08 shamsKhokhar56

You can try uninstall your app from the emulator/device and try rebuild it again.

jyan212 avatar Sep 20 '22 04:09 jyan212

I am seeing the same error. We have a library that uses react-native-svg as a dependency. It's already installed as part of it. When we develop locally, there are no issues. When we build on EAS, the app crashes immediately. I added an ErrorBoundary and added the expo-dev-client package so we can debug locally from a compiled EAS build.

Local error logging:

ERROR getDerivedStateFromError [Invariant Violation: requireNativeComponent: "RNSVGPath" was not found in the UIManager.]

Error stack:

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

This error is located at:
    in RNSVGPath (created by Path)
    in Path (created by LogoIcon) <==== this is the SVG icon path being rendered
    in RNSVGGroup (created by G)
    in G (created by Svg)
    in RNSVGSvgView (created by Svg)
    in Svg (created by Icon)
    in RCTView (created by View)
    in View (created by Icon)
    in Icon (created by LogoIcon) <==== this is the SVG icon being rendered
    in FluidLogoIcon (created by NavigationContainer)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by NavigationContainer)
    in NavigationContainer (created by App)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by App)
    in SWRConfig$1 (created by SWRConfigWrapper)
    in SWRConfigWrapper (created by App)
    in ErrorBoundary (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent)

You can see it's trying to render the Splash Screen, which has the item above LogoIcon which comes from our library.

When I run yarn list to view deps, it looks like react-native-svg is correctly installed which came from the library, not installed as an actual dependency in our project:

[email protected]
β”‚  β”œβ”€ css-select@^4.2.1
β”‚  └─ css-tree@^1.0.0-alpha.39

For what it's worth, we tried adding react-native-svg as a dep to the project and it makes no difference.

lucksp avatar Oct 13 '22 21:10 lucksp

@lucksp are you running eas build --profile development --platform ios?

Did you try running expo prebuild --yarn before? (should update your ios & android dirs)

FWIW: my ./ios/Podfile.lock has several references to RNSVG

  - RNSVG (12.3.0):
    - React-Core
...
  - RNSVG (from `../node_modules/react-native-svg`)
...
  RNSVG:
    :path: "../node_modules/react-native-svg"
...
  RNSVG: 302bfc9905bd8122f08966dc2ce2d07b7b52b9f8

thiskevinwang avatar Oct 13 '22 22:10 thiskevinwang

thanks for quick reply @thiskevinwang

Did you try running expo prebuild --yarn before? (should update your ios & android dirs)

no, i will try that.

@lucksp are you running eas build --profile development --platform ios?

yes, i am running eas build --profile development --platform ios

FWIW: my ./ios/Podfile.lock has several references to RNSVG

I guess I will find out when I prebuild

EDIT:

I read through the docs and am not entirely sure why I need to prebuild...

lucksp avatar Oct 13 '22 22:10 lucksp

I'm running into this same issue building for Android. It works fine when running with expo start, but not with the dev client. I'm continuing to hunt down how to resolve the issue.

jonnycraze avatar Oct 17 '22 01:10 jonnycraze

I have the same error on Android only, I'm using expo. Here are my versions of react-native-svg and react-native-svg-charts: "react-native-svg": "^13.4.0", "react-native-svg-charts": "^5.4.0",

Has anybody found a solution ?

melissa07 avatar Dec 29 '22 20:12 melissa07

Same issue for me building for Android. Anybody able to resolve this?

GaWr26 avatar Jan 12 '23 13:01 GaWr26

Has anyone found a solution? Same issue for IOS.

rhenry7 avatar Jan 30 '23 05:01 rhenry7

the same problem on iOS and Android

GITupeer avatar Feb 01 '23 08:02 GITupeer

the same problem on Andoid

Hambob avatar Feb 04 '23 15:02 Hambob

I have the same error on Android only, I'm using expo. Here are my versions of react-native-svg and react-native-svg-charts: "react-native-svg": "^13.4.0", "react-native-svg-charts": "^5.4.0",

Has anybody found a solution ?

did u find a way to solve it??!

Hambob avatar Feb 04 '23 15:02 Hambob

It's been a long time since I've touched this, but has everyone/anyone tried the following commands?

  • prebuild
  • then build dev client
  • install the dev client
  • run local development
expo prebuild --yarn
eas build --profile development --platform ios

thiskevinwang avatar Feb 06 '23 19:02 thiskevinwang

I am facing the same issue building for android, Did anyone find a solution?

KrithikShailesh avatar Feb 14 '23 03:02 KrithikShailesh

@thiskevinwang - the steps you gave in

https://github.com/indiespirit/react-native-chart-kit/issues/614#issuecomment-1419656489

worked for me

bewallyt avatar Feb 16 '23 00:02 bewallyt

Closing this as the steps in https://github.com/indiespirit/react-native-chart-kit/issues/614#issuecomment-1419656489 were confirmed working by @bewallyt

thiskevinwang avatar Feb 16 '23 01:02 thiskevinwang

Deleting the development client on my android and creating a new one with eas build --profile development --platform android did the trick for me. I guess react-native-svg contains some native code API, probably why we need a new build after downloading it.

sleekLancelot avatar Jun 12 '23 18:06 sleekLancelot

expo prebuild did nothing but npx react-native run-ios solved issue for me

Revolt9k avatar Jul 27 '23 09:07 Revolt9k