react-native/Examples/UIExplorer/js
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
..
AnimatedGratuitousApp Clean up Animated docs 2017-02-17 14:48:17 -08:00
Thumbnails Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
AccessibilityAndroidExample.android.js Finish AccessibilityInfo implementation 2017-02-27 18:34:19 -08:00
AccessibilityIOSExample.js Finish AccessibilityInfo implementation 2017-02-27 18:34:19 -08:00
ActionSheetIOSExample.js Moved takeSnapshot method from UIManager to ReactNative 2017-03-25 00:46:54 -07:00
ActivityIndicatorExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
AdSupportIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
AlertExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
AlertIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
AnimatedExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
AppStateExample.js Reverted commit D4027388 2016-10-16 04:13:42 -07:00
AssetScaledImageExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
AsyncStorageExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
BorderExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
BoxShadowExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ButtonExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
CameraRollExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
CameraRollView.js Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
ClipboardExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
DatePickerAndroidExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
DatePickerIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ExampleTypes.js Deploy v0.40.0 2017-02-24 12:45:56 -08:00
FlatListExample.js Add support for updating adjacent separators on row highlight to FlatList 2017-04-12 17:01:03 -07:00
GeolocationExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ImageCapInsetsExample.js Kill require('image!...') 2016-11-22 21:13:52 -08:00
ImageEditingExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ImageExample.js blurRadius for Image 2017-03-02 07:47:21 -08:00
KeyboardAvoidingViewExample.js Convert from React.createClass to ES6 classes 2016-07-26 01:13:31 -07:00
LayoutAnimationExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
LayoutEventsExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
LayoutExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
LinkingExample.js Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
ListExampleShared.js Add support for updating adjacent separators on row highlight to FlatList 2017-04-12 17:01:03 -07:00
ListViewExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ListViewGridLayoutExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ListViewPagingExample.js Improve z-index implementation on Android 2017-04-05 09:17:46 -07:00
ModalExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
MultiColumnExample.js Add support for updating adjacent separators on row highlight to FlatList 2017-04-12 17:01:03 -07:00
NativeAnimationsExample.js Enable flow in react-native-implementation 2017-04-05 10:17:49 -07:00
NavigatorIOSColorsExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
NavigatorIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
NetInfoExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
OrientationChangeExample.js Listen to device orientation changes 2016-09-06 03:59:01 -07:00
PanResponderExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
PermissionsExampleAndroid.android.js Handle "Never Ask Again" in permissions and add requestMultiplePermissions 2016-11-24 22:43:28 -08:00
PickerExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
PickerIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
PointerEventsExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ProgressBarAndroidExample.android.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ProgressViewIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
PushNotificationIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
RCTRootViewIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
RTLExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
RefreshControlExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
RootViewSizeFlexibilityExampleApp.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ScrollViewExample.js Enable flow in react-native-implementation 2017-04-05 10:17:49 -07:00
ScrollViewSimpleExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
SectionListExample.js Improve z-index implementation on Android 2017-04-05 09:17:46 -07:00
SegmentedControlIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
SetPropertiesExampleApp.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ShareExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
SliderExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
SnapshotExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
StatusBarExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
SwipeableListViewExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
SwitchExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TabBarIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TextExample.android.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TextExample.ios.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TextInputExample.android.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TextInputExample.ios.js Better TextInput: RCTUITextView was decoupled in separate file and now handles placeholder feature 2017-03-20 00:02:58 -07:00
TimePickerAndroidExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TimerExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ToastAndroidExample.android.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ToolbarAndroidExample.android.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TouchableExample.js Added deprecation warning for View.* static accessibility traits accessors 2017-03-22 10:00:54 -07:00
TransformExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
TransparentHitTestExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
UIExplorerActions.js Remove NavExperimental from UIExplorer 2017-02-28 15:45:43 -08:00
UIExplorerApp.android.js Revert D4494386: [react-native][PR] BREAKING - Remove LayoutAnimation experimental flag on Android 2017-03-09 20:16:37 -08:00
UIExplorerApp.ios.js Move BackAndroid -> BackHandler, add Apple TV support for back nav 2017-03-06 21:51:40 -08:00
UIExplorerBlock.js Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
UIExplorerButton.js Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
UIExplorerExampleContainer.js Clean unused import modules. 2016-10-16 11:13:40 -07:00
UIExplorerExampleList.js Implement sticky headers in JS using Native Animated 2017-03-02 15:15:31 -08:00
UIExplorerList.android.js Remove NavigationExperimental examples 2017-03-02 13:17:35 -08:00
UIExplorerList.ios.js Deprecate Navigator 2017-03-27 13:32:29 -07:00
UIExplorerNavigationReducer.js Remove NavExperimental from UIExplorer 2017-02-28 15:45:43 -08:00
UIExplorerPage.js Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
UIExplorerSettingSwitchRow.js Add some stall stuff as settings to native animated example 2016-09-06 19:58:35 -07:00
UIExplorerStatePersister.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
UIExplorerTitle.js Convert from React.createClass to ES6 classes 2016-07-26 01:13:31 -07:00
URIActionMap.js Remove NavExperimental from UIExplorer 2017-02-28 15:45:43 -08:00
VibrationExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
VibrationIOSExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ViewExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
ViewPagerAndroidExample.android.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
WebSocketExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
WebViewExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExample.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExampleBinaryUpload.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExampleCookies.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExampleDownload.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExampleFetch.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExampleFormData.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExampleHeaders.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
XHRExampleOnTimeOut.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
bunny.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
createExamplePage.js Clean unused import modules. 2016-10-16 11:13:40 -07:00
flux@3x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
hawk.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
helloworld.html Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
http_test_server.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00
messagingtest.html Implement a postMessage function and an onMessage event for webviews … 2016-10-16 06:43:46 -07:00
relay@3x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
slider-left.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
slider-left@2x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
slider-right.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
slider-right@2x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
slider.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
slider@2x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
uie_comment_highlighted@2x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
uie_comment_normal@2x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
uie_thumb_big.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
uie_thumb_normal@2x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
uie_thumb_selected@2x.png Cleanup UIExplorer folder 2016-07-12 05:59:13 -07:00
websocket_test_server.js Add @providesModule annotations 2017-02-27 14:04:56 -08:00