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

feat: allow scrollable events #1019

Merged
merged 2 commits into from
Jul 4, 2022
Merged

Conversation

gorhom
Copy link
Owner

@gorhom gorhom commented Jul 4, 2022

Motivation

This PR will allow users to use onScroll, onScrollBeginDrag & onScrollEndDrag events on the scrollable components.

^ events should run on JS thread, no support for worklets, yet.

@gorhom gorhom added the v4 Written in Reanimated v2 label Jul 4, 2022
@gorhom gorhom merged commit 2be6498 into master Jul 4, 2022
@gorhom gorhom deleted the feature/allow-scrollable-events branch July 4, 2022 21:31
@MichaelDanielTom
Copy link

@gorhom Is there any reason not to also include the same type of logic for onMomentumScrollBegin and onMomentumScrollEnd? If not, happy to put up a quick pr for that.

Separately, what are your thoughts on including parallel config for allowing worklets like onScrollWorklet, onScrollBeginDrag, etc.? It's not perfect but possibly better than trying to detect if a passed onScroll function is a worklet or anything like that. Right now I've been modifying the handlers in useScrollHandler (via patch-package) to allow for worklets, but that's pretty messy too.

@MichaelDanielTom
Copy link

Kinda related, but it also looks like onScrollEndDrag might be called twice in the case when you also have momentum when lifting your finger on a drag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v4 Written in Reanimated v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants