diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm index 6c38b8bda685ce..b547ec148fc39b 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm @@ -25,12 +25,12 @@ - (instancetype)initWithFrame:(CGRect)frame CGRect bounds = self.bounds; _label = [[UILabel alloc] initWithFrame:bounds]; - _label.backgroundColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3]; + _label.backgroundColor = [RCTUIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3]; _label.layoutMargins = UIEdgeInsetsMake(12, 12, 12, 12); _label.lineBreakMode = NSLineBreakByWordWrapping; _label.numberOfLines = 0; _label.textAlignment = NSTextAlignmentCenter; - _label.textColor = [UIColor whiteColor]; + _label.textColor = [RCTUIColor whiteColor]; self.contentView = _label; } diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm index 1112c5a9895437..007b5a8d4eb548 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm @@ -31,11 +31,11 @@ - (instancetype)initWithFrame:(CGRect)frame _props = defaultProps; _label = [[UILabel alloc] initWithFrame:self.bounds]; - _label.backgroundColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3]; + _label.backgroundColor = [RCTUIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3]; _label.lineBreakMode = NSLineBreakByCharWrapping; _label.numberOfLines = 0; _label.textAlignment = NSTextAlignmentCenter; - _label.textColor = [UIColor whiteColor]; + _label.textColor = [RCTUIColor whiteColor]; _label.allowsDefaultTighteningForTruncation = YES; _label.adjustsFontSizeToFitWidth = YES; diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h index 273ee5c4905c9d..e6e213179aef7b 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN * Provides access to `foregroundColor` prop of the component. * Must be used by subclasses only. */ -@property (nonatomic, strong, nullable) UIColor *foregroundColor; +@property (nonatomic, strong, nullable) RCTUIColor *foregroundColor; /** * Returns the object - usually (sub)view - which represents this diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index c38f932ff064d5..2d0fc0d4b36995 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -21,7 +21,7 @@ using namespace facebook::react; @implementation RCTViewComponentView { - UIColor *_backgroundColor; + RCTUIColor *_backgroundColor; CALayer *_borderLayer; BOOL _needsInvalidateLayer; BOOL _isJSResponder; @@ -71,12 +71,12 @@ - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event return CGRectContainsPoint(hitFrame, point); } -- (UIColor *)backgroundColor +- (RCTUIColor *)backgroundColor { return _backgroundColor; } -- (void)setBackgroundColor:(UIColor *)backgroundColor +- (void)setBackgroundColor:(RCTUIColor *)backgroundColor { _backgroundColor = backgroundColor; } diff --git a/React/Fabric/RCTConversions.h b/React/Fabric/RCTConversions.h index 0f8e8e26df5f38..f836da6c90b4e6 100644 --- a/React/Fabric/RCTConversions.h +++ b/React/Fabric/RCTConversions.h @@ -35,26 +35,26 @@ inline std::string RCTStringFromNSString(NSString *string) return std::string{string.UTF8String ?: ""}; } -inline UIColor *_Nullable RCTUIColorFromSharedColor(facebook::react::SharedColor const &sharedColor) +inline RCTUIColor *_Nullable RCTUIColorFromSharedColor(facebook::react::SharedColor const &sharedColor) { if (!sharedColor) { return nil; } if (*facebook::react::clearColor() == *sharedColor) { - return [UIColor clearColor]; + return [RCTUIColor clearColor]; } if (*facebook::react::blackColor() == *sharedColor) { - return [UIColor blackColor]; + return [RCTUIColor blackColor]; } if (*facebook::react::whiteColor() == *sharedColor) { - return [UIColor whiteColor]; + return [RCTUIColor whiteColor]; } auto components = facebook::react::colorComponentsFromColor(sharedColor); - return [UIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; + return [RCTUIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; } inline CF_RETURNS_RETAINED CGColorRef diff --git a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm index 2d143e7dbbd20b..3cce591c99fbba 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +++ b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm @@ -131,7 +131,7 @@ return dict; } -static UIColor *_UIColorFromHexValue(NSNumber *hexValue) +static RCTUIColor *_UIColorFromHexValue(NSNumber *hexValue) { NSUInteger hexIntValue = [hexValue unsignedIntegerValue]; @@ -140,10 +140,10 @@ CGFloat blue = ((CGFloat)((hexIntValue & 0xFF00) >> 8)) / 255.0; CGFloat alpha = ((CGFloat)(hexIntValue & 0xFF)) / 255.0; - return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; + return [RCTUIColor colorWithRed:red green:green blue:blue alpha:alpha]; } -static UIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString) +static RCTUIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString) { NSString *platformColorString = [semanticString hasSuffix:kColorSuffix] ? [semanticString substringToIndex:[semanticString length] - [kColorSuffix length]] @@ -152,17 +152,17 @@ NSDictionary *colorInfo = platformColorSelectorsDict[platformColorString]; if (colorInfo) { SEL objcColorSelector = NSSelectorFromString([platformColorString stringByAppendingString:kColorSuffix]); - if (![UIColor respondsToSelector:objcColorSelector]) { + if (![RCTUIColor respondsToSelector:objcColorSelector]) { NSNumber *fallbackRGB = colorInfo[kFallbackARGBKey]; if (fallbackRGB) { return _UIColorFromHexValue(fallbackRGB); } } else { - Class uiColorClass = [UIColor class]; + Class uiColorClass = [RCTUIColor class]; IMP imp = [uiColorClass methodForSelector:objcColorSelector]; id (*getUIColor)(id, SEL) = ((id(*)(id, SEL))imp); id colorObject = getUIColor(uiColorClass, objcColorSelector); - if ([colorObject isKindOfClass:[UIColor class]]) { + if ([colorObject isKindOfClass:[RCTUIColor class]]) { return colorObject; } } @@ -177,7 +177,7 @@ return [NSString stringWithCString:string.c_str() encoding:encoding]; } -static inline facebook::react::ColorComponents _ColorComponentsFromUIColor(UIColor *color) +static inline facebook::react::ColorComponents _ColorComponentsFromUIColor(RCTUIColor *color) { CGFloat rgba[4]; RCTGetRGBAColorComponents(color.CGColor, rgba); @@ -188,7 +188,7 @@ { for (const auto &semanticCString : semanticItems) { NSString *semanticNSString = _NSStringFromCString(semanticCString); - UIColor *uiColor = [UIColor colorNamed:semanticNSString]; + RCTUIColor *uiColor = [RCTUIColor colorNamed:semanticNSString]; if (uiColor != nil) { return _ColorComponentsFromUIColor(uiColor); } diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm index b3b7064f9cc8c9..6196ceb900d94f 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm @@ -83,9 +83,9 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex : 1.0; } -inline static UIColor *RCTEffectiveForegroundColorFromTextAttributes(const TextAttributes &textAttributes) +inline static RCTUIColor *RCTEffectiveForegroundColorFromTextAttributes(const TextAttributes &textAttributes) { - UIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [UIColor blackColor]; + RCTUIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [RCTUIColor blackColor]; if (!isnan(textAttributes.opacity)) { effectiveForegroundColor = [effectiveForegroundColor @@ -95,16 +95,16 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex return effectiveForegroundColor; } -inline static UIColor *RCTEffectiveBackgroundColorFromTextAttributes(const TextAttributes &textAttributes) +inline static RCTUIColor *RCTEffectiveBackgroundColorFromTextAttributes(const TextAttributes &textAttributes) { - UIColor *effectiveBackgroundColor = RCTUIColorFromSharedColor(textAttributes.backgroundColor); + RCTUIColor *effectiveBackgroundColor = RCTUIColorFromSharedColor(textAttributes.backgroundColor); if (effectiveBackgroundColor && !isnan(textAttributes.opacity)) { effectiveBackgroundColor = [effectiveBackgroundColor colorWithAlphaComponent:CGColorGetAlpha(effectiveBackgroundColor.CGColor) * textAttributes.opacity]; } - return effectiveBackgroundColor ?: [UIColor clearColor]; + return effectiveBackgroundColor ?: [RCTUIColor clearColor]; } NSDictionary *RCTNSTextAttributesFromTextAttributes(TextAttributes const &textAttributes) @@ -118,7 +118,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex } // Colors - UIColor *effectiveForegroundColor = RCTEffectiveForegroundColorFromTextAttributes(textAttributes); + RCTUIColor *effectiveForegroundColor = RCTEffectiveForegroundColorFromTextAttributes(textAttributes); if (textAttributes.foregroundColor || !isnan(textAttributes.opacity)) { attributes[NSForegroundColorAttributeName] = effectiveForegroundColor; @@ -174,7 +174,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex NSUnderlineStyle style = RCTNSUnderlineStyleFromTextDecorationStyle( textAttributes.textDecorationStyle.value_or(TextDecorationStyle::Solid)); - UIColor *textDecorationColor = RCTUIColorFromSharedColor(textAttributes.textDecorationColor); + RCTUIColor *textDecorationColor = RCTUIColorFromSharedColor(textAttributes.textDecorationColor); // Underline if (textDecorationLineType == TextDecorationLineType::Underline || diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h index 4d90c09e4e6696..65334f2707ee7c 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h @@ -71,24 +71,24 @@ inline static NSUnderlineStyle RCTNSUnderlineStyleFromTextDecorationStyle(TextDe } } -inline static UIColor *RCTUIColorFromSharedColor(const SharedColor &sharedColor) +inline static RCTUIColor *RCTUIColorFromSharedColor(const SharedColor &sharedColor) { if (!sharedColor) { return nil; } if (*facebook::react::clearColor() == *sharedColor) { - return [UIColor clearColor]; + return [RCTUIColor clearColor]; } if (*facebook::react::blackColor() == *sharedColor) { - return [UIColor blackColor]; + return [RCTUIColor blackColor]; } if (*facebook::react::whiteColor() == *sharedColor) { - return [UIColor whiteColor]; + return [RCTUIColor whiteColor]; } auto components = facebook::react::colorComponentsFromColor(sharedColor); - return [UIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; + return [RCTUIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; }