Clarify transform for ViewStyleProps, generate union docs properly
This commit is contained in:
parent
e5b9eb5900
commit
f878be84e6
|
@ -36,6 +36,23 @@ var ViewStylePropTypes = {
|
|||
),
|
||||
shadowOpacity: ReactPropTypes.number,
|
||||
shadowRadius: ReactPropTypes.number,
|
||||
transform: ReactPropTypes.arrayOf(
|
||||
ReactPropTypes.oneOfType([
|
||||
ReactPropTypes.shape({rotation: ReactPropTypes.number}),
|
||||
ReactPropTypes.shape({scaleX: ReactPropTypes.number}),
|
||||
ReactPropTypes.shape({scaleY: ReactPropTypes.number}),
|
||||
ReactPropTypes.shape({translateX: ReactPropTypes.number}),
|
||||
ReactPropTypes.shape({translateY: ReactPropTypes.number})
|
||||
])
|
||||
),
|
||||
transformMatrix: ReactPropTypes.arrayOf(ReactPropTypes.number),
|
||||
|
||||
// DEPRECATED
|
||||
rotation: ReactPropTypes.number,
|
||||
scaleX: ReactPropTypes.number,
|
||||
scaleY: ReactPropTypes.number,
|
||||
translateX: ReactPropTypes.number,
|
||||
translateY: ReactPropTypes.number,
|
||||
};
|
||||
|
||||
module.exports = ViewStylePropTypes;
|
||||
|
|
|
@ -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) + ']';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue