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

Scroll element is null #82

Open
dymarchyk opened this issue Nov 11, 2022 · 11 comments
Open

Scroll element is null #82

dymarchyk opened this issue Nov 11, 2022 · 11 comments

Comments

@dymarchyk
Copy link

Have a message that Missing required elements: {scrollEl: null, holderEl: div, wrapperEl: div}

Upgrade react to 18 and using nextjs.
Problem noticed on nextjs 12 and 13 version.

Try different scrollElement props: window, body or selector. No changes.
Try to use dynamic import on client side - also no result.

Has anyone same issue?

@martzoukos
Copy link

Same here, it suddenly started showing up and I noticed it just today.
I'm using next.js v13 and react v.18.2

@dangquanghuy
Copy link

dangquanghuy commented Dec 20, 2022

the problem is with: React Strict Mode
https://reactjs.org/docs/strict-mode.html.
Please turn off or remove <React.StrictMode></React.StrictMode> in your code.

@dangquanghuy
Copy link

dangquanghuy commented Dec 20, 2022

can be fixed:

    componentDidUpdate({ scrollElement, boundaryElement, disabled }: RenderProps) {
  
      if (scrollElement !== this.props.scrollElement || this.scrollEl === null) {
        this.updateScrollEl();
      }
  
      if (boundaryElement !== this.props.boundaryElement) {
        this.updateBoundaryEl();
      }
  
      if (disabled !== this.props.disabled) {
        this.disabled = this.props.disabled;
        this.checkPosition();
      }
  
    }

@c7nj7n
Copy link

c7nj7n commented Feb 9, 2023

I have the same issue with Next 13.1 and React 18.2, looks like the plugin (which did a great job so far) is aging and requires a lifting.
How could I fix this with Hooks @dangquanghuy ?

@dangquanghuy
Copy link

@c7nj7n: turn off StrictMode

@c7nj7n
Copy link

c7nj7n commented Mar 14, 2023

Thank you for your response @dangquanghuy ! If I understand correctly, strict mode is only active on the dev environment in Next.js, hence there should not be an issue on production?

@dangquanghuy
Copy link

@c7nj7n : you're welcome. Yes only issue with dev.

@FedeMadoery
Copy link

Hey guys! Is there any chance this is fixed on a PR with the provided code? I would love to keep using StrictMode on Nextjs

@1finedev
Copy link

+1

2 similar comments
@deback
Copy link

deback commented Oct 11, 2024

+1

@joelthorner
Copy link

+1

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

8 participants