3

I am new in react native. After install new library of react-native-svg-from-uri. and used in my component like

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

when running my app it shows error

Unable to resolve "./patternReg" from "node_modules\react-native-svg\lib\extract\extractProps.js.

now how to solve this problem? Thanks in advance.

Abul Hasan
  • 53
  • 10
  • I just installed react-native-svg to use the Victory charting package and am getting the same error. – Fiid Jan 24 '19 at 18:03

3 Answers3

3

I solve this runing this command:

npm i react-native-svg@^5.4.0
2

If you created your App with create-react-native-app, then it was created with Expo, which already includes react-native-svg.

Try removing react-native-svg to avoid duplicate/mismatched dependencies.

cbeninati
  • 61
  • 4
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.

  • Yes I have installed react-native-svg but when I run react-native link react-native-svg it shows this error "react-native : The term 'react-native' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + react-native link react-native-svg + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (react-native:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException" – Abul Hasan Jan 16 '19 at 13:48
  • is react-native properly installed and all other environment properly setup? look into this https://stackoverflow.com/questions/38889487/react-native-is-not-recognized-as-an-internal-or-external-command-operable-pr – Ravi Shankar Jan 16 '19 at 13:55
  • Yes I have installed properly – Abul Hasan Jan 22 '19 at 09:48
  • can you show me the imports from extractProps.js file It can be found here -> (YOUR_POJECT)/node_modules/react-native-svg/lib/extract/extractProps.js. And also check for the './patternReg' there, as I cannot find it in my extractProps.js file. – Ravi Shankar Jan 23 '19 at 05:08
  • @RaviShankar here ```import extractFill from "./extractFill"; import extractStroke from "./extractStroke"; import extractTransform, { props2transform } from "./extractTransform"; import extractClipPath from "./extractClipPath"; import extractResponder from "./extractResponder"; import extractOpacity from "./extractOpacity"; import { idPattern } from "../util"; ``` There's no direct mention of the `./patternReg` in that directory at all. – Fiid Jan 24 '19 at 18:01
  • can i have a look at your project @Fiid ? – Ravi Shankar Jan 26 '19 at 07:17