From 73b596cfdd98558df35b45558ace12301ac5e6a6 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 25 Sep 2017 18:53:49 -0700 Subject: [PATCH] Small NaN related optimisation in RCTShadowText Summary: NaN values can not be compared directly, so we have to use `isnan` function. Reviewed By: mmmulani Differential Revision: D5859761 fbshipit-source-id: bf99a1ae574cd820265bef0c2bd255b194c5dc3c --- Libraries/Text/RCTShadowText.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Text/RCTShadowText.m b/Libraries/Text/RCTShadowText.m index b25c8c744..267cd2087 100644 --- a/Libraries/Text/RCTShadowText.m +++ b/Libraries/Text/RCTShadowText.m @@ -198,7 +198,7 @@ static YGSize RCTMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, f { if ( _cachedTextStorage && - width == _cachedTextStorageWidth && + (width == _cachedTextStorageWidth || (isnan(width) && isnan(_cachedTextStorageWidth))) && widthMode == _cachedTextStorageWidthMode && _cachedEffectiveLayoutDirection == self.effectiveLayoutDirection ) {