From 97f0e43710a990c30e14d66bf67c7d612377d3f2 Mon Sep 17 00:00:00 2001 From: Timothy Kukulski Date: Fri, 28 Sep 2018 12:51:29 -0700 Subject: [PATCH] allow zero offset when shadow radius is nonzero Summary: update creation logic for text shadow: allow shadows with zero offset when the radius is nonzero (?should we also add a check to drop the node as a no-op when color.alpha == 0 ?) Reviewed By: yungsters Differential Revision: D10017778 fbshipit-source-id: 0168ac6db5ad22a5d7eb32dcd184aede361d6651 --- .../facebook/react/views/text/ReactBaseTextShadowNode.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java index b2772a60b..6e6d2cfef 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java @@ -6,6 +6,7 @@ */ package com.facebook.react.views.text; +import android.graphics.Color; import android.graphics.Typeface; import android.os.Build; import android.text.Layout; @@ -150,7 +151,10 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode { if (textShadowNode.mIsLineThroughTextDecorationSet) { ops.add(new SetSpanOperation(start, end, new StrikethroughSpan())); } - if (textShadowNode.mTextShadowOffsetDx != 0 || textShadowNode.mTextShadowOffsetDy != 0) { + if ((textShadowNode.mTextShadowOffsetDx != 0 + || textShadowNode.mTextShadowOffsetDy != 0 + || textShadowNode.mTextShadowRadius != 0) + && Color.alpha(textShadowNode.mTextShadowColor) != 0) { ops.add( new SetSpanOperation( start,