Fix duplicate platform labels in UIExplorer examples
Summary: public This fixes a bug in UIExplorer, where platform labels on examples like (ios only) or (android only) would be re-appended to the title each time the example was viewed. Reviewed By: javache Differential Revision: D2869690 fb-gh-sync-id: 07f3f14007f75eea23a5328b7850f3f620691ac2
This commit is contained in:
parent
96a3a8e9b9
commit
4511993ffa
|
@ -39,11 +39,13 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
|||
},
|
||||
|
||||
getBlock: function(example: Example, i) {
|
||||
if (example.platform) {
|
||||
if (Platform.OS !== example.platform) {
|
||||
return;
|
||||
// Filter platform-specific examples
|
||||
var {title, description, platform} = example;
|
||||
if (platform) {
|
||||
if (Platform.OS !== platform) {
|
||||
return null;
|
||||
}
|
||||
example.title += ' (' + example.platform + ' only)';
|
||||
title += ' (' + platform + ' only)';
|
||||
}
|
||||
// Hack warning: This is a hack because the www UI explorer requires
|
||||
// renderComponent to be called.
|
||||
|
@ -74,8 +76,8 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
|||
return (
|
||||
<UIExplorerBlock
|
||||
key={i}
|
||||
title={example.title}
|
||||
description={example.description}>
|
||||
title={title}
|
||||
description={description}>
|
||||
{renderedComponent}
|
||||
</UIExplorerBlock>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue