From a39024928e0f81f8fc7de0822a69580165b46e7c Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Mon, 2 Mar 2015 16:02:42 -0800 Subject: [PATCH] [ReactNative] Expose ListView.DataSource instead of a top domain ListViewDataSource --- Examples/Movies/SearchScreen.js | 5 ++--- Examples/UIExplorer/ListViewPagingExample.js | 3 +-- Examples/UIExplorer/ListViewSimpleExample.js | 3 +-- Libraries/Components/ListView/ListView.js | 4 ++++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Examples/Movies/SearchScreen.js b/Examples/Movies/SearchScreen.js index 2cd67aa192..2aa3f1ea81 100644 --- a/Examples/Movies/SearchScreen.js +++ b/Examples/Movies/SearchScreen.js @@ -7,7 +7,6 @@ var React = require('react-native'); var { ListView, - ListViewDataSource, ScrollView, ActivityIndicatorIOS, StyleSheet, @@ -44,7 +43,7 @@ var SearchScreen = React.createClass({ return { isLoading: false, isLoadingTail: false, - dataSource: new ListViewDataSource({ + dataSource: new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2, }), filter: '', @@ -192,7 +191,7 @@ var SearchScreen = React.createClass({ }); }, - getDataSource: function(movies: Array): ListViewDataSource { + getDataSource: function(movies: Array): ListView.DataSource { return this.state.dataSource.cloneWithRows(movies); }, diff --git a/Examples/UIExplorer/ListViewPagingExample.js b/Examples/UIExplorer/ListViewPagingExample.js index 4818da9981..c74795eb5a 100644 --- a/Examples/UIExplorer/ListViewPagingExample.js +++ b/Examples/UIExplorer/ListViewPagingExample.js @@ -11,7 +11,6 @@ var { Image, LayoutAnimation, ListView, - ListViewDataSource, StyleSheet, Text, TouchableOpacity, @@ -72,7 +71,7 @@ var ListViewPagingExample = React.createClass({ return dataBlob[rowID]; }; - var dataSource = new ListViewDataSource({ + var dataSource = new ListView.DataSource({ getRowData: getRowData, getSectionHeaderData: getSectionData, rowHasChanged: (row1, row2) => row1 !== row2, diff --git a/Examples/UIExplorer/ListViewSimpleExample.js b/Examples/UIExplorer/ListViewSimpleExample.js index db61308433..c6b158f033 100644 --- a/Examples/UIExplorer/ListViewSimpleExample.js +++ b/Examples/UIExplorer/ListViewSimpleExample.js @@ -9,7 +9,6 @@ var React = require('react-native'); var { Image, ListView, - ListViewDataSource, TouchableHighlight, StyleSheet, Text, @@ -25,7 +24,7 @@ var ListViewSimpleExample = React.createClass({ }, getInitialState: function() { - var ds = new ListViewDataSource({rowHasChanged: (r1, r2) => r1 !== r2}); + var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); return { dataSource: ds.cloneWithRows(this._genRows({})), }; diff --git a/Libraries/Components/ListView/ListView.js b/Libraries/Components/ListView/ListView.js index 45539586be..086112724e 100644 --- a/Libraries/Components/ListView/ListView.js +++ b/Libraries/Components/ListView/ListView.js @@ -77,6 +77,10 @@ var SCROLLVIEW_REF = 'listviewscroll'; var ListView = React.createClass({ mixins: [ScrollResponder.Mixin, TimerMixin], + statics: { + DataSource: ListViewDataSource, + }, + /** * You must provide a renderRow function. If you omit any of the other render * functions, ListView will simply skip rendering them.