@@ -706,33 +706,43 @@ - (RCTCornerRadii)cornerRadii
706
706
};
707
707
}
708
708
709
- - (RCTBorderColors)borderColors
709
+ - (RCTBorderColors)borderColorsWithTraitCollection : (UITraitCollection *) traitCollection
710
710
{
711
711
const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
712
712
713
+ UIColor *directionAwareBorderLeftColor = nil ;
714
+ UIColor *directionAwareBorderRightColor = nil ;
715
+
713
716
if ([[RCTI18nUtil sharedInstance ] doLeftAndRightSwapInRTL ]) {
714
717
UIColor *borderStartColor = _borderStartColor ?: _borderLeftColor;
715
718
UIColor *borderEndColor = _borderEndColor ?: _borderRightColor;
716
719
717
- UIColor *directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor;
718
- UIColor *directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor;
719
-
720
- return (RCTBorderColors){
721
- (_borderTopColor ?: _borderColor).CGColor ,
722
- (directionAwareBorderLeftColor ?: _borderColor).CGColor ,
723
- (_borderBottomColor ?: _borderColor).CGColor ,
724
- (directionAwareBorderRightColor ?: _borderColor).CGColor ,
725
- };
720
+ directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor;
721
+ directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor;
722
+ } else {
723
+ directionAwareBorderLeftColor = (isRTL ? _borderEndColor : _borderStartColor) ?: _borderLeftColor;
724
+ directionAwareBorderRightColor = (isRTL ? _borderStartColor : _borderEndColor) ?: _borderRightColor;
726
725
}
727
726
728
- UIColor *directionAwareBorderLeftColor = isRTL ? _borderEndColor : _borderStartColor;
729
- UIColor *directionAwareBorderRightColor = isRTL ? _borderStartColor : _borderEndColor;
727
+ UIColor *borderColor = _borderColor;
728
+ UIColor *borderTopColor = _borderTopColor;
729
+ UIColor *borderBottomColor = _borderBottomColor;
730
+
731
+ #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
732
+ if (@available (iOS 13.0 , *)) {
733
+ borderColor = [borderColor resolvedColorWithTraitCollection: self .traitCollection];
734
+ borderTopColor = [borderTopColor resolvedColorWithTraitCollection: self .traitCollection];
735
+ directionAwareBorderLeftColor = [directionAwareBorderLeftColor resolvedColorWithTraitCollection: self .traitCollection];
736
+ borderBottomColor = [borderBottomColor resolvedColorWithTraitCollection: self .traitCollection];
737
+ directionAwareBorderRightColor = [directionAwareBorderRightColor resolvedColorWithTraitCollection: self .traitCollection];
738
+ }
739
+ #endif
730
740
731
741
return (RCTBorderColors){
732
- (_borderTopColor ?: _borderColor ).CGColor ,
733
- (directionAwareBorderLeftColor ?: _borderLeftColor ?: _borderColor ).CGColor ,
734
- (_borderBottomColor ?: _borderColor ).CGColor ,
735
- (directionAwareBorderRightColor ?: _borderRightColor ?: _borderColor ).CGColor ,
742
+ (borderTopColor ?: borderColor ).CGColor ,
743
+ (directionAwareBorderLeftColor ?: borderColor ).CGColor ,
744
+ (borderBottomColor ?: borderColor ).CGColor ,
745
+ (directionAwareBorderRightColor ?: borderColor ).CGColor ,
736
746
};
737
747
}
738
748
@@ -758,7 +768,7 @@ - (void)displayLayer:(CALayer *)layer
758
768
759
769
const RCTCornerRadii cornerRadii = [self cornerRadii ];
760
770
const UIEdgeInsets borderInsets = [self bordersAsInsets ];
761
- const RCTBorderColors borderColors = [self borderColors ];
771
+ const RCTBorderColors borderColors = [self borderColorsWithTraitCollection: self .traitCollection ];
762
772
763
773
BOOL useIOSBorderRendering = RCTCornerRadiiAreEqual (cornerRadii) && RCTBorderInsetsAreEqual (borderInsets) &&
764
774
RCTBorderColorsAreEqual (borderColors) && _borderStyle == RCTBorderStyleSolid &&
0 commit comments