Skip to content

Commit

Permalink
Fabric: Fixes TextInput crash when textShadowOffset is set and textSh…
Browse files Browse the repository at this point in the history
…adowRadius is nan (facebook#48296)

Summary:
Fixes facebook#48288

## Changelog:

[IOS] [FIXED] - Fabric: Fixes TextInput crash when textShadowOffset is set and textShadowRadius is nan

Pull Request resolved: facebook#48296

Test Plan: Repro demo in facebook#48288

Reviewed By: cipolleschi

Differential Revision: D67334179

Pulled By: NickGerleman

fbshipit-source-id: a9456a152d31bef1666669cbded28d99ec8a2028
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Dec 17, 2024
1 parent 5370347 commit 5c789c3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,12 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex
auto textShadowOffset = textAttributes.textShadowOffset.value();
NSShadow *shadow = [NSShadow new];
shadow.shadowOffset = CGSize{textShadowOffset.width, textShadowOffset.height};
shadow.shadowBlurRadius = textAttributes.textShadowRadius;
shadow.shadowColor = RCTUIColorFromSharedColor(textAttributes.textShadowColor);
if (!isnan(textAttributes.textShadowRadius)) {
shadow.shadowBlurRadius = textAttributes.textShadowRadius;
}
if (textAttributes.textShadowColor) {
shadow.shadowColor = RCTUIColorFromSharedColor(textAttributes.textShadowColor);
}
attributes[NSShadowAttributeName] = shadow;
}

Expand Down

0 comments on commit 5c789c3

Please sign in to comment.