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

Account for momentum when hiding minimal shell #3740

Merged
merged 4 commits into from
Apr 28, 2024
Merged

Account for momentum when hiding minimal shell #3740

merged 4 commits into from
Apr 28, 2024

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Apr 28, 2024

Several tweaks to how we toggle the minimal shell based on scroll for native apps:

  • If there is a velocity, don't snap scroll on drag end. Instead, wait for the momentum end.
  • When snapping, always hide the bar if we scrolled down. (Previously, it was snap to closest position.)
  • Bump the threshold for when we always show the shell at the top. (Avoids weird empty space at the top.)

No changes on web.

Why

This is easier to understand on video (before/after below).

This aims to resolve several interaction problems:

  • If you quickly flick the feed down, the bar would previously often snap back up — because it wouldn't take the velocity into account (so the calculation would think you haven't scrolled down "far enough"). With these changes, it will no longer snap "just" at the drag end, and instead will wait for the momentum events to settle. Note we're making an assumption that a non-zero velocity will be followed by momentum events.
  • If you move the feed just a little bit down and then release, it would previously snap back up — because we'd snap to the "closest" state, and if you only moved it a bit, the closest state is still "show the top bar". I'm changing this to always hide the bar on scroll down. (The only case in which you'd now ever see it "pop back up" during a drag down is at the very top of the feed where we don't want to show a blank space.)

Overall I think this makes it feels less obtrusive.

iOS

Before

snap_before_ios.mov

After

snap_after.mov

Android

Before

snap_before_android.mov

After

snap_after_android.mov

Copy link

render bot commented Apr 28, 2024

Copy link

github-actions bot commented Apr 28, 2024

Old size New size Diff
6.44 MB 6.44 MB -385 B (-0.01%)

Copy link
Member

@mozzius mozzius left a comment

Choose a reason for hiding this comment

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

Yeah, these feel good. Let's see how they feel in TF

@gaearon gaearon merged commit 1dd3d66 into main Apr 28, 2024
6 checks passed
@gaearon gaearon deleted the fix-momentum branch April 28, 2024 16:48
estrattonbailey added a commit that referenced this pull request Apr 28, 2024
* origin:
  Fix dropdown immediately closing on Enter (#3745)
  Account for momentum when hiding minimal shell (#3740)
  Reduce hovercard false positives, add them to display names and handles (#3739)
  YouTube Music as supported player (#3736)
  Patch lexicon for perf (#3733)
  ensure dialog is closed on unmount (#3650)
  remove precacheThreadPostProfiles (#3729)
  [Clipclops] New routes with placeholder screens (#3725)
  Special-case bsky.app/download to open share sheet or copy to clipboard (#3710)
  ver bump (#3731)
  Improve usability of search on web (#3663)
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