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

When setting scrollable, keep isScrollableLocked value if scrollable is scrolling #16

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

lsdimagine
Copy link
Collaborator

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

I added isScrollEnded in bottom sheet internal state. So when setting scrollable, we can keep isScrollableLocked if scrollable is still scrolling. It's possible that scrollable is updated when it's being scrolled, in this case we shouldn't interrupt the lockable state.

@@ -19,6 +19,7 @@ export const useScrollable = () => {
);
const isScrollableRefreshable = useSharedValue<boolean>(false);
const isScrollableLocked = useSharedValue<boolean>(true);
const isScrollEnded = useSharedValue<boolean>(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR, isScrollEnded was initialized to false, but now it's initialized to true. It seems to make more sense as true, but I'm worried that might cause some issues with the existing code unrelated to the isScrollableLocked logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's only used in scroll handlers and being set on drag begins, so I think the initial value doesn't really matter here https://github.com/discord/react-native-bottom-sheet/blob/discord-fork-4.5.1/src/hooks/useScrollEventsHandlersDefault.ts#L106

@lsdimagine lsdimagine merged commit d734394 into discord-fork-4.5.1 Feb 5, 2024
@yayvery yayvery deleted the lsdimagine/handle_scrollable_update branch February 24, 2024 19:14
yayvery pushed a commit that referenced this pull request Feb 24, 2024
yayvery pushed a commit that referenced this pull request Mar 13, 2024
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.

2 participants