From a0c23868cb0cccf325fa33093a88c6f6fb6c7ea5 Mon Sep 17 00:00:00 2001 From: Horcrux Date: Sun, 24 Apr 2016 12:31:47 +0800 Subject: [PATCH] fix transparent bug --- ios/RNSVGNode.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/RNSVGNode.m b/ios/RNSVGNode.m index 408c850f..94f59c84 100644 --- a/ios/RNSVGNode.m +++ b/ios/RNSVGNode.m @@ -45,14 +45,15 @@ - (void)renderTo:(CGContextRef)context { float opacity = self.opacity; - BOOL transparent = NO; + if (opacity <= 0) { // Nothing to paint return; } - if (opacity >= 1) { + + BOOL transparent = opacity < 1; + if (!transparent) { opacity = 1; - transparent = YES; } // This needs to be painted on a layer before being composited. @@ -61,7 +62,6 @@ CGContextSetAlpha(context, opacity); if (transparent) { CGContextBeginTransparencyLayer(context, NULL); - } [self renderLayerTo:context]; if (transparent) {