Invariant Violation: View config not found for name (svg content)
See original GitHub issueMy app can’t render svg file because this error code.
this is error code.
error
Exception: Invariant Violation: View config not found for name <?xml version="1.0" encoding="UTF-8" standalone="no" ?><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 235.032 75.093" width="235.032" height="75.093"><path d="M8.828
I’m struggling with this issue for about a day.But I couldn’t reach solution…
could you help me?? Do you have any idea of the cause and resolution.
metro.config.js
const { getDefaultConfig } = require("metro-config");
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts }
} = await getDefaultConfig();
return {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false
}
}),
babelTransformerPath: require.resolve("react-native-svg-transformer")
},
resolver: {
assetExts: assetExts.filter(ext => ext !== "svg"),
sourceExts: [...sourceExts, "svg"]
}
};
})();
babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'babel-plugin-module-resolver',
{
root: ['./src'],
extensions: [
'.ios.ts',
'.android.ts',
'.ts',
'.ios.tsx',
'.android.tsx',
'.tsx',
'.jsx',
'.js',
'.json',
'.svg'
],
alias: {
'@navigations': './src/navigations',
'@models': './src/models',
'@reducks': './src/store/reducks',
'@screens': './src/screens',
'@apis': './src/apis',
'@utils': './src/utils',
'@plugins': './src/plugins',
'@assets': './src/assets',
},
},
],
[
"babel-plugin-inline-import",
{
"extensions": [".svg"]
}
]
],
};
the code
import Logo from '../assets/images/logo.svg';
<Logo width={50} height={50} />
I tried this code, the error not occured,but image was not rendered.
import {SvgXml} from 'react-native-svg';
<SvgXml xml={SvgXml} width={50} height={50} />
basic information
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-svg": "^12.0.3",
"react-native-svg-transformer": "^0.14.3",
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Invariant Violation: View config not found for name (svg ...
I have tried another way. Convert content of svg file to React Native Component via https://react-svgr.com/playground/?native=true&typescript= ...
Read more >react-native: Get error, invariant violation: View config not ...
Try linking React Native SVG manually. Add the following to 'android/settings.gradle'.
Read more >View config not found of RNSVGCircle-React Native
Coding example for the question react-native: Get error, invariant violation: View config not found of RNSVGCircle-React Native.
Read more >React Native: View config getter callback for component must ...
You're coding a React Native App and suddenly get an unexpected error: Invariant Violation: View config getter callback for component `div` must be...
Read more >Trouble with @types/react - Blog
The component creates a div element, but there is no such thing as a div in ... Invariant Violation: View config not found...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Yoshihide-Nishimoto the same to me? Have you solved the problem?
@Yoshihide-Nishimoto
This block is the reason for the problem. Remove it from babel and will be good. I had the same error and removing helped.