mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00: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,16 +33,15 @@ var {
|
||||
} = ReactNative;
|
||||
var UIExplorerButton = require('./UIExplorerButton');
|
||||
|
||||
var Tester = React.createClass({
|
||||
current: 0,
|
||||
getInitialState() {
|
||||
return {
|
||||
native: new Animated.Value(0),
|
||||
js: new Animated.Value(0),
|
||||
};
|
||||
},
|
||||
class Tester extends React.Component {
|
||||
state = {
|
||||
native: new Animated.Value(0),
|
||||
js: new Animated.Value(0),
|
||||
};
|
||||
|
||||
onPress() {
|
||||
current = 0;
|
||||
|
||||
onPress = () => {
|
||||
this.current = this.current ? 0 : 1;
|
||||
const config = {
|
||||
...this.props.config,
|
||||
@@ -55,7 +54,7 @@ var Tester = React.createClass({
|
||||
throw e;
|
||||
}
|
||||
Animated[this.props.type](this.state.js, { ...config, useNativeDriver: false }).start();
|
||||
},
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
@@ -76,8 +75,8 @@ var Tester = React.createClass({
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
row: {
|
||||
|
||||
Reference in New Issue
Block a user