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

Pull animated scroll handler down from pager #1827

Merged
merged 1 commit into from
Nov 7, 2023
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Nov 7, 2023

This works around software-mansion/react-native-reanimated#5345.

We don't currently have a codepath surfacing this bug, but if I try to port Profile to use the new pager, the last tab loses its scroll events. I don't know why. The "fix" is to avoid reusing the same "animated scroll handler" between the pages.

Initially I tried to pull it all the way down to the flat lists. But this change ended up affecting everything in between and turned into a mess. So this is a more scoped fix that "wraps" onScroll into a handler as soon as we have a notion of a page.

Types should help us distinguish the two events. (I considered naming it onScrollWorklet but that didn't seem worth it.)

Review without indentation changes

Test Plan

Checked all lists using the new pager on all platforms.

@gaearon gaearon requested a review from pfrazee November 7, 2023 05:13
@@ -345,17 +351,14 @@ export const ProfileFeedScreenInner = observer(
/>
)}
{({onScroll, headerHeight}) => (
<ScrollView
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved the scroll view inside.

scrollEventThrottle={1}
contentContainerStyle={{paddingTop: headerHeight}}
onScroll={scrollHandler}>
<View
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The rest is indentation changes.

Copy link
Collaborator

@pfrazee pfrazee left a comment

Choose a reason for hiding this comment

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

Good deal. Small chore but probably the best solution

@pfrazee pfrazee merged commit 7b2a7db into main Nov 7, 2023
4 checks passed
@pfrazee pfrazee deleted the pull-scroll-handler-down branch November 7, 2023 16:46
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