react-native/Libraries/Lists/__tests__
Tony Tan 3e7aa5f14e Fix bug - FlatList component did not render more items when content was filtered
Summary:
**Bug Description**

The FlatList component receives content items via the data prop, and renders an initial number of items on the app's view. When a user scrolls to the end of the list, the component will append and render more available items at the end of the list. There was a bug where when the content was filtered, there were more available items but the component did not append/render them. This is due to the current appending/rendering logic in VirtualizedList, which does not account for data changes as a condition for updating/rendering. VirtualizedList is a dependency of FlatList, so this issue affects FlatList as well.

**Approach to Fixing Bug**

(i) Reproduce bug on iOS view of FlatList.
(ii) For VirtualizedList component:
  # Isolate onEndReached function that appends more data to component UI.
  # Isolate _onContentSizeChange function that is called when list content changes.
  # Write snapshot tests using jest, based off existing test for FlatList.
  # Refactor logic to append more data to list into _maybeCallOnEndReached function.
  # Call _maybeCallOnEndReached in both _onContentSizeChange and _onScroll.
(iii) Run snapshot tests and observe jest output.
(iv) Bring up iOS view of FlatList and check that component now renders more items when content is filtered.

Many thanks to sahrens for guidance in developing this code!

Reviewed By: sahrens

Differential Revision: D4877388

fbshipit-source-id: c10c9eef1912f491450a62b81a9bc41f7f784203
2017-04-17 18:15:37 -07:00
..
__snapshots__ Fix bug - FlatList component did not render more items when content was filtered 2017-04-17 18:15:37 -07:00
FillRateHelper-test.js Add option to track when we're showing blankness during fast scrolling 2017-04-07 01:00:39 -07:00
FlatList-test.js Re-License Lists with standard React Native License 2017-03-24 14:31:19 -07:00
SectionList-test.js Re-License Lists with standard React Native License 2017-03-24 14:31:19 -07:00
ViewabilityHelper-test.js Re-License Lists with standard React Native License 2017-03-24 14:31:19 -07:00
VirtualizeUtils-test.js Re-License Lists with standard React Native License 2017-03-24 14:31:19 -07:00
VirtualizedList-test.js Fix bug - FlatList component did not render more items when content was filtered 2017-04-17 18:15:37 -07:00