diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm index 6c38b8bda685ce..da2cba56c1a404 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]; // TODO(macOS GH#774) _label.layoutMargins = UIEdgeInsetsMake(12, 12, 12, 12); _label.lineBreakMode = NSLineBreakByWordWrapping; _label.numberOfLines = 0; _label.textAlignment = NSTextAlignmentCenter; - _label.textColor = [UIColor whiteColor]; + _label.textColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) self.contentView = _label; } diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm index 1112c5a9895437..4d3313f4ced83a 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]; // TODO(macOS GH#774) _label.lineBreakMode = NSLineBreakByCharWrapping; _label.numberOfLines = 0; _label.textAlignment = NSTextAlignmentCenter; - _label.textColor = [UIColor whiteColor]; + _label.textColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) _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..e984a091ca1228 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; // TODO(macOS GH#774) /** * 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..924b774b93d430 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; // TODO(macOS GH#774) 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 // TODO(macOS GH#774) { return _backgroundColor; } -- (void)setBackgroundColor:(UIColor *)backgroundColor +- (void)setBackgroundColor:(RCTUIColor *)backgroundColor // TODO(macOS GH#774) { _backgroundColor = backgroundColor; } @@ -203,13 +203,13 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & // `backgroundColor` if (oldViewProps.backgroundColor != newViewProps.backgroundColor) { - self.backgroundColor = RCTUIColorFromSharedColor(newViewProps.backgroundColor); + self.backgroundColor = RCTUIColorFromSharedColor(newViewProps.backgroundColor); // TODO(macOS GH#774) needsInvalidateLayer = YES; } // `foregroundColor` if (oldViewProps.foregroundColor != newViewProps.foregroundColor) { - self.foregroundColor = RCTUIColorFromSharedColor(newViewProps.foregroundColor); + self.foregroundColor = RCTUIColorFromSharedColor(newViewProps.foregroundColor); // TODO(macOS GH#774) } // `shadowColor` diff --git a/React/Fabric/RCTConversions.h b/React/Fabric/RCTConversions.h index 0f8e8e26df5f38..1c5fcdb403552f 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) // TODO(macOS GH#774) { if (!sharedColor) { return nil; } if (*facebook::react::clearColor() == *sharedColor) { - return [UIColor clearColor]; + return [RCTUIColor clearColor]; // TODO(macOS GH#774) } if (*facebook::react::blackColor() == *sharedColor) { - return [UIColor blackColor]; + return [RCTUIColor blackColor]; // TODO(macOS GH#774) } if (*facebook::react::whiteColor() == *sharedColor) { - return [UIColor whiteColor]; + return [RCTUIColor whiteColor]; // TODO(macOS GH#774) } 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]; // TODO(macOS GH#774) } 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..962d207fce1c82 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) // TODO(macOS GH#774) { 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]; // TODO(macOS GH#774) } -static UIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString) +static RCTUIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString) // TODO(macOS GH#774) { 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]) { // TODO(macOS GH#774) NSNumber *fallbackRGB = colorInfo[kFallbackARGBKey]; if (fallbackRGB) { return _UIColorFromHexValue(fallbackRGB); } } else { - Class uiColorClass = [UIColor class]; + Class uiColorClass = [RCTUIColor class]; // TODO(macOS GH#774) 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]]) { // TODO(macOS GH#774) 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) // TODO(macOS GH#774) { 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]; // TODO(macOS GH#774) 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..25b40502709080 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) // TODO(macOS GH#774) { - UIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [UIColor blackColor]; + RCTUIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [RCTUIColor blackColor]; // TODO(macOS GH#774) 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) // TODO(macOS GH#774) { - UIColor *effectiveBackgroundColor = RCTUIColorFromSharedColor(textAttributes.backgroundColor); + RCTUIColor *effectiveBackgroundColor = RCTUIColorFromSharedColor(textAttributes.backgroundColor); // TODO(macOS GH#774) if (effectiveBackgroundColor && !isnan(textAttributes.opacity)) { effectiveBackgroundColor = [effectiveBackgroundColor colorWithAlphaComponent:CGColorGetAlpha(effectiveBackgroundColor.CGColor) * textAttributes.opacity]; } - return effectiveBackgroundColor ?: [UIColor clearColor]; + return effectiveBackgroundColor ?: [RCTUIColor clearColor]; // TODO(macOS GH#774) } NSDictionary *RCTNSTextAttributesFromTextAttributes(TextAttributes const &textAttributes) @@ -118,7 +118,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex } // Colors - UIColor *effectiveForegroundColor = RCTEffectiveForegroundColorFromTextAttributes(textAttributes); + RCTUIColor *effectiveForegroundColor = RCTEffectiveForegroundColorFromTextAttributes(textAttributes); // TODO(macOS GH#774) 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); // TODO(macOS GH#774) // 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..3c8a154f80a4eb 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) // TODO(macOS GH#774) { if (!sharedColor) { return nil; } if (*facebook::react::clearColor() == *sharedColor) { - return [UIColor clearColor]; + return [RCTUIColor clearColor]; // TODO(macOS GH#774) } if (*facebook::react::blackColor() == *sharedColor) { - return [UIColor blackColor]; + return [RCTUIColor blackColor]; // TODO(macOS GH#774) } if (*facebook::react::whiteColor() == *sharedColor) { - return [UIColor whiteColor]; + return [RCTUIColor whiteColor]; // TODO(macOS GH#774) } 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]; // TODO(macOS GH#774) }