Add property mapping for borderStyle from JS to RCTView (iOS)

Reviewed By: nicklockwood

Differential Revision: D2540321

fb-gh-sync-id: 57316f7b8dc734ee784179dbfde83e6034827819
This commit is contained in:
David Aurelio
2015-12-01 07:41:20 -08:00
committed by facebook-github-bot-5
parent 765801dfc2
commit a26b89f8bd
7 changed files with 61 additions and 3 deletions

View File

@@ -108,6 +108,7 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
_borderTopRightRadius = -1;
_borderBottomLeftRadius = -1;
_borderBottomRightRadius = -1;
_borderStyle = RCTBorderStyleSolid;
_backgroundColor = super.backgroundColor;
}
@@ -509,6 +510,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:unused)
RCTCornerRadiiAreEqual(cornerRadii) &&
RCTBorderInsetsAreEqual(borderInsets) &&
RCTBorderColorsAreEqual(borderColors) &&
_borderStyle == RCTBorderStyleSolid &&
// iOS draws borders in front of the content whereas CSS draws them behind
// the content. For this reason, only use iOS border drawing when clipping
@@ -531,9 +533,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:unused)
return;
}
UIImage *image = RCTGetBorderImage([self cornerRadii],
[self bordersAsInsets],
[self borderColors],
UIImage *image = RCTGetBorderImage(cornerRadii,
borderInsets,
borderColors,
_backgroundColor.CGColor,
self.clipsToBounds);
@@ -630,6 +632,8 @@ setBorderWidth(Right)
setBorderWidth(Bottom)
setBorderWidth(Left)
#pragma mark - Border Radius
#define setBorderRadius(side) \
- (void)setBorder##side##Radius:(CGFloat)radius \
{ \
@@ -646,6 +650,20 @@ setBorderRadius(TopRight)
setBorderRadius(BottomLeft)
setBorderRadius(BottomRight)
#pragma mark - Border Style
#define setBorderStyle(side) \
- (void)setBorder##side##Style:(RCTBorderStyle)style \
{ \
if (_border##side##Style == style) { \
return; \
} \
_border##side##Style = style; \
[self.layer setNeedsDisplay]; \
}
setBorderStyle()
- (void)dealloc
{
CGColorRelease(_borderColor);