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

Fix issue with setting initialSelectedindex to 0 in Flatlist #1399

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

Saadnajmi
Copy link
Collaborator

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

There was a bug if you set initialSelectedIndex to 0 on Flatlist. Turns out this was the issue:

0 || -1; // returns -1
0 ?? -1; // returns 0

Derp

Changelog

[macOS] [Fixed] - Fixed issue with setting initialSelectedIndex to 0 on Flatlist

Test Plan

Tested the cases undefined, 0, 1, 2

Screen.Recording.2022-08-30.at.4.16.57.PM.mov

@amgleitman
Copy link
Member

@Saadnajmi Saadnajmi merged commit 235603d into main Aug 31, 2022
@Saadnajmi Saadnajmi deleted the Saadnajmi-patch-1-1 branch August 31, 2022 18:54
chiuam pushed a commit to chiuam/react-native-macos that referenced this pull request Aug 31, 2022
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.

4 participants