Convert from React.createClass to ES6 classes

Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
This commit is contained in:
Ben Alpert authored and Facebook Github Bot 8 committed 2016-07-26 01:13:31 -07:00
1 parent 857d2b8eae
commit a2fb703bbb
133 files changed
+2124 -2191

No files matched your search

+28 -27
View File
@@ -30,26 +30,28 @@ var {
View,
} = ReactNative;
var ExampleBox = React.createClass({
getInitialState: function() {
return {
log: [],
};
},
handleLog: function(msg) {
class ExampleBox extends React.Component {
state = {
log: [],
};
handleLog = (msg) => {
this.state.log = this.state.log.concat([msg]);
},
flushReactChanges: function() {
};
flushReactChanges = () => {
this.forceUpdate();
},
};
/**
* Capture phase of bubbling to append separator before any of the bubbling
* happens.
*/
handleTouchCapture: function() {
handleTouchCapture = () => {
this.state.log = this.state.log.concat(['---']);
},
render: function() {
};
render() {
return (
<View>
<View
@@ -66,11 +68,10 @@ var ExampleBox = React.createClass({
</View>
);
}
});
}
var NoneExample = React.createClass({
render: function() {
class NoneExample extends React.Component {
render() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -96,14 +97,14 @@ var NoneExample = React.createClass({
</View>
);
}
});
}
/**
* Special demo text that makes itself untouchable so that it doesn't destroy
* the experiment and confuse the output.
*/
var DemoText = React.createClass({
render: function() {
class DemoText extends React.Component {
render() {
return (
<View pointerEvents="none">
<Text
@@ -113,10 +114,10 @@ var DemoText = React.createClass({
</View>
);
}
});
}
var BoxNoneExample = React.createClass({
render: function() {
class BoxNoneExample extends React.Component {
render() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -150,10 +151,10 @@ var BoxNoneExample = React.createClass({
</View>
);
}
});
}
var BoxOnlyExample = React.createClass({
render: function() {
class BoxOnlyExample extends React.Component {
render() {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -187,7 +188,7 @@ var BoxOnlyExample = React.createClass({
</View>
);
}
});
}
type ExampleClass = {
Component: ReactClass<any>,