enable the minWidth/maxWidth/minHeight/maxHeight features

Summary: Closes https://github.com/facebook/react-native/pull/4183

Reviewed By: svcscm

Differential Revision: D2663931

Pulled By: nicklockwood

fb-gh-sync-id: 53d699fbb6041e3623eb78f1045cac28821efde8
This commit is contained in:
rocman 2015-11-17 10:57:00 -08:00 committed by facebook-github-bot-4
parent 0491142702
commit 2244a86eea
4 changed files with 27 additions and 11 deletions

View File

@ -27,7 +27,11 @@ var ReactPropTypes = require('ReactPropTypes');
*/
var LayoutPropTypes = {
width: ReactPropTypes.number,
maxWidth: ReactPropTypes.number,
minWidth: ReactPropTypes.number,
height: ReactPropTypes.number,
maxHeight: ReactPropTypes.number,
minHeight: ReactPropTypes.number,
top: ReactPropTypes.number,
left: ReactPropTypes.number,
right: ReactPropTypes.number,

View File

@ -63,6 +63,10 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGFloat minWidth;
@property (nonatomic, assign) CGFloat minHeight;
@property (nonatomic, assign) CGFloat maxWidth;
@property (nonatomic, assign) CGFloat maxHeight;
@property (nonatomic, assign) CGRect frame;
- (void)setTopLeft:(CGPoint)topLeft;

View File

@ -494,19 +494,23 @@ RCT_BORDER_PROPERTY(Right, RIGHT)
// Dimensions
#define RCT_DIMENSIONS_PROPERTY(setProp, getProp, cssProp) \
- (void)set##setProp:(CGFloat)value \
{ \
_cssNode->style.dimensions[CSS_##cssProp] = value; \
[self dirtyLayout]; \
} \
- (CGFloat)getProp \
{ \
return _cssNode->style.dimensions[CSS_##cssProp]; \
#define RCT_DIMENSIONS_PROPERTY(setProp, getProp, cssProp, dimensions) \
- (void)set##setProp:(CGFloat)value \
{ \
_cssNode->style.dimensions[CSS_##cssProp] = value; \
[self dirtyLayout]; \
} \
- (CGFloat)getProp \
{ \
return _cssNode->style.dimensions[CSS_##cssProp]; \
}
RCT_DIMENSIONS_PROPERTY(Width, width, WIDTH)
RCT_DIMENSIONS_PROPERTY(Height, height, HEIGHT)
RCT_DIMENSIONS_PROPERTY(Width, width, WIDTH, dimensions)
RCT_DIMENSIONS_PROPERTY(Height, height, HEIGHT, dimensions)
RCT_DIMENSIONS_PROPERTY(MinWidth, minWidth, WIDTH, minDimensions)
RCT_DIMENSIONS_PROPERTY(MinHeight, minHeight, HEIGHT, minDimensions)
RCT_DIMENSIONS_PROPERTY(MaxWidth, maxWidth, WIDTH, maxDimensions)
RCT_DIMENSIONS_PROPERTY(MaxHeight, maxHeight, HEIGHT, maxDimensions)
// Position

View File

@ -237,6 +237,10 @@ RCT_EXPORT_SHADOW_PROPERTY(left, CGFloat);
RCT_EXPORT_SHADOW_PROPERTY(width, CGFloat)
RCT_EXPORT_SHADOW_PROPERTY(height, CGFloat)
RCT_EXPORT_SHADOW_PROPERTY(minWidth, CGFloat)
RCT_EXPORT_SHADOW_PROPERTY(minHeight, CGFloat)
RCT_EXPORT_SHADOW_PROPERTY(maxWidth, CGFloat)
RCT_EXPORT_SHADOW_PROPERTY(maxHeight, CGFloat)
RCT_EXPORT_SHADOW_PROPERTY(borderTopWidth, CGFloat)
RCT_EXPORT_SHADOW_PROPERTY(borderRightWidth, CGFloat)