DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.1k stars 1.48k forks source link

Support for RN 0.69.x #915

Closed nibblesnbits closed 1 year ago

nibblesnbits commented 1 year ago

Describe the bug I can't use this module after upgrading to React 18 (RN 0.69.x) because it specifies a dependency on react@"^16.8.6 || ^17.0.0"

To Reproduce

  1. Create a new RN 0.69 project
  2. Run npm i react-native-fast-image
  3. Get the following error:
❯ npm i react-native-fast-image
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: myapp@0.0.1
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR!   react@"18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.6 || ^17.0.0" from react-native-fast-image@8.5.11
npm ERR! node_modules/react-native-fast-image
npm ERR!   react-native-fast-image@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Expected behavior Installation should succeed.

Dependency versions

If I force this resolution, are there any known issues?

rvisuvasam commented 1 year ago

I forced this resolution, and I've not noticed any ill effects just yet -- seems to work just fine. For anyone else using Expo/EAS, I used a .npmrc file in the root of my project to force the installation:

force=true
dezudas commented 1 year ago

I tried it using yarn and it working for me

nibblesnbits commented 1 year ago

I forced this resolution, and I've not noticed any ill effects just yet -- seems to work just fine. For anyone else using Expo/EAS, I used a .npmrc file in the root of my project to force the installation:

force=true

It's worth noting, that this approach is global and may cause issues with other packages.

nibblesnbits commented 1 year ago

Update: it looks like #918 is working towards this.

KilianB commented 1 year ago

I can confirm that forcing react 18 is working without any apparent issues at the moment. With yarn you can set the resolution in your package.json

"resolutions": {
    "react": "18.2.0",
    "@types/react": "~18.0.17",
    "@types/react-native": "~0.69.5"
  }

alternatively only force the fast image version to match, but I like to have only a single version in my project.

DylanVann commented 1 year ago

I've updated the peer dependency. Thank you for the report!