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
This commit is contained in:
Timothy Kukulski 2018-09-28 12:51:29 -07:00 committed by Facebook Github Bot
parent 6715268794
commit 97f0e43710

View File

@ -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,