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
@@ -26,24 +26,20 @@ const {
|
||||
const UIExplorerBlock = require('./UIExplorerBlock');
|
||||
const UIExplorerPage = require('./UIExplorerPage');
|
||||
|
||||
const KeyboardAvoidingViewExample = React.createClass({
|
||||
statics: {
|
||||
title: '<KeyboardAvoidingView>',
|
||||
description: 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.',
|
||||
},
|
||||
class KeyboardAvoidingViewExample extends React.Component {
|
||||
static title = '<KeyboardAvoidingView>';
|
||||
static description = 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.';
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
behavior: 'padding',
|
||||
modalOpen: false,
|
||||
};
|
||||
},
|
||||
state = {
|
||||
behavior: 'padding',
|
||||
modalOpen: false,
|
||||
};
|
||||
|
||||
onSegmentChange(segment: String) {
|
||||
onSegmentChange = (segment: String) => {
|
||||
this.setState({behavior: segment.toLowerCase()});
|
||||
},
|
||||
};
|
||||
|
||||
renderExample() {
|
||||
renderExample = () => {
|
||||
return (
|
||||
<View style={styles.outerContainer}>
|
||||
<Modal animationType="fade" visible={this.state.modalOpen}>
|
||||
@@ -69,7 +65,7 @@ const KeyboardAvoidingViewExample = React.createClass({
|
||||
</TouchableHighlight>
|
||||
</View>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
@@ -79,8 +75,8 @@ const KeyboardAvoidingViewExample = React.createClass({
|
||||
</UIExplorerBlock>
|
||||
</UIExplorerPage>
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
outerContainer: {
|
||||
|
||||
Reference in New Issue
Block a user