Fix invalid CGContext when invalidate layer (#24195)

Summary:
If size is zero, the `CGContext` would invalid, so we need to filter zero things.
cc. shergin

[iOS] [Fixed] - Fix invalid CGContext when invalidate layer
Pull Request resolved: https://github.com/facebook/react-native/pull/24195

Differential Revision: D14683396

Pulled By: shergin

fbshipit-source-id: b5b45fb86ca3158284281460cf1d95d1b22eab0d
This commit is contained in:
zhongwuzw
2019-03-29 07:50:54 -07:00
committed by Facebook Github Bot
parent a43e666a34
commit b88cc7bf52

View File

@@ -356,11 +356,15 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
- (void)invalidateLayer
{
CALayer *layer = self.layer;
if (CGSizeEqualToSize(layer.bounds.size, CGSizeZero)) {
return;
}
const auto borderMetrics =
_props->resolveBorderMetrics(_layoutMetrics.layoutDirection == LayoutDirection::RightToLeft);
CALayer *layer = self.layer;
// Stage 1. Shadow Path
BOOL layerHasShadow = layer.shadowOpacity > 0 && CGColorGetAlpha(layer.shadowColor) > 0;
if (layerHasShadow) {