From 54b22211dc05856930f3d19495eb8649d4fdec96 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Fri, 14 Mar 2025 06:46:00 -0700 Subject: [PATCH] Remove CGFLOAT_IS_DOUBLE macro (#50017) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50017 [From iOS 11 onwards and from MacOS 10.15](https://developer.apple.com/documentation/uikit/updating-your-app-from-32-bit-to-64-bit-architecture?language=objc), Apple only supports 64 bit architectures. Hence, [`CGFloat` is now always mapped to a Double](https://developer.apple.com/documentation/corefoundation/cgfloat-swift.struct?language=objc#overview) and it is now safe to remove the macro. ## Changelog [Internal] - Remove usages of `CGFLOAT_IS_DOUBLE` Reviewed By: javache Differential Revision: D71128583 fbshipit-source-id: bad805b941451ab84a68912f6d72149bfd7753ec --- .../react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm | 2 +- packages/react-native/React/Views/RCTFont.mm | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm b/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm index be97a50a61f..c28eada58e6 100644 --- a/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm +++ b/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm @@ -78,5 +78,5 @@ CGFloat RCTBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) NSNumber *baseSize = mapping[@(dynamicTypeRamp)] ?: @17; // Default to body size if we don't recognize the specified ramp - return CGFLOAT_IS_DOUBLE ? [baseSize doubleValue] : [baseSize floatValue]; + return [baseSize doubleValue]; } diff --git a/packages/react-native/React/Views/RCTFont.mm b/packages/react-native/React/Views/RCTFont.mm index 594ea127998..fe350138fd9 100644 --- a/packages/react-native/React/Views/RCTFont.mm +++ b/packages/react-native/React/Views/RCTFont.mm @@ -94,11 +94,7 @@ BOOL RCTHasFontHandlerSet() // which one we actually have. static inline BOOL CompareFontWeights(UIFontWeight firstWeight, UIFontWeight secondWeight) { -#if CGFLOAT_IS_DOUBLE return fabs(firstWeight - secondWeight) < 0.01; -#else - return fabsf(firstWeight - secondWeight) < 0.01; -#endif } static NSString *FontWeightDescriptionFromUIFontWeight(UIFontWeight fontWeight)