[ReactNative] Expose ListView.DataSource instead of a top domain ListViewDataSource

This commit is contained in:
Christopher Chedeau 2015-03-02 16:02:42 -08:00
parent 39475de388
commit a39024928e
4 changed files with 8 additions and 7 deletions

View File

@ -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<any>): ListViewDataSource {
getDataSource: function(movies: Array<any>): ListView.DataSource {
return this.state.dataSource.cloneWithRows(movies);
},

View File

@ -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,

View File

@ -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({})),
};

View File

@ -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.