Skip to content

Commit

Permalink
allow zero offset when shadow radius is nonzero
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kukulski authored and facebook-github-bot committed Sep 28, 2018
1 parent 6715268 commit 97f0e43
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -150,7 +151,10 @@ private static void buildSpannedFromShadowNode(
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,
Expand Down

0 comments on commit 97f0e43

Please sign in to comment.