mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-29 22:41:56 +08: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
@@ -35,22 +35,20 @@ var UIExplorerPage = require('./UIExplorerPage');
|
||||
var SwitchAndroid = require('SwitchAndroid');
|
||||
var ToolbarAndroid = require('ToolbarAndroid');
|
||||
|
||||
var ToolbarAndroidExample = React.createClass({
|
||||
statics: {
|
||||
title: '<ToolbarAndroid>',
|
||||
description: 'Examples of using the Android toolbar.'
|
||||
},
|
||||
getInitialState: function() {
|
||||
return {
|
||||
actionText: 'Example app with toolbar component',
|
||||
toolbarSwitch: false,
|
||||
colorProps: {
|
||||
titleColor: '#3b5998',
|
||||
subtitleColor: '#6a7180',
|
||||
},
|
||||
};
|
||||
},
|
||||
render: function() {
|
||||
class ToolbarAndroidExample extends React.Component {
|
||||
static title = '<ToolbarAndroid>';
|
||||
static description = 'Examples of using the Android toolbar.';
|
||||
|
||||
state = {
|
||||
actionText: 'Example app with toolbar component',
|
||||
toolbarSwitch: false,
|
||||
colorProps: {
|
||||
titleColor: '#3b5998',
|
||||
subtitleColor: '#6a7180',
|
||||
},
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<UIExplorerPage title="<ToolbarAndroid>">
|
||||
<UIExplorerBlock title="Toolbar with title/subtitle and actions">
|
||||
@@ -117,13 +115,14 @@ var ToolbarAndroidExample = React.createClass({
|
||||
</UIExplorerBlock>
|
||||
</UIExplorerPage>
|
||||
);
|
||||
},
|
||||
_onActionSelected: function(position) {
|
||||
}
|
||||
|
||||
_onActionSelected = (position) => {
|
||||
this.setState({
|
||||
actionText: 'Selected ' + toolbarActions[position].title,
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var toolbarActions = [
|
||||
{title: 'Create', icon: require('image!ic_create_black_48dp'), show: 'always'},
|
||||
|
||||
Reference in New Issue
Block a user