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
@@ -39,13 +39,11 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
||||
: ReactClass<any> {
|
||||
invariant(!!exampleModule.examples, 'The module must have examples');
|
||||
|
||||
var ExamplePage = React.createClass({
|
||||
statics: {
|
||||
title: exampleModule.title,
|
||||
description: exampleModule.description,
|
||||
},
|
||||
class ExamplePage extends React.Component {
|
||||
static title = exampleModule.title;
|
||||
static description = exampleModule.description;
|
||||
|
||||
getBlock: function(example: Example, i) {
|
||||
getBlock = (example: Example, i) => {
|
||||
// Filter platform-specific examples
|
||||
var {title, description, platform} = example;
|
||||
if (platform) {
|
||||
@@ -82,16 +80,16 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
||||
{renderedComponent}
|
||||
</UIExplorerBlock>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
render: function() {
|
||||
render() {
|
||||
return (
|
||||
<UIExplorerPage title={title}>
|
||||
{exampleModule.examples.map(this.getBlock)}
|
||||
</UIExplorerPage>
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return ExamplePage;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user