-
Notifications
You must be signed in to change notification settings - Fork 48.8k
Add ScrollTimeline Polyfill for Swipe Recognizer using a new CustomTimeline protocol #33501
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
base: main
Are you sure you want to change the base?
Conversation
811e00b
to
a24876c
Compare
Comparing: a947eba...e4bb93c Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
This is also how you'd implement other gestures that can't be modeled as scroll. Such as rotate and zoom gestures. |
@@ -5,6 +5,8 @@ import React, { | |||
unstable_startGestureTransition as startGestureTransition, | |||
} from 'react'; | |||
|
|||
import ScrollTimelinePolyfill from 'animation-timelines/scroll-timeline'; |
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.
I published this as a third party package instead since it's generally useful and I can put more complex ones there.
45ca295
to
761229f
Compare
This basically lets a custom implementation drive the Animation we start on pseudo-elements.
761229f
to
e4bb93c
Compare
The React API is just that we now accept this protocol as an alternative to a native
AnimationTimeline
to be passed tostartGestureTransition
. This is specifically the DOM version.Instead, of passing this to the
Animation
that we start to control the View Transition keyframes, we instead inverse the control and pass theAnimation
to this one. It lets any custom implementation drive the updates. It can do so by updating the time every frame or letting it run a time based animation (such as momentum scroll).In this case I added a basic polyfill for
ScrollTimeline
in the example but we'll need a better one.