Fix border width precedence issue
This commit is contained in:
parent
90b80e375c
commit
f2b3057a7c
|
@ -39,8 +39,10 @@ typedef enum {
|
||||||
NSMutableArray *_reactSubviews;
|
NSMutableArray *_reactSubviews;
|
||||||
BOOL _recomputePadding;
|
BOOL _recomputePadding;
|
||||||
BOOL _recomputeMargin;
|
BOOL _recomputeMargin;
|
||||||
|
BOOL _recomputeBorder;
|
||||||
float _paddingMetaProps[META_PROP_COUNT];
|
float _paddingMetaProps[META_PROP_COUNT];
|
||||||
float _marginMetaProps[META_PROP_COUNT];
|
float _marginMetaProps[META_PROP_COUNT];
|
||||||
|
float _borderMetaProps[META_PROP_COUNT];
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize reactTag = _reactTag;
|
@synthesize reactTag = _reactTag;
|
||||||
|
@ -247,6 +249,7 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st
|
||||||
for (int ii = 0; ii < META_PROP_COUNT; ii++) {
|
for (int ii = 0; ii < META_PROP_COUNT; ii++) {
|
||||||
_paddingMetaProps[ii] = CSS_UNDEFINED;
|
_paddingMetaProps[ii] = CSS_UNDEFINED;
|
||||||
_marginMetaProps[ii] = CSS_UNDEFINED;
|
_marginMetaProps[ii] = CSS_UNDEFINED;
|
||||||
|
_borderMetaProps[ii] = CSS_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
_newView = YES;
|
_newView = YES;
|
||||||
|
@ -449,27 +452,20 @@ RCT_PADDING_PROPERTY(Right, RIGHT)
|
||||||
#define RCT_BORDER_PROPERTY(prop, metaProp) \
|
#define RCT_BORDER_PROPERTY(prop, metaProp) \
|
||||||
- (void)setBorder##prop##Width:(CGFloat)value \
|
- (void)setBorder##prop##Width:(CGFloat)value \
|
||||||
{ \
|
{ \
|
||||||
_cssNode->style.border[CSS_##metaProp] = value; \
|
_borderMetaProps[META_PROP_##metaProp] = value; \
|
||||||
[self dirtyLayout]; \
|
_recomputeBorder = YES; \
|
||||||
} \
|
} \
|
||||||
- (CGFloat)border##prop##Width \
|
- (CGFloat)border##prop##Width \
|
||||||
{ \
|
{ \
|
||||||
return _cssNode->style.border[META_PROP_##metaProp]; \
|
return _borderMetaProps[META_PROP_##metaProp]; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_BORDER_PROPERTY(, ALL)
|
||||||
RCT_BORDER_PROPERTY(Top, TOP)
|
RCT_BORDER_PROPERTY(Top, TOP)
|
||||||
RCT_BORDER_PROPERTY(Left, LEFT)
|
RCT_BORDER_PROPERTY(Left, LEFT)
|
||||||
RCT_BORDER_PROPERTY(Bottom, BOTTOM)
|
RCT_BORDER_PROPERTY(Bottom, BOTTOM)
|
||||||
RCT_BORDER_PROPERTY(Right, RIGHT)
|
RCT_BORDER_PROPERTY(Right, RIGHT)
|
||||||
|
|
||||||
- (void)setBorderWidth:(CGFloat)value
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
_cssNode->style.border[i] = value;
|
|
||||||
}
|
|
||||||
[self dirtyLayout];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dimensions
|
// Dimensions
|
||||||
|
|
||||||
#define RCT_DIMENSIONS_PROPERTY(setProp, getProp, cssProp) \
|
#define RCT_DIMENSIONS_PROPERTY(setProp, getProp, cssProp) \
|
||||||
|
@ -562,12 +558,16 @@ RCT_STYLE_PROPERTY(FlexWrap, flexWrap, flex_wrap, css_wrap_type_t)
|
||||||
if (_recomputeMargin) {
|
if (_recomputeMargin) {
|
||||||
RCTProcessMetaProps(_marginMetaProps, _cssNode->style.margin);
|
RCTProcessMetaProps(_marginMetaProps, _cssNode->style.margin);
|
||||||
}
|
}
|
||||||
if (_recomputePadding || _recomputeMargin) {
|
if (_recomputeBorder) {
|
||||||
|
RCTProcessMetaProps(_borderMetaProps, _cssNode->style.border);
|
||||||
|
}
|
||||||
|
if (_recomputePadding || _recomputeMargin || _recomputeBorder) {
|
||||||
[self dirtyLayout];
|
[self dirtyLayout];
|
||||||
}
|
}
|
||||||
[self fillCSSNode:_cssNode];
|
[self fillCSSNode:_cssNode];
|
||||||
_recomputeMargin = NO;
|
_recomputeMargin = NO;
|
||||||
_recomputePadding = NO;
|
_recomputePadding = NO;
|
||||||
|
_recomputeBorder = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -523,7 +523,7 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:unused)
|
||||||
_backgroundColor.CGColor,
|
_backgroundColor.CGColor,
|
||||||
self.clipsToBounds);
|
self.clipsToBounds);
|
||||||
|
|
||||||
const CGRect contentsCenter = ({
|
CGRect contentsCenter = ({
|
||||||
CGSize size = image.size;
|
CGSize size = image.size;
|
||||||
UIEdgeInsets insets = image.capInsets;
|
UIEdgeInsets insets = image.capInsets;
|
||||||
CGRectMake(
|
CGRectMake(
|
||||||
|
@ -540,6 +540,7 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:unused)
|
||||||
[image drawInRect:(CGRect){CGPointZero, size}];
|
[image drawInRect:(CGRect){CGPointZero, size}];
|
||||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||||
UIGraphicsEndImageContext();
|
UIGraphicsEndImageContext();
|
||||||
|
contentsCenter = CGRectMake(0, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
layer.backgroundColor = NULL;
|
layer.backgroundColor = NULL;
|
||||||
|
|
Loading…
Reference in New Issue