From eeddef18b8d3d624ae8027104790c963bdc586be Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Wed, 12 Apr 2017 16:57:12 -0700 Subject: [PATCH] Use separators API in UIExplorer list Summary: Clean up code and polish UI. Reviewed By: yungsters Differential Revision: D4872739 fbshipit-source-id: e7977c94e744cef30fad2832cf41d7a7b5ec2b2e --- .../UIExplorer/js/UIExplorerExampleList.js | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/Examples/UIExplorer/js/UIExplorerExampleList.js b/Examples/UIExplorer/js/UIExplorerExampleList.js index b80529183..7a697c53a 100644 --- a/Examples/UIExplorer/js/UIExplorerExampleList.js +++ b/Examples/UIExplorer/js/UIExplorerExampleList.js @@ -60,6 +60,8 @@ class RowComponent extends React.PureComponent { item: Object, onNavigate: Function, onPress?: Function, + onShowUnderlay?: Function, + onHideUnderlay?: Function, }; _onPress = () => { if (this.props.onPress) { @@ -71,19 +73,16 @@ class RowComponent extends React.PureComponent { render() { const {item} = this.props; return ( - - - - - {item.module.title} - - - {item.module.description} - - - - - + + + + {item.module.title} + + + {item.module.description} + + + ); } } @@ -121,6 +120,8 @@ class UIExplorerExampleList extends React.Component { {this._renderTitleRow()} {this._renderTextInput()} ; + _renderItem = ({item, separators}) => ( + + ); _renderTitleRow(): ?React.Element { if (!this.props.displayTitleRow) { @@ -188,6 +196,10 @@ class UIExplorerExampleList extends React.Component { } } +const ItemSeparator = ({highlighted}) => ( + +); + UIExplorerExampleList = UIExplorerStatePersister.createContainer(UIExplorerExampleList, { cacheKeySuffix: () => 'mainList', getInitialState: () => ({filter: ''}), @@ -217,6 +229,10 @@ const styles = StyleSheet.create({ backgroundColor: '#bbbbbb', marginLeft: 15, }, + separatorHighlighted: { + height: StyleSheet.hairlineWidth, + backgroundColor: 'rgb(217, 217, 217)', + }, rowTitleText: { fontSize: 17, fontWeight: '500',