"Invariant Violation: requireNativeComponent: "RNSVGSvgView" was not found in the UIManager"
"Invariant Violation: Native component for "RNSVGSvgView" does not exist"
Error: Invariant Violation: requireNativeComponent: 'RNSVGSvgView' was not found in the UIManager
Solution:
- Ensure that you have properly installed and linked the required dependencies for SVG support in your React Native project.
- Check if you have installed the 'react-native-svg' package correctly using npm or yarn.
- Make sure you have followed the platform-specific installation instructions for iOS and Android provided in the 'react-native-svg' documentation.
- Verify that you have linked the 'react-native-svg' library using the appropriate linking method for your React Native version.
- Ensure that you have imported and used the SVG components from 'react-native-svg' in your code.
- If you're using a library or component that relies on 'RNSVGSvgView', ensure that it is compatible with your React Native and 'react-native-svg' versions.
- Check for any conflicting dependencies or outdated versions that might cause compatibility issues.
- Try cleaning the build cache and rebuilding your project to see if the error persists.
Example:
import React from 'react';
import { View, StyleSheet } from 'react-native';
import Svg, { Circle, Rect } from 'react-native-svg';
const SvgExample = () => {
return (
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
export default SvgExample;
Try to do this:
- Run
npm install react-native-svg --save
again - Link react-native-svg again by running
react-native link react-native-svg
- Remove all watches by running
watchman watch-del-all
- Remove the node_modules directory, clean yarn cache, and reinstall dependencies:
rm -rf node_modules/ && yarn cache clean && yarn install
Then, in another terminal:
npm start -- --reset-cache
Before starting your iOS app with react-native run-ios
, you have to manually add libRNSVG.a
to your Linked Frameworks and Libraries in Xcode.
I solved the issue by using 'npx expo install react-native-svg' instead of 'npm i react-native-svg'.
Now, 'react-native-wagmi-charts' works properly, but '@rainbow-me/animated-charts' shows another error.
Read Similar Articles
- [Solved]-"java.lang.illegalstateexception: error processing condition on org.springframework.boot.autoconfigure.context.propertyplaceholderautoconfiguration.propertysourcesplaceholderconfigurer"
- Simple Way To Insert ,Update and Delete in Gridview-Asp.Net
- Create ASP.NET Core Web API Without Entity Framework
- Solved: "expected class 'openpyxl.styles.fills.Fill'" in Python