react-native-svg not working with react native web #2204
Unanswered
Prashant-Mobile-Server
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Getting error when trying to load svg image from a local directory. It is working fine on mobile but has below issue when I try to run for web.
Uncaught runtime errors:
×
ERROR
The string contains invalid characters.
createElement@[native code]
createElement@
createInstance@
completeWork@
completeUnitOfWork@
performUnitOfWork@
workLoopSync@
renderRootSync@
recoverFromConcurrentError@
performConcurrentWorkOnRoot@
workLoop@
flushWork@
performWorkUntilDeadline@
### Made below changes to support on mobile:
custom.d.ts:
declare module '*.svg' { const content: React.FunctionComponent<React.SVGAttributes<SVGElement>>; export default content; }
tsconfig.json:
{
"compilerOptions": {
"jsx": "react"
},
"extends": "@tsconfig/react-native/tsconfig.json",
"include": ["/*.ts", "/*.tsx", "custom.d.ts"]
}
Beta Was this translation helpful? Give feedback.
All reactions