3

我是反应原生的新手。安装新的 react-native-svg-from-uri 库后。并在我的组件中使用

import SvgUri from 'react-native-svg-uri';
<SvgUri width="200" height="200" source={require("./img/homer.svg")} />

运行我的应用程序时显示错误

无法从“node_modules\react-native-svg\lib\extract\extractProps.js”解析“./patternReg”。

现在如何解决这个问题?提前致谢。

4

3 回答 3

3

我解决了这个运行这个命令:

npm i react-native-svg@^5.4.0
于 2019-01-29T14:32:41.763 回答
2

如果您create-react-native-app使用react-native-svg.

尝试删除react-native-svg以避免重复/不匹配的依赖项。

于 2019-01-29T17:18:51.657 回答
1

Have you installed react-native-svg, looks like the library you are using require another module react-native-svg, try installing it and also link react-native-svg.

try following steps.

1> npm i react-native-svg

2> react-native link react-native-svg

3> npm install react-native-svg-uri --save

4> re-run the project

Note: Make sure you have linked project correctly.

于 2019-01-16T13:34:01.263 回答