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

fix: handle unnecessary invocation of handleSnapToIndex on onAnimate … #2073

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IslamRustamov
Copy link

@IslamRustamov IslamRustamov commented Dec 7, 2024

…recreation

Please provide enough information so that others can review your pull request:

I create a ref which stores previous passed initial index and if useEffect is invoked again it checks whether the new _providedIndex actually does not equal to the old _providedIndex

Motivation

Explain the motivation for making this change. What existing problem does the pull request solve?

#2043
When we pass a prop onAnimate to BottomSheet we will encounter a bug, where onAnimate's function recreation will cause a chain of dependency changes (onAnimate -> _providedOnAnimate -> handleOnAnimate -> animateToPosition -> handleSnapToIndex -> useEffect) which will cause our BottomSheet to snap back to the initial index (which is a wrong behaviour).

Copy link

github-actions bot commented Jan 7, 2025

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@IslamRustamov
Copy link
Author

bump

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

Successfully merging this pull request may close these issues.

1 participant