Clarify transform for ViewStyleProps, generate union docs properly

This commit is contained in:
Brent Vatne
2015-05-06 11:05:47 -07:00
parent e5b9eb5900
commit f878be84e6
2 changed files with 22 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ var slugify = require('slugify');
var styleReferencePattern = /^[^.]+\.propTypes\.style$/;
var ComponentDoc = React.createClass({
renderType: function(type) {
if (type.name === 'enum') {
@@ -33,6 +34,10 @@ var ComponentDoc = React.createClass({
return '{' + Object.keys(type.value).map((key => key + ': ' + this.renderType(type.value[key]))).join(', ') + '}';
}
if (type.name == 'union') {
return type.value.map(this.renderType).join(', ');
}
if (type.name === 'arrayOf') {
return '[' + this.renderType(type.value) + ']';
}