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

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

Closed
cipherwisdom opened this issue Mar 14, 2024 · 9 comments
Labels
Missing repro This issue need minimum repro scenario

Comments

@cipherwisdom
Copy link

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 EyeComponent)
in RNSVGGroup (created by G)
in G (created by Svg)
in RNSVGSvgViewAndroid (created by Svg)
in Svg (created by EyeComponent)
in RCTView (created by View)
in View (created by EyeComponent)
in EyeComponent (created by TextInputComponent)
in RCTView (created by View)
in View
in Unknown (created by TouchableOpacity)
in TouchableOpacity (created by TouchableOpacity)
in TouchableOpacity (created by TextInputComponent)
in RCTView (created by View)
in View (created by TextInputComponent)
in TextInputComponent (created by Login)
in RCTView (created by View)
in View (created by Login)
in RCTView (created by View)
in View (created by Login)
in Login (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 RCTView (created by View)
in View (created by SceneView)
in RNSScreen
in Unknown (created by InnerScreen)
in Suspender (created by Freeze)
in Suspense (created by Freeze)
in Freeze (created by DelayedFreeze)
in DelayedFreeze (created by InnerScreen)
in InnerScreen (created by Screen)
in Screen (created by SceneView)
in SceneView (created by NativeStackViewInner)
in Suspender (created by Freeze)
in Suspense (created by Freeze)
in Freeze (created by DelayedFreeze)
in DelayedFreeze (created by ScreenStack)
in RNSScreenStack (created by ScreenStack)
in ScreenStack (created by NativeStackViewInner)
in NativeStackViewInner (created by NativeStackView)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by SafeAreaProviderCompat)
in SafeAreaProviderCompat (created by NativeStackView)
in NativeStackView (created by NativeStackNavigator)
in PreventRemoveProvider (created by NavigationContent)
in NavigationContent
in Unknown (created by NativeStackNavigator)
in NativeStackNavigator (created by App)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by App)
in App
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in ratingstar(RootComponent), js engine: hermes

@awongCM
Copy link

awongCM commented Apr 25, 2024

This may help as it may be related - #2235 (comment)

@robvan2
Copy link

robvan2 commented Jun 2, 2024

I faced the same issue on android the APK install crashes when i access a screen where i used import { LocalSvg } from 'react-native-svg/css'; (react-native-svg v14 with expo) so i downgraded to 13.14.1 & updated the import back to import { LocalSvg } from 'react-native-svg'; and it is working fine rn.

component where i used LocalSvg:

import { styled } from 'nativewind';
import React from 'react';
import { StyleProp, Text, View, ViewStyle } from 'react-native';
import { LocalSvg } from 'react-native-svg';
import { icons } from '@/shared/icons';

export type CustomIconProps = {
    name: keyof typeof icons;
    size?: number;
    color?: string;
    style?: StyleProp<ViewStyle>;
};

const CustomIcon = ({ name, size = 24, color = 'black', style }: CustomIconProps) => {
        const icon = icons[name];
        
        if (!icon) {
            return (
                <View style={style}>
                    <Text>{name} not found</Text>
                </View>
            );
        }
        
        return (
            <LocalSvg
                width={size}
                height={size}
                asset={icon}
                fill={color}
                style={style}
            />
        );
    }

@bohdanprog
Copy link
Member

Hello @robvan2 @awongCM @cipherwisdom,
Can you update the react-native-svg?
I couldn't reproduce the issue.
Please share the example to reproduce the issue with us if you still have it.
Thank you.

@bohdanprog bohdanprog added Missing repro This issue need minimum repro scenario Close when stale This issue is going to be closed when there is no activity for a while labels Jun 13, 2024
@awongCM
Copy link

awongCM commented Jun 15, 2024

Hello @robvan2 @awongCM @cipherwisdom, Can you update the react-native-svg? I couldn't reproduce the issue. Please share the example to reproduce the issue with us if you still have it. Thank you.

@bohdanprog
I already mentioned the solution to this link page I posted earlier in this thread.

#2235 (comment)

I had to uplift to the latest react-native-sg version and it works fine for me.

@github-actions github-actions bot removed the Close when stale This issue is going to be closed when there is no activity for a while label Jun 15, 2024
@bohdanprog
Copy link
Member

Hello @robvan2 @awongCM @cipherwisdom, Can you update the react-native-svg? I couldn't reproduce the issue. Please share the example to reproduce the issue with us if you still have it. Thank you.

@bohdanprog I already mentioned the solution to this link page I posted earlier in this thread.

#2235 (comment)

I had to uplift to the latest react-native-sg version and it works fine for me.

Thanks.
Feel free to open a new issue if someone still has an issue connected with that.

@bravekingzhang
Copy link

"react-native": "0.74.5",
"react-native-svg": "15.2.0"

isok

@sgwanlee
Copy link

"react-native": "0.74.5", "react-native-svg": "15.2.0"

isok

You saved my day.
I downgraded from 15.7.0 to 15.2.0
it works.

@khaled2792000
Copy link

I have this Error Invariant Violation: requireNativeComponent: "RNSVGPath" was not found in the UIManager. with the same suggested versions for expo project :
"react-native": "0.74.5",
"react-native-gifted-charts": "^1.4.46",
"react-native-svg": "15.2.0",
Why still getting the error?

@liplylie
Copy link

liplylie commented Oct 23, 2024

Faced this issue with iOS and android.

There's an issue with autolinking, so I switched to manually adding the packages

Needed to follow old manual installation steps to fix this: https://www.npmjs.com/package/react-native-svg/v/11.0.0#manually

From my end, I noticed that RNSVG was not generated in the Podfile.lock, so I had to manually add the pod to the Podfile:

pod 'RNSVG', :path => '../node_modules/react-native-svg'

For android, I noticed the android package didn't generate. Needed to follow the old docs to install it manually (adding the package to settings.gradle, build.gradle, etc)

Append the following lines to android/settings.gradle:

include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
Insert the following lines inside the dependencies block in android/app/build.gradle:

implementation project(':react-native-svg')
Open up android/app/src/main/java/[...]/MainApplication.java

Add import com.horcrux.svg.SvgPackage; to the imports at the top of the file
Add new SvgPackage() to the list returned by the getPackages() method. Add a comma to the previous item if there's already something there.

Hope this helps others!

"react-native": "0.73.5",
"react-native-svg": "15.2.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario
Projects
None yet
Development

No branches or pull requests

8 participants