kristerkari / react-native-svg-transformer

Import SVG files in your React Native project the same way that you would in a Web application.
MIT License
1.61k stars 116 forks source link

Unable to resolve module #355

Open rodrigodiasf1984 opened 6 months ago

rodrigodiasf1984 commented 6 months ago

Hi , i'm working with the react-native 0.74.1 and i've followed de documentation to install this package:

image

How can i fix it? Thanks

rodrigodiasf1984 commented 6 months ago

i've opened an new question on the stackOverflow as well: https://stackoverflow.com/questions/78458785/react-native-v0-74-1-unable-to-resolve-module-when-importing-svg

kristerkari commented 6 months ago

I just updated the demo app (https://github.com/kristerkari/react-native-svg-example) to 0.74.1, and it is working.

I'm not sure about your problem, but a very common problem with configuring this library is that people don't restart the Metro packager after changing the Metro config.

baryon commented 6 months ago

same issue, but I found there is not the svg file really. fixed path and soloved

rodrigodiasf1984 commented 6 months ago

I just updated the demo app (https://github.com/kristerkari/react-native-svg-example) to 0.74.1, and it is working.

I'm not sure about your problem, but a very common problem with configuring this library is that people don't restart the Metro packager after changing the Metro config.

Thanks for your help I've used to close the metro after installing a library when I got an error and also yarn --reset-cache. I've looked at your example and I noticed something different, by default the new version of react-native adds this to the extends at the tsconfig.json(by the away your example uses webpack and I couldn't compare the tsconfig.json)

"extends": "@react-native/typescript-config/tsconfig.json",

So I was digging into my other projects and I replaced this extends with the old extends in previous versions of react-native, and the error is gone and I'm able to import the SVG file write now. I'm not sure if this is the best solution.

image

kingajohanna commented 5 months ago

@rodrigodiasf1984 Did you install react-native-svg as well? I had the same issue, and adding it solved the error.

rodrigodiasf1984 commented 5 months ago

@rodrigodiasf1984 Did you install react-native-svg as well? I had the same issue, and adding it solved the error.

yes i did, i've "react-native-svg": "^15.2.0" installed

khanhkom commented 1 month ago

Same problem after install sentry