Skip to content

Commit 9b63b50

Browse files
Woodpavfacebook-github-bot
Woodpav
authored andcommittedApr 11, 2019
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: #17277 [iOS] [Fixed] - Text shadow now displays when the textShadowOffset is {width:0,height:0} Pull Request resolved: #24398 Differential Revision: D14890768 Pulled By: cpojer fbshipit-source-id: a43b96a4a04a5603eede466abacd95c010d053e5
1 parent 261cda9 commit 9b63b50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎Libraries/Text/RCTTextAttributes.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ - (NSParagraphStyle *)effectiveParagraphStyle
170170
}
171171

172172
// Shadow
173-
if (!CGSizeEqualToSize(_textShadowOffset, CGSizeZero)) {
173+
if (!isnan(_textShadowRadius)) {
174174
NSShadow *shadow = [NSShadow new];
175175
shadow.shadowOffset = _textShadowOffset;
176176
shadow.shadowBlurRadius = _textShadowRadius;

0 commit comments

Comments
 (0)
Please sign in to comment.