Summary:
Fixes #8184
Closes https://github.com/facebook/react-native/pull/8370

Differential Revision: D3477196

Pulled By: caabernathy

fbshipit-source-id: 929f84b3f8edaf03f918bb04fb9dbb48b4884b18
This commit is contained in:
Joel Marcey 2016-06-23 12:02:16 -07:00 коммит произвёл Facebook Github Bot 1
Родитель 6c5f532591
Коммит 7ee01a1b9f
1 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -20,20 +20,21 @@ This example creates a simple `ListView` of hardcoded data. It first initializes
> A `rowHasChanged` function is required to use `ListView`. Here we just say a row has changed if the row we are on is not the same as the previous row.
```JavaScript
import React from 'react';
import React, { Component } from 'react';
import { AppRegistry, ListView, Text, View } from 'react-native';
var AwesomeList = React.createClass({
class ListViewBasics extends Component {
// Initialize the hardcoded data
getInitialState: function() {
var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
return {
constructor(props) {
super(props);
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows([
'John', 'Joel', 'James', 'Jimmy', 'Jackson', 'Jillian', 'Julie'
])
'John', 'Joel', 'James', 'Jimmy', 'Jackson', 'Jillian', 'Julie', 'Devin'
])
};
},
render: function() {
}
render() {
return (
<View style={{paddingTop: 22}}>
<ListView
@ -43,8 +44,8 @@ var AwesomeList = React.createClass({
</View>
);
}
});
}
// App registration and rendering
AppRegistry.registerComponent('AwesomeProject', () => AwesomeList);
AppRegistry.registerComponent('AwesomeProject', () => ListViewBasics);
```