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

Calling onChange in one element when another element goes out of view #185

Open
joanacdias opened this issue May 14, 2021 · 0 comments
Open

Comments

@joanacdias
Copy link

There are some periods where more than one element is visible at the same time as you can partially see the first element whilst scrolling to the following element. When scrolling back up, the second element will not be visible any more as it scrolls away from the viewport, yet the first element will still be visible and the state is still true without calling the onChange function again.

I need to be able to call the onChange function again when this happens, so that when the second element goes out of view, I can update the state to then set the index of the first element into the component state again - the visible element index state will still be set to 1 here rather than 0 as the isVisible boolean of the first element hasn't changed.

Any idea on how to achieve this?

@joanacdias joanacdias changed the title Having only one element visible at a time Calling onChange in one element when another element goes out of view May 14, 2021
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

1 participant