From f878be84e609631895278a951af2a29ac2a02bd6 Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Wed, 6 May 2015 11:05:47 -0700 Subject: [PATCH] Clarify transform for ViewStyleProps, generate union docs properly --- Libraries/Components/View/ViewStylePropTypes.js | 17 +++++++++++++++++ website/layout/AutodocsLayout.js | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/Libraries/Components/View/ViewStylePropTypes.js b/Libraries/Components/View/ViewStylePropTypes.js index c1f6b4b1c..c69ff91e7 100644 --- a/Libraries/Components/View/ViewStylePropTypes.js +++ b/Libraries/Components/View/ViewStylePropTypes.js @@ -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; diff --git a/website/layout/AutodocsLayout.js b/website/layout/AutodocsLayout.js index 23b223814..d9e38e488 100644 --- a/website/layout/AutodocsLayout.js +++ b/website/layout/AutodocsLayout.js @@ -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) + ']'; }