Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refine invariant error message at scrollToIndex (#28464)
Summary: I refined the error message of scrollToIndex. When I used scrollToIndex with `index:0` and data that length is 0, I met the odd error message `Invariant Violation scrollToIndex out of range: requested index 0 but maximum is -1`. Next, I thought that scrollToIndex with `index:-1` meant scrollToTop without checking data length. I met `Invariant Violation: scrollToIndex out of range: requested index -1 but maximum is -1` Finally, I wondered what will happen to use scrollToIndex with `index:-1` and data that length is `5`. The result is `Invariant Violation: scrollToIndex out of range: requested index -1 but maximum is 5` The above error messages will confuse us. I clarified the boudaries and separated the error messages ## Changelog [General] [Fixed] - Clarified the boundaries in error message of scrollToIndex Pull Request resolved: #28464 Test Plan: I added 3 test cases to cover the new error messages for VirtualizedList. Run `yarn test` and confirm it passes. Reviewed By: cpojer Differential Revision: D21140133 Pulled By: TheSavior fbshipit-source-id: 9a7a704f7ec599d833d2ed3ca2be059d950539b5
- Loading branch information