react-native-macos/Libraries/Lists
Moti Zilberman b2f871a6fa Fix crash with SectionList.scrollToLocation and private property munging
Summary:
Changelog:
[General][Fixed] - Remove illegal private property access in VirtualizedSectionList.scrollToLocation

`VirtualizedSectionList.scrollToLocation` internally uses `VirtualizedList`'s `_getFrameMetricsApprox` method. This method is private by convention (since it's `_`-prefixed), but under certain build setups this is also enforced at runtime, so using `scrollToLocation` can throw an error.

Here, we rename this internal method to `__getFrameMetricsApprox` (adding another leading underscore) which opts it out of being treated as private, while still communicating that it's not part of the public API. We also delete the Flow error suppression that masked this issue.

For reference: This convention for private methods (including the double-underscore opt out) has its roots in Facebook's pre-Babel [JSTransform](https://github.com/facebookarchive/jstransform/blob/master/visitors/es6-class-visitors.js) compiler and is implemented in Flow as [`munge_underscores=true`](https://flow.org/en/docs/config/options/#toc-munge-underscores-boolean).

Reviewed By: yungsters

Differential Revision: D33982339

fbshipit-source-id: 498563c59d42549c94fe90d363677d6d3ea35d2d
2022-02-03 17:34:50 -08:00
..
__flowtests__ Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
__tests__ Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
CellRenderMask.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
FillRateHelper.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
FlatList.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
SectionList.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
SectionListModern.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
ViewabilityHelper.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
VirtualizeUtils.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
VirtualizedList.js Fix crash with SectionList.scrollToLocation and private property munging 2022-02-03 17:34:50 -08:00
VirtualizedListContext.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
VirtualizedSectionList.js Fix crash with SectionList.scrollToLocation and private property munging 2022-02-03 17:34:50 -08:00