Can't set isIntersecting to true when testing #594
Unanswered
danielbeckera
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Have you checked if |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a page on nextJS called development-details.tsx, this page renders a component called GalleryDevelopmentDetails.
On development-details.tsx I use the useInView hook, like this:
I pass the ref through GalleryDevelopmentDetails props, just like this:
And inside GalleryDevelopmentDetails I put that ref inside a section html tag.
Back to development-details.tsx, I have a useEffect that, when inView is updated and its true, it sets a state to true and then opens up a modal.
The functionality is working, as soon as viewport hits almost bottom line of the element with ref, it sets the state and it opens up a modal.
The thing is that I'm trying to test it but I can't find any success.
Here is my test:
I've tried without waitFor, with await findbytext etc, nothing seems to open up the modal that is set up to open when inView equals to true.
Beta Was this translation helpful? Give feedback.
All reactions