react-native/Libraries
Spencer Ahrens f25df504ed Add support for updating adjacent separators on row highlight to FlatList
Summary:
A nice bit of polish for apps is to update the separators between list items
when press actives the highlight (things get especially noticeable/ugly when
the separators are not full width and don't adjust). This can be difficult to
coordinate and update efficiently, so we bake the functionality into
`VirtualizedList`.

The approach taken here is a little different from `ListView`. We pass a new
`separators` object with `renderItem` that has easy-to-use callbacks for toggling
the 'highlighted' prop on both adjacent separators - they can be wired up
directly to the `onShow/HideUnderlay` props of `TouchableHighlight` (pit of
success and all that - we want those RN apps to be polished!), but we also
provide a more generic `separators.updateProps` method to set any custom
props. This also passes in `leadingItem` so more custom wiring can be done on
initial render (e.g. linking the highlight state with `Animated`).

This also moves the separator rendering into the `CellRenderer`. I think this might
also fix some subtle measurement bugs with the `onLayout` not capturing the
height of the separator, so that's nice too, but the main reason is to have
an easy place to store the state so we don't have to re-render the entire list
like `ListView` does. Instead we track references to the cells and call update
only on the two we care about so the feedback is instantaneous even with big,
heavy lists.

This diff also messes with a bunch of flow and updates the example to be more
like a standard list.

`SectionList` support is coming in a stacked diff.

**TestPlan**

Video demo:

https://youtu.be/uFE7qGA0mg4

Pretty sure this is backwards compatible....

Reviewed By: thechefchen

Differential Revision: D4833557

fbshipit-source-id: 685af46243ba13246bf280dae8a4223381ce8cea
2017-04-12 17:01:03 -07:00
..
ART Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
ActionSheetIOS Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
AdSupport Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
Alert Export Alert's type ButtonsArray for external use 2017-03-06 12:44:47 -08:00
Animated Animated - Add missing super calls to fix native animated crash 2017-03-29 04:02:22 -07:00
AppState Fix the website build 2017-02-21 09:11:01 -08:00
BatchedBridge Support passing a collection of native modules to JSContext 2017-03-31 01:00:52 -07:00
BugReporting Patch up for future React Sync 2017-02-08 14:50:43 -08:00
CameraRoll Deploy v0.43.0 2017-04-05 18:31:06 -07:00
Components Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
Core Manually inline parseErrorStack 2017-03-28 08:38:13 -07:00
DebugComponentHierarchy Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
EventEmitter Native Animated - Restore, reorganize and add new tests 2017-03-27 11:46:05 -07:00
Experimental Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
Geolocation Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
Image Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
Inspector Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
Interaction Fixes "guesture" typo in PanResponser docs 2017-04-03 09:15:29 -07:00
JSInspector Add Network agent 2016-11-02 12:29:15 -07:00
LayoutAnimation Deploy v0.43.0 2017-04-05 18:31:06 -07:00
Linking fixed typo in "linking" docs 2017-04-12 16:31:35 -07:00
LinkingIOS Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
Lists Add support for updating adjacent separators on row highlight to FlatList 2017-04-12 17:01:03 -07:00
Modal Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
NativeAnimation Fix tvOS build 2017-03-29 02:35:59 -07:00
Network BREAKING: Android: Support withCredentials flag in XHRs 2017-04-10 22:46:12 -07:00
Performance Support QuickPerformanceLogger.js in the old bridge 2017-02-16 11:33:48 -08:00
PermissionsAndroid inline a bunch of NativeModule requires 2017-02-17 16:49:38 -08:00
PushNotificationIOS PushNotificationIOS.requestPermissions won't resolve if no event listeners are attached 2017-04-07 11:17:00 -07:00
RCTTest Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
ReactNative Add option to track when we're showing blankness during fast scrolling 2017-04-07 01:00:39 -07:00
Renderer Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
Sample Fix missing RCTBridgeModule.h 2017-01-31 11:13:50 -08:00
Settings Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
Share Update Share.js. Fixed bad grammar 2016-11-23 11:28:29 -08:00
Storage correctly order ASyncStorage 2017-02-21 15:18:40 -08:00
StyleSheet Add display:none support to react native 2017-03-01 09:16:05 -08:00
Text Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
Utilities Add mock for BackHandler 2017-04-11 12:25:38 -07:00
Vibration Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
WebSocket Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
react-native Fixed crash when forwarding already existing property from ReactNativeInternal to ReactNative 2017-04-06 13:46:00 -07:00
vendor Remove `copyProperties` 2017-03-21 08:01:58 -07:00
Promise.js Allow Promise to display error strings and not just error objects. 2017-03-09 14:30:57 -08:00
promiseRejectionIsError.js RN: Cleanup OSS JS & Flow Declarations 2016-11-20 17:58:29 -08:00