Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react 18 support #380

Open
nitz-iron opened this issue Apr 11, 2022 · 17 comments
Open

react 18 support #380

nitz-iron opened this issue Apr 11, 2022 · 17 comments

Comments

@nitz-iron
Copy link

title

@Karol-Waliszewski
Copy link

+1

@timothymalcham
Copy link

Npm install breaks because of this (I'm using React 18 in my project):

➜ npm install --save react-lazyload
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project-name@undefined
npm ERR! Found: [email protected]
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@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-lazyload
npm ERR!   react-lazyload@"*" 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.

@mengbo-ji
Copy link

+1

1 similar comment
@Vinh911
Copy link

Vinh911 commented Jun 17, 2022

+1

@NickEast12
Copy link

+1

@prmichaelsen
Copy link
Contributor

i created my own repo by cloning the package into a local dir

// dir structure:
~/workspace/react-lazyload
~/workspace/my-project

then, i update the ~/workspace/react-lazyload/package.json

i simply add react 18 to the accepted peer dependencies and it works fine.

after updating package.json, run: cd ~/workspace/react-lazyload; npm i

i messed with npm link but i don't think i got it working.

instead i did cd ~/workspace/my-project; npm i ../react-lazyload

i removed eslint dev dependencies since they break the build and they don't really matter to my production app. it's probably not hard to fix the version conflicts but i don't care enough to do it since hard linking the package fulfills my usecase, at the moment.

here is the full diff below:

--- a/package.json
+++ b/package.json
@@ -36,11 +36,6 @@
     "babel-preset-stage-0": "^6.22.0",
     "chai": "^3.5.0",
     "chai-spies": "^0.7.1",
-    "eslint": "^4.18.2",
-    "eslint-config-airbnb": "^14.1.0",
-    "eslint-plugin-import": "^2.2.0",
-    "eslint-plugin-jsx-a11y": "^4.0.0",
-    "eslint-plugin-react": "^6.10.0",
     "istanbul": "~0.4.5",
     "istanbul-instrumenter-loader": "^0.2.0",
     "karma": "^0.13.22",
@@ -64,7 +59,7 @@
     "webpack-dev-server": "~1.10.1"
   },
   "peerDependencies": {
-    "react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
-    "react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
+    "react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
+    "react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
   }
 }

dear maintainers, please fix this if you can

prmichaelsen added a commit to prmichaelsen/react-lazyload that referenced this issue Jul 24, 2022
this just bumps the peer deps and then it works

npm i fails because of eslint packages. i removed them because id rather have a working production build than eslint tools.
@leaderhun
Copy link

+1

@plamber
Copy link

plamber commented Sep 11, 2022

Hello @ameerthehacker,
first of all. Thank you for your help in this project. Do you think you will consider the PR of @prmichaelsen to have REACT 18 support?

Thank you for your feedback,
Patrick

@dmoKruso
Copy link

+1

@prijithvrgs90
Copy link

Hi @ameerthehacker

I tried to use the react-lazyload in my web app, it works on web (Safari, Chrome, Mozilla) and tab (iPad) view. But when I checked in the mobile responsive view only my first two cards were loaded. The rest of the cards are shown as blank.

Here I added the screenshots for your ref.

Screenshot 2022-10-16 at 11 21 04 PM

Issue

"react": "^17.0.0",
"react-lazyload": "^3.2.0",

Thanks for your attention. I’m looking forward to your reply

Rgrds,
Prijith

@BearCooder
Copy link

There is a fork that works with React 18, the link is here: #387

@keisukekomeda
Copy link

One acceptable workaround here.

package.json

{
  "resolutions": {
    "@types/react": "^18.0.0"
  }
}

@types/react-lazyload.d.ts

import "react-lazyload";

declare module "react-lazyload" {
  type children = React.ReactNode;
}

@TakagiSadaaki
Copy link

Hi @ameerthehacker @twobin

Would it be possible to publish #387 update on NPM?

Let me know if there's anything I can do to help.

@BearCooder
Copy link

Yeah its merged but not on npm available @ameerthehacker

@dertel
Copy link

dertel commented Nov 25, 2022

This temporary workaround solved it for me — loading the package directly from the master branch in package.json:

-    "react-lazyload": "^3.2.0",
+    "react-lazyload": "github:twobin/react-lazyload",

@remy727
Copy link

remy727 commented Nov 21, 2023

Any update on this?

@gurjit03
Copy link
Contributor

gurjit03 commented May 1, 2024

@remy727 it should be resolved now. Let us know if you still face any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests