[ReactNative][SyncDiff] Add option to make examples platform specific
This commit is contained in:
parent
d4e5d95efe
commit
5b2d8000ae
|
@ -14,11 +14,13 @@
|
|||
* @providesModule ExampleTypes
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
export type Example = {
|
||||
title: string,
|
||||
render: () => ?ReactElement<any, any, any>,
|
||||
description?: string,
|
||||
platform?: string;
|
||||
};
|
||||
|
||||
export type ExampleModule = {
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
'use strict';
|
||||
|
||||
var React = require('react-native');
|
||||
var {
|
||||
Platform,
|
||||
} = React;
|
||||
var ReactNative = require('ReactNative');
|
||||
var UIExplorerBlock = require('./UIExplorerBlock');
|
||||
var UIExplorerPage = require('./UIExplorerPage');
|
||||
|
@ -36,6 +39,12 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
|||
},
|
||||
|
||||
getBlock: function(example: Example, i) {
|
||||
if (example.platform) {
|
||||
if (Platform.OS !== example.platform) {
|
||||
return;
|
||||
}
|
||||
example.title += ' (' + example.platform + ' only)';
|
||||
}
|
||||
// Hack warning: This is a hack because the www UI explorer requires
|
||||
// renderComponent to be called.
|
||||
var originalRender = React.render;
|
||||
|
|
Loading…
Reference in New Issue