From 700574fe76ee32f1fb6f892319ff7640fbf8ce7a Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Tue, 16 Aug 2016 09:48:13 -0700 Subject: [PATCH] Use an ES6 class in ListView docs Reviewed By: mkonicek Differential Revision: D3723141 Ninja: docs only fbshipit-source-id: e1030f85b524777d2efbedb3cf78c218c34bad88 --- .../CustomComponents/ListView/ListView.js | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index 4edc42844fd..2b75380acbb 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -65,21 +65,24 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50; * Minimal example: * * ``` - * getInitialState: function() { - * var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); - * return { - * dataSource: ds.cloneWithRows(['row 1', 'row 2']), - * }; - * }, + * class MyComponent extends Component { + * constructor() { + * super(); + * const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); + * this.state = { + * dataSource: ds.cloneWithRows(['row 1', 'row 2']), + * }; + * } * - * render: function() { - * return ( - * {rowData}} - * /> - * ); - * }, + * render() { + * return ( + * {rowData}} + * /> + * ); + * } + * } * ``` * * ListView also supports more advanced features, including sections with sticky