From 17a81be40d057c638c9b1d7dc68d5a693387a607 Mon Sep 17 00:00:00 2001 From: Woodpav Date: Thu, 11 Apr 2019 02:30:09 -0700 Subject: [PATCH] Fix: text shadow displays on iOS when textShadowOffset is {0,0} (#24398) Summary: There is a problem rendering text shadows on iOS. If the offset of the text shadow is `{width:0,height:0}`, the shadow does not display. This prevents you from representing a light directly above the text. This occurs because a text shadow only renders if the offset is a non-zero CGRect `{width:0,height:0}`. My change checks `textShadowRadius` instead. If `textShadowRadius` is not nan then the user is rendering a text shadow. There are no situations to render a shadow without `textShadowRadius` making it a good variable to check. This PR fixes this stale issue: https://github.com/facebook/react-native/issues/17277 [iOS] [Fixed] - Text shadow now displays when the textShadowOffset is {width:0,height:0} Pull Request resolved: https://github.com/facebook/react-native/pull/24398 Differential Revision: D14890768 Pulled By: cpojer fbshipit-source-id: a43b96a4a04a5603eede466abacd95c010d053e5 --- Libraries/Text/RCTTextAttributes.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index f1bf6beab67f1a..ed9591895f088f 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -159,7 +159,7 @@ - (void)applyTextAttributes:(RCTTextAttributes *)textAttributes } // Shadow - if (!CGSizeEqualToSize(_textShadowOffset, CGSizeZero)) { + if (!isnan(_textShadowRadius)) { NSShadow *shadow = [NSShadow new]; shadow.shadowOffset = _textShadowOffset; shadow.shadowBlurRadius = _textShadowRadius;