react-native/Libraries/Components
Spencer Ahrens 72670bf8d2 support sticky headers
Summary:
This adds support for both automagical sticky section headers in
`SectionList` as well as the more free-form `stickyHeaderIndices` on
`FlatList` or `VirtualizedList`.

The basic concept is to take the initial `stickySectionHeaders` and remap them
to the indices corresponding to the mounted subset in the render window. The
main trick here is that the currently stuck header might itself be outside of
the render window, so we need to search the gap to see if that's the case and
render it (with spacers above and below it instead of one big spacer).

In the `SectionList` we simply pre-compute the sticky headers at the same time
as when we scan the sections to determine the flattened length and pass those
to `VirtualizedList`.

This also requires some updates to `ScrollView` to work in the churny
environment of `VirtualizedList`. We propogate the keys on the children to the
animated wrappers so that as items are removed and the indices of the
remaining items change, react can keep proper track of them. We also fix the
scroll back case where new headers are rendered from the top down and aren't
updated with the `setNextLayoutY` callback because the `onLayout` call for the
next header happened before it was mounted. This is done by just tracking all
the layout values in a map and providing them to the sticky components at
render time. This might also improve perf a little by property configuring the
animations syncronously instead of waiting for the `onLayout` callback. We
also need to protect against stale onLayout callbacks and other fun stuff.

== Test Plan ==

https://www.facebook.com/groups/react.native.community/permalink/940332509435661/

Scroll a lot with and without debug mode on. Make sure spinner
still spins and there are no crashes (lots of crashes during development due
to the animated configuration being non-monotonic if anything stale values get
through). Also made sure that tapping a row to change it's height would
properly update the animation configurations so the collision point would
still be correct.

Reviewed By: yungsters

Differential Revision: D4695065

fbshipit-source-id: 855c4e31c8f8b450d32150dbdb2e07f1a9f9f98e
2017-03-21 22:30:30 -07:00
..
AccessibilityInfo Finish AccessibilityInfo implementation 2017-02-27 18:34:19 -08:00
ActivityIndicator RN: Update React (2/2) 2016-11-04 05:43:44 -07:00
AppleTV Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
Clipboard Remove deprecated APIs and modules 2016-10-11 07:43:52 -07:00
DatePicker fbobjc 2017-03-04 19:30:34 -08:00
DatePickerAndroid Fix formatting in DatePickerAndroid.open docs 2017-02-27 18:34:19 -08:00
DrawerAndroid RN: Update React (2/2) 2016-11-04 05:43:44 -07:00
Keyboard fbobjc 2017-03-04 19:30:34 -08:00
Navigation Remove Navigator recommendation 2017-03-21 15:15:48 -07:00
Picker fbobjc 2017-03-04 19:30:34 -08:00
ProgressBarAndroid RN: Update React (2/2) 2016-11-04 05:43:44 -07:00
ProgressViewIOS fbobjc 2017-03-04 19:30:34 -08:00
RefreshControl fbobjc 2017-03-04 19:30:34 -08:00
ScrollView support sticky headers 2017-03-21 22:30:30 -07:00
SegmentedControlIOS fbobjc 2017-03-04 19:30:34 -08:00
Slider fbobjc 2017-03-04 19:30:34 -08:00
StatusBar android now supports barStyle 2017-03-01 13:32:16 -08:00
Switch fbobjc 2017-03-04 19:30:34 -08:00
TabBarIOS Add TabBarIOS.Item on Android 2017-03-06 10:10:11 -08:00
TextInput Support string return type from RN createReactNativeFiberComponentClass() 2017-03-20 13:07:06 -07:00
TimePickerAndroid Clean unused import modules. 2016-10-16 11:13:40 -07:00
ToastAndroid Add very basic usage example for android toast 2016-09-19 06:43:54 -07:00
ToolbarAndroid RN: Update React (2/2) 2016-11-04 05:43:44 -07:00
Touchable Fixes spelling mistake inside TouchableNativeFeedback.android.js 2017-03-13 12:31:41 -07:00
UnimplementedViews Convert from React.createClass to ES6 classes 2016-07-26 01:13:31 -07:00
View Support string return type from RN createReactNativeFiberComponentClass() 2017-03-20 13:07:06 -07:00
ViewPager RN: Stop Deep Linking `ReactElement` 2016-10-14 18:59:10 -07:00
WebView Added option to set mixed content mode in android webview 2017-03-08 06:45:22 -08:00
Button.js Add disabled to accessibilityTraits in case button is disabled 2017-02-22 13:16:02 -08:00
LazyRenderer.js Cleanup: Prefer `React.Element` over `React$?Element` 2016-10-14 08:59:37 -07:00
ScrollResponder.js Support ScrollView.scrollToEnd on Android natively 2017-01-30 10:28:32 -08:00
StaticContainer.react.js Rename files to match @providesModule annotations 2017-02-03 15:58:58 -08:00
StaticRenderer.js Reverted commit D4027388 2016-10-16 04:13:42 -07:00
Subscribable.js