[react-native] Use SpreadProperty to make react-docgen happy

This commit is contained in:
Felix Kling 2015-03-20 16:41:31 -07:00
parent ca3be21484
commit 81d024924c
3 changed files with 31 additions and 40 deletions

View File

@ -8,13 +8,11 @@
var LayoutPropTypes = require('LayoutPropTypes'); var LayoutPropTypes = require('LayoutPropTypes');
var ReactPropTypes = require('ReactPropTypes'); var ReactPropTypes = require('ReactPropTypes');
var merge = require('merge');
/** /**
* Warning: Some of these properties may not be supported in all releases. * Warning: Some of these properties may not be supported in all releases.
*/ */
var ViewStylePropTypes = merge( var ViewStylePropTypes = {
LayoutPropTypes, { ...LayoutPropTypes,
backgroundColor: ReactPropTypes.string, backgroundColor: ReactPropTypes.string,
borderColor: ReactPropTypes.string, borderColor: ReactPropTypes.string,
borderTopColor: ReactPropTypes.string, borderTopColor: ReactPropTypes.string,
@ -36,6 +34,6 @@ var ViewStylePropTypes = merge(
scaleY: ReactPropTypes.number, scaleY: ReactPropTypes.number,
translateX: ReactPropTypes.number, translateX: ReactPropTypes.number,
translateY: ReactPropTypes.number, translateY: ReactPropTypes.number,
}); };
module.exports = ViewStylePropTypes; module.exports = ViewStylePropTypes;

View File

@ -9,23 +9,19 @@ var ImageResizeMode = require('ImageResizeMode');
var LayoutPropTypes = require('LayoutPropTypes'); var LayoutPropTypes = require('LayoutPropTypes');
var ReactPropTypes = require('ReactPropTypes'); var ReactPropTypes = require('ReactPropTypes');
var merge = require('merge'); var ImageStylePropTypes = {
...LayoutPropTypes,
resizeMode: ReactPropTypes.oneOf(Object.keys(ImageResizeMode)),
backgroundColor: ReactPropTypes.string,
borderColor: ReactPropTypes.string,
borderWidth: ReactPropTypes.number,
borderRadius: ReactPropTypes.number,
var ImageStylePropTypes = merge( // iOS-Specific style to "tint" an image.
LayoutPropTypes, // It changes the color of all the non-transparent pixels to the tintColor
{ tintColor: ReactPropTypes.string,
resizeMode: ReactPropTypes.oneOf(Object.keys(ImageResizeMode)), opacity: ReactPropTypes.number,
backgroundColor: ReactPropTypes.string, };
borderColor: ReactPropTypes.string,
borderWidth: ReactPropTypes.number,
borderRadius: ReactPropTypes.number,
// iOS-Specific style to "tint" an image.
// It changes the color of all the non-transparent pixels to the tintColor
tintColor: ReactPropTypes.string,
opacity: ReactPropTypes.number,
}
);
// Image doesn't support padding correctly (#4841912) // Image doesn't support padding correctly (#4841912)
var unsupportedProps = Object.keys({ var unsupportedProps = Object.keys({

View File

@ -8,25 +8,22 @@
var ReactPropTypes = require('ReactPropTypes'); var ReactPropTypes = require('ReactPropTypes');
var ViewStylePropTypes = require('ViewStylePropTypes'); var ViewStylePropTypes = require('ViewStylePropTypes');
var merge = require('merge'); var TextStylePropTypes = {
...ViewStylePropTypes,
var TextStylePropTypes = merge( fontFamily: ReactPropTypes.string,
ViewStylePropTypes, { fontSize: ReactPropTypes.number,
fontFamily: ReactPropTypes.string, fontWeight: ReactPropTypes.oneOf(['normal' /*default*/, 'bold']),
fontSize: ReactPropTypes.number, fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
fontWeight: ReactPropTypes.oneOf(['normal' /*default*/, 'bold']), lineHeight: ReactPropTypes.number,
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']), color: ReactPropTypes.string,
lineHeight: ReactPropTypes.number, containerBackgroundColor: ReactPropTypes.string,
color: ReactPropTypes.string, textAlign: ReactPropTypes.oneOf(
containerBackgroundColor: ReactPropTypes.string, ['auto' /*default*/, 'left', 'right', 'center']
textAlign: ReactPropTypes.oneOf( ),
['auto' /*default*/, 'left', 'right', 'center'] writingDirection: ReactPropTypes.oneOf(
), ['auto' /*default*/, 'ltr', 'rtl']
writingDirection: ReactPropTypes.oneOf( ),
['auto' /*default*/, 'ltr', 'rtl'] };
),
}
);
// Text doesn't support padding correctly (#4841912) // Text doesn't support padding correctly (#4841912)
var unsupportedProps = Object.keys({ var unsupportedProps = Object.keys({