Skip to content

Conversation

@LorenzoBloedow
Copy link

@LorenzoBloedow LorenzoBloedow commented Dec 9, 2025

Summary:

When using inverted in a component that uses UIKit's ScrollView under the hood and tapping the status bar (scroll-to-top gesture), instead of scrolling to the top, we end up going to the bottom because of the -1 transform invert.

I think this fix has 1 (likely inevitable) bug that seems to be unfixable without upstream changes on iOS or a hacky workaround. It won't trigger the scroll when at y = 0 (the absolute bottom), it thinks we are at the top of the list because of the -1 transform, thus it doesn't scroll:

image

You can see this behavior here (this is from my branch), notice that the gesture only works when I scroll up a bit:

invert-scroll.mov

I'm opening this PR because of an issue in another repo (Expensify) I'm working on, there, I came to the conclusion that we had two options for working around this:

  1. Workaround this by limiting the minimum scroll rest point to y = 1, instead of y = 0. (we'll let it bounce below 0 to maintain current behavior, but it'll always land at 1). This is what I just pushed a fix for. The downside is that all scrollviews will always be offset by 1 pixel, but it's barely possible to even notice that.
  2. Revert the 1-pixel workaround I just pushed. This has the downside that users will never be able to click status bar to scroll after opening a list, they'd have to scroll at least 1 pixel before doing that, and if scrolling to the absolute bottom of the list (y = 0), they also wouldn't be able to click the status bar.

You can see more details here.

I think there might be another way of working around this which would be using an invisible ScrollView to catch the gesture, but this would likely be even worse than the other 2 options.

I also remember reading that this has been attempted before in a PR on the old arch and it had the same exact bug. I'll try to link it here if I find it later.

I think I could implement a prop that activates the 1-pixel workaround described above, and another that disables this PR entirely (scrolls to the bottom, like it's being done now) so that developers can choose.

Obviously, everything I described above is not ideal, and simply a workaround, I would love to hear if anyone has any other ideas on how to tackle this.

Changelog:

[iOS] [CHANGED] - Fix scroll-to-top gesture on inverted lists

Test Plan:

This is a simple change but there is 1 known bug that I'd like to address before writing this section (more details above).

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 9, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants