Convert from React.createClass to ES6 classes

Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
This commit is contained in:
Ben Alpert
2016-07-26 01:13:31 -07:00
committed by Facebook Github Bot 8
parent 857d2b8eae
commit a2fb703bbb
133 changed files with 2124 additions and 2191 deletions
+20 -20
View File
@@ -33,31 +33,32 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
var Entity = React.createClass({
render: function() {
class Entity extends React.Component {
render() {
return (
<Text style={{fontWeight: 'bold', color: '#527fe4'}}>
{this.props.children}
</Text>
);
}
});
}
var AttributeToggler = React.createClass({
getInitialState: function() {
return {fontWeight: 'bold', fontSize: 15};
},
toggleWeight: function() {
class AttributeToggler extends React.Component {
state = {fontWeight: 'bold', fontSize: 15};
toggleWeight = () => {
this.setState({
fontWeight: this.state.fontWeight === 'bold' ? 'normal' : 'bold'
});
},
increaseSize: function() {
};
increaseSize = () => {
this.setState({
fontSize: this.state.fontSize + 1
});
},
render: function() {
};
render() {
var curStyle = {fontWeight: this.state.fontWeight, fontSize: this.state.fontSize};
return (
<View>
@@ -77,14 +78,13 @@ var AttributeToggler = React.createClass({
</View>
);
}
});
}
var TextExample = React.createClass({
statics: {
title: '<Text>',
description: 'Base component for rendering styled text.',
},
render: function() {
class TextExample extends React.Component {
static title = '<Text>';
static description = 'Base component for rendering styled text.';
render() {
return (
<UIExplorerPage title="<Text>">
<UIExplorerBlock title="Wrap">
@@ -414,7 +414,7 @@ var TextExample = React.createClass({
</UIExplorerPage>
);
}
});
}
var styles = StyleSheet.create({
backgroundColorText: {