diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index 26d63bdda..9b1ba1221 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -190,7 +190,7 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib - (CGFloat)effectiveFontSizeMultiplier { - return _allowFontScaling && !isnan(_fontSizeMultiplier) ? _fontSizeMultiplier : 1.0; + return !RCTHasFontHandlerSet() && _allowFontScaling && !isnan(_fontSizeMultiplier) ? _fontSizeMultiplier : 1.0; } - (UIColor *)effectiveForegroundColor diff --git a/React/Views/RCTFont.h b/React/Views/RCTFont.h index ba34e8f34..711721d2a 100644 --- a/React/Views/RCTFont.h +++ b/React/Views/RCTFont.h @@ -20,6 +20,7 @@ typedef UIFont *(^RCTFontHandler)(CGFloat fontSize, NSString *fontWeightDescript * "semibold", "extrabold", "bold", "heavy", or "black". */ RCT_EXTERN void RCTSetDefaultFontHandler(RCTFontHandler handler); +RCT_EXTERN BOOL RCTHasFontHandlerSet(); @interface RCTFont : NSObject diff --git a/React/Views/RCTFont.mm b/React/Views/RCTFont.mm index 37595dd3f..dc3877cb3 100644 --- a/React/Views/RCTFont.mm +++ b/React/Views/RCTFont.mm @@ -103,6 +103,10 @@ void RCTSetDefaultFontHandler(RCTFontHandler handler) { defaultFontHandler = handler; } +BOOL RCTHasFontHandlerSet() { + return defaultFontHandler != nil; +} + // We pass a string description of the font weight to the defaultFontHandler because UIFontWeight // is not defined pre-iOS 8.2. // Furthermore, UIFontWeight's are lossy floats, so we must use an inexact compare to figure out