Skip to content

Commit

Permalink
dont use ios border rendering if we use default black color
Browse files Browse the repository at this point in the history
Summary:
iOS and css have a different way to draw borders. Decision which rendering to use considers alpha value of given color as well.
If alpha=0 -> border is invisible -> we use ios render.
That doesn't work as expected in a case where only `borderWidth` property is set.
A default black color is used when no `borderColor` is set, but alpha checking logic will test `null`. Which resolves as alpha=0.

Reviewed By: javache

Differential Revision: D3750523

fbshipit-source-id: 453d52a16287c6286e8887a9ab3795d3ded1dec6
  • Loading branch information
majak authored and Facebook Github Bot 5 committed Aug 23, 2016
1 parent 107fc72 commit a686816
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion React/Views/RCTView.m
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ - (void)displayLayer:(CALayer *)layer
// the content. For this reason, only use iOS border drawing when clipping
// or when the border is hidden.

(borderInsets.top == 0 || CGColorGetAlpha(borderColors.top) == 0 || self.clipsToBounds);
(borderInsets.top == 0 || (borderColors.top && CGColorGetAlpha(borderColors.top) == 0) || self.clipsToBounds);

// iOS clips to the outside of the border, but CSS clips to the inside. To
// solve this, we'll need to add a container view inside the main view to
Expand Down

0 comments on commit a686816

Please sign in to comment.