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:00:02 -07:00
committed by Facebook Github Bot 8
parent 857d2b8eae
commit a2fb703bbb
133 changed files with 2124 additions and 2191 deletions
+23 -27
View File
@@ -38,20 +38,18 @@ exports.framework = 'React';
exports.title = '<Modal>';
exports.description = 'Component for presenting modal views.';
var Button = React.createClass({
getInitialState() {
return {
active: false,
};
},
class Button extends React.Component {
state = {
active: false,
};
_onHighlight() {
_onHighlight = () => {
this.setState({active: true});
},
};
_onUnhighlight() {
_onUnhighlight = () => {
this.setState({active: false});
},
};
render() {
var colorStyle = {
@@ -68,28 +66,26 @@ var Button = React.createClass({
</TouchableHighlight>
);
}
});
}
var ModalExample = React.createClass({
getInitialState() {
return {
animationType: 'none',
modalVisible: false,
transparent: false,
};
},
class ModalExample extends React.Component {
state = {
animationType: 'none',
modalVisible: false,
transparent: false,
};
_setModalVisible(visible) {
_setModalVisible = (visible) => {
this.setState({modalVisible: visible});
},
};
_setAnimationType(type) {
_setAnimationType = (type) => {
this.setState({animationType: type});
},
};
_toggleTransparent() {
_toggleTransparent = () => {
this.setState({transparent: !this.state.transparent});
},
};
render() {
var modalBackgroundStyle = {
@@ -144,8 +140,8 @@ var ModalExample = React.createClass({
</Button>
</View>
);
},
});
}
}
exports.examples = [
{