mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-30 17:33:21 +08:00
Convert from React.createClass to ES6 classes
Reviewed By: cpojer Differential Revision: D3619143 fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
This commit is contained in:
committed by
Facebook Github Bot 8
parent
857d2b8eae
commit
a2fb703bbb
@@ -33,12 +33,11 @@ var {
|
||||
|
||||
var NUM_ITEMS = 20;
|
||||
|
||||
var ScrollViewSimpleExample = React.createClass({
|
||||
statics: {
|
||||
title: '<ScrollView>',
|
||||
description: 'Component that enables scrolling through child components.'
|
||||
},
|
||||
makeItems: function(nItems: number, styles): Array<any> {
|
||||
class ScrollViewSimpleExample extends React.Component {
|
||||
static title = '<ScrollView>';
|
||||
static description = 'Component that enables scrolling through child components.';
|
||||
|
||||
makeItems = (nItems: number, styles): Array<any> => {
|
||||
var items = [];
|
||||
for (var i = 0; i < nItems; i++) {
|
||||
items[i] = (
|
||||
@@ -48,9 +47,9 @@ var ScrollViewSimpleExample = React.createClass({
|
||||
);
|
||||
}
|
||||
return items;
|
||||
},
|
||||
};
|
||||
|
||||
render: function() {
|
||||
render() {
|
||||
// One of the items is a horizontal scroll view
|
||||
var items = this.makeItems(NUM_ITEMS, styles.itemWrapper);
|
||||
items[4] = (
|
||||
@@ -67,7 +66,7 @@ var ScrollViewSimpleExample = React.createClass({
|
||||
|
||||
return verticalScrollView;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
verticalScrollView: {
|
||||
|
||||
Reference in New Issue
Block a user