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(scrolling): monitor scroll position #1009

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hgray-instawork
Copy link
Collaborator

@hgray-instawork hgray-instawork commented Dec 19, 2024

Create a context which allows tracking the scroll position of child views and lists. Each scrollable component (view, list, section list, href) is wrapped as a context consumer and passes its scroll position up to the context. Any component which implement a provider can be notified of scroll position updates.

Data is cached by the id of the scrolling component. If no id is present, data is not logged.

Example observer:

<ScrollObserver.Context.Consumer>
  {context => (
    < ... content with view >
    <Text>{`context.offsets['view-id]`}</Text>
  )}
</ScrollObserver.Context.Consumer>

Based on work done by @flochtililoch in master...florent/scroll-context, this


@hgray-instawork hgray-instawork force-pushed the hardin/scroll-observer branch 3 times, most recently from ff7d769 to 2c6b98e Compare January 22, 2025 17:58
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