ios - 不变违规 : Native component for "RNSVGSvgView" does not exist

标签 ios svg react-native react-native-ios

经过几天在互联网上的研究,我仍然没有解决我的问题。 我正在使用 react-native-svg 并且遇到了同样的问题: No component found for view with the name "RNSVGPath"

或者这个: Invariant Violation: Native component for "RNSVGSvgView" does not exist

我尝试了很多东西,包括:

react-native unlink react-native-svg
npm uninstall react-native-svg
npm install react-native-svg
react-native link react-native-svg
react-native run-ios

还有:

pod 'RNSVG', :path => '../node_modules/react-native-svg'
rm -rf node_modules
npm install
react-native run-ios

但是还是没有... 这是我使用的版本:

"dependencies": {
    "react": "16.1.1",
    "react-native": "0.50.3",
    "react-native-svg": "^6.0.1-rc.1"
}

我尝试直接从 XCode 构建它,但仍然没有...

谢谢你们的帮助!

最佳答案

你应该尝试这样做:

npm install react-native-svg --save //(again)
react-native link react-native-svg //(again)
watchman watch-del-all
rm -rf node_modules/ && yarn cache clean && yarn install

然后在另一个终端

npm start -- --reset-cache

在使用 react-native run-ios 启动 ios 应用程序之前,您必须手动将 libRNSVG.a 添加到 Xcode 中的链接框架和库

然后……多田

关于ios - 不变违规 : Native component for "RNSVGSvgView" does not exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47672941/

相关文章:

iphone - iOS 共享对话框?

ios - popViewController 抛出 "deallocated while key value observers were still registered"错误

javascript - 如何将矩阵信息转换为简单的 x 和 y 坐标

javascript - 如何将 svg 放在 div 中

javascript - React Native -cameraRoll.saveToCameraRoll 没有保存我的视频

react-native - 我可以使用 react native 来构建带有 Django rest api 的移动应用程序吗?

javascript - react native ,断断续续的独立并行动画?

ios - 如何将类型从 OpaquePointer 更改为我的数据模型变量?

javascript - 如何对齐基于 DOM 居中 div 的 SVG 网格

node.js - react native : Warnings on npm install <library>