Skip to content

fix(macos): invert inverted lists on the new architecture - #3148

Open
Bron Davies (brondavies) wants to merge 1 commit into
microsoft:mainfrom
brondavies:fix/inverted-scrollview-new-arch
Open

Bron Davies (brondavies) wants to merge 1 commit into
microsoft:mainfrom
brondavies:fix/inverted-scrollview-new-arch

Conversation

@brondavies

Copy link
Copy Markdown

Summary:

Fixes #3147. On the new architecture a macOS ScrollView has no inverted prop, and VirtualizedList leaves out its inversion style on macOS, so an inverted list isn't inverted.

  • VirtualizedList uses the inversion style on macOS under the new architecture, as on iOS. Layout and measurement (measureInWindow) then match what's drawn.

  • RCTScrollViewComponentView turns a vertical scaleY(-1) into flipped coordinates rather than a layer transform:

    • the document view and the content view count from the bottom;
    • the cells' own scaleY(-1) is left off.

    AppKit then hit-tests, tracks hover and scrolls with the wheel the right way. A content offset still counts from the first item.

  • Turning inverted on or off re-sets the document view, because the clip view reads its document's flippedness only then. The view also sends the settled scroll offset afterwards.

Horizontal inverted lists keep the layer transform.

Test Plan:

RNTester-macOS (Debug, arm64, Xcode 27.1, macOS 26.6.2). The Playground had an inverted FlatList of 30 Pressable rows, 40pt each, in a 300pt list, with the onScroll offset shown above it.

  • On main, Item 0 is at the top.
  • With this change, Item 0 is at the bottom. Three wheel notches up, sent from lldb, bring Items 2 to 9 into view. Native and onScroll both report offset 90.
  • Hit-testing at the point where measureInWindow puts Item 5 returns Item 5's view, which is where it's drawn.

It's the same in an app on 0.83.0, where the inverted list is a chat that switches inverted on once its first messages arrive.

@brondavies
Bron Davies (brondavies) requested a review from a team as a code owner October 23, 2026 20:38
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

This branch has not been deployed

No deployments
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.

Inverted FlatList isn't inverted on the new architecture

1 participant