-
Notifications
You must be signed in to change notification settings - Fork 24
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: use user-provided onScroll #22
Conversation
Thanks for opening this PR! I will review this and add an example usage to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ythomop If you have a moment, I implemented the changes I cited earlier - feel free to review the changes. I have tested the implementation and it works.
Sorry, I made this PR in haste, without reason, without cross-checking this implementation with the one that I actually use in my project. The actual code that I use and works is the following: const scrollHandler = useAnimatedScrollHandler((event) => {
scrollY.value = event.contentOffset.y;
// user-provided onScroll of the type "(evt: NativeScrollEvent) => void;"
if (onScroll) runOnJS(onScroll)(event);
}); |
The code here is executing the onScroll method on the JS thread - I would prefer to stick with You made a good point earlier and I will adjust the implementation to remove the |
I think it's good to go! 😀 |
@ythomop It's merged and released under version 0.11.0 now. Thanks for the PR! |
Description
Runs the user-provided onScroll function after react-native-header's scrollHandler
Motivation and Context
Issue
Types of changes
Checklist: