From 4511993ffaf503b902fb9741c396eaa090a5662e Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Thu, 28 Jan 2016 04:06:27 -0800 Subject: [PATCH] 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 --- Examples/UIExplorer/createExamplePage.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Examples/UIExplorer/createExamplePage.js b/Examples/UIExplorer/createExamplePage.js index 410688160..55ebd1599 100644 --- a/Examples/UIExplorer/createExamplePage.js +++ b/Examples/UIExplorer/createExamplePage.js @@ -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 ( + title={title} + description={description}> {renderedComponent} );