Skip to content

chore: minimize the virtualized-lists fork - #3026

Open
Saad Najmi (Saadnajmi) wants to merge 1 commit into
microsoft:mainfrom
Saadnajmi:saadnajmi/unfork-virtualized-lists
Open

chore: minimize the virtualized-lists fork#3026
Saad Najmi (Saadnajmi) wants to merge 1 commit into
microsoft:mainfrom
Saadnajmi:saadnajmi/unfork-virtualized-lists

Conversation

@Saadnajmi

Copy link
Copy Markdown
Collaborator

Summary

  • sync @react-native-macos/virtualized-lists implementation and tests with the React Native merge-base
  • retain one macOS-only delta for native vertical inversion so trackpad, mouse-wheel, and scrollbar behavior remain native
  • keep horizontal inverted lists transform-based
  • move opt-in keyboard selection state, callbacks, isSelected, and selectRowAtIndex into FlatList
  • keep ScrollView generic; it only preserves native children when macOS native inversion is active

Why

The fork duplicated upstream list implementation primarily for keyboard selection and native inversion. Selection is FlatList/listbox semantics, while VirtualizedList should remain generic virtualization infrastructure. Native vertical inversion still needs a minimal strategy clause because upstream transform inversion does not provide correct macOS scrolling interactions.

After this change, the virtualized-lists fork differs from the upstream merge-base in only Lists/VirtualizedList.js, where vertical macOS inversion omits transform styles.

Behavior notes

  • FlatList keeps the existing macOS keyboard-selection API.
  • SectionList and direct VirtualizedList no longer expose the unused keyboard-selection API.
  • Vertical inverted lists continue using native macOS inversion.
  • Horizontal inverted lists use scaleX(-1) because AppKit native inversion is vertical only.

Validation

  • yarn flow-check
  • 11 focused Jest suites: 189 passed, 2 skipped, 82 snapshots
  • Prettier and ESLint on all changed source files
  • verified the virtualized-lists package has exactly one implementation-file delta from upstream

@Saadnajmi
Saad Najmi (Saadnajmi) marked this pull request as ready for review July 29, 2026 21:08
@Saadnajmi
Saad Najmi (Saadnajmi) requested a review from a team as a code owner July 29, 2026 21:08
Move macOS keyboard selection into FlatList and sync the virtualized-lists implementation with upstream, retaining only native vertical inversion support.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2a1abab3-6a1a-43f9-afea-e18a5f862f6a
@Saadnajmi Saad Najmi (Saadnajmi) changed the title Minimize the virtualized-lists fork chore: minimize the virtualized-lists fork Aug 4, 2026
@Saadnajmi
Saad Najmi (Saadnajmi) force-pushed the saadnajmi/unfork-virtualized-lists branch from 36ffd2b to 015e09c Compare August 4, 2026 06:20
Comment on lines -240 to -244
if (Platform.OS === 'macos') {
// [macOS
result = React.cloneElement(result, {collapsable: false});
} // macOS]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We shouldn't remove this, I think this was a performance optimization made separately

Comment on lines +117 to +139
/**
* Called when the selected row changes.
*
* @platform macos
*/
onSelectionChanged?:
| ((info: {
previousSelection: number;
newSelection: number;
item: ItemT | ReadonlyArray<ItemT> | null | undefined;
}) => void)
| null
| undefined;

/**
* Called when Enter is pressed on the selected row.
*
* @platform macos
*/
onSelectionEntered?:
| ((item: ItemT | ReadonlyArray<ItemT> | null | undefined) => void)
| null
| undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are these names taken from somewhere? Web API uses onChange for both. Looks like we've always had these so changing them now would break stuff.

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