mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
c974cbff04
Summary: # See PR https://github.com/facebook/react-native/pull/29728 # From PR Author Using `PlatformColor` with border colors doesn't work currently when switching dark mode as the information is lost when converting to `CGColor`. This change keeps the border colors around as `UIColor` so switching to dark mode works. ```ts <View style={{ borderColor: DynamicColorIOS({ dark: "yellow", light: "red" }), borderWidth: 1, }} > ... </View> ``` This view will start with a red border (assuming light mode when started), but will not change to a yellow border when switching to dark mode. With this PR, the border color will be correctly set to yellow. ## Changelog [iOS] [Fixed] - Allow PlatformColor to work with border colors Pull Request resolved: https://github.com/facebook/react-native/pull/29728 Test Plan: 1. Assign a `PlatformColor` or `DynamicColorIOS` to a view border color. 2. Toggle between dark / light mode. See the colors change. Reviewed By: lunaleaps Differential Revision: D29268376 Pulled By: p-sun fbshipit-source-id: 586545b05be0beb0e6e5ace6e3f74b304620ad94
115 lines
3.7 KiB
Objective-C
115 lines
3.7 KiB
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <React/RCTBorderStyle.h>
|
|
#import <React/RCTComponent.h>
|
|
#import <React/RCTPointerEvents.h>
|
|
#import <React/RCTView.h>
|
|
|
|
extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
|
@protocol RCTAutoInsetsProtocol;
|
|
|
|
@class RCTView;
|
|
|
|
@interface RCTView : UIView
|
|
|
|
/**
|
|
* Accessibility event handlers
|
|
*/
|
|
@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityAction;
|
|
@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityTap;
|
|
@property (nonatomic, copy) RCTDirectEventBlock onMagicTap;
|
|
@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityEscape;
|
|
|
|
/**
|
|
* Used to control how touch events are processed.
|
|
*/
|
|
@property (nonatomic, assign) RCTPointerEvents pointerEvents;
|
|
|
|
+ (void)autoAdjustInsetsForView:(UIView<RCTAutoInsetsProtocol> *)parentView
|
|
withScrollView:(UIScrollView *)scrollView
|
|
updateOffset:(BOOL)updateOffset;
|
|
|
|
/**
|
|
* Find the first view controller whose view, or any subview is the specified view.
|
|
*/
|
|
+ (UIEdgeInsets)contentInsetsForView:(UIView *)curView;
|
|
|
|
/**
|
|
* Layout direction of the view.
|
|
* This is inherited from UIView+React, but we override it here
|
|
* to improve performance and make subclassing/overriding possible/easier.
|
|
*/
|
|
@property (nonatomic, assign) UIUserInterfaceLayoutDirection reactLayoutDirection;
|
|
|
|
/**
|
|
* This is an optimization used to improve performance
|
|
* for large scrolling views with many subviews, such as a
|
|
* list or table. If set to YES, any clipped subviews will
|
|
* be removed from the view hierarchy whenever -updateClippedSubviews
|
|
* is called. This would typically be triggered by a scroll event
|
|
*/
|
|
@property (nonatomic, assign) BOOL removeClippedSubviews;
|
|
|
|
/**
|
|
* Hide subviews if they are outside the view bounds.
|
|
* This is an optimisation used predominantly with RKScrollViews
|
|
* but it is applied recursively to all subviews that have
|
|
* removeClippedSubviews set to YES
|
|
*/
|
|
- (void)updateClippedSubviews;
|
|
|
|
/**
|
|
* Border radii.
|
|
*/
|
|
@property (nonatomic, assign) CGFloat borderRadius;
|
|
@property (nonatomic, assign) CGFloat borderTopLeftRadius;
|
|
@property (nonatomic, assign) CGFloat borderTopRightRadius;
|
|
@property (nonatomic, assign) CGFloat borderTopStartRadius;
|
|
@property (nonatomic, assign) CGFloat borderTopEndRadius;
|
|
@property (nonatomic, assign) CGFloat borderBottomLeftRadius;
|
|
@property (nonatomic, assign) CGFloat borderBottomRightRadius;
|
|
@property (nonatomic, assign) CGFloat borderBottomStartRadius;
|
|
@property (nonatomic, assign) CGFloat borderBottomEndRadius;
|
|
|
|
/**
|
|
* Border colors (actually retained).
|
|
*/
|
|
@property (nonatomic, strong) UIColor *borderTopColor;
|
|
@property (nonatomic, strong) UIColor *borderRightColor;
|
|
@property (nonatomic, strong) UIColor *borderBottomColor;
|
|
@property (nonatomic, strong) UIColor *borderLeftColor;
|
|
@property (nonatomic, strong) UIColor *borderStartColor;
|
|
@property (nonatomic, strong) UIColor *borderEndColor;
|
|
@property (nonatomic, strong) UIColor *borderColor;
|
|
|
|
/**
|
|
* Border widths.
|
|
*/
|
|
@property (nonatomic, assign) CGFloat borderTopWidth;
|
|
@property (nonatomic, assign) CGFloat borderRightWidth;
|
|
@property (nonatomic, assign) CGFloat borderBottomWidth;
|
|
@property (nonatomic, assign) CGFloat borderLeftWidth;
|
|
@property (nonatomic, assign) CGFloat borderStartWidth;
|
|
@property (nonatomic, assign) CGFloat borderEndWidth;
|
|
@property (nonatomic, assign) CGFloat borderWidth;
|
|
|
|
/**
|
|
* Border styles.
|
|
*/
|
|
@property (nonatomic, assign) RCTBorderStyle borderStyle;
|
|
|
|
/**
|
|
* Insets used when hit testing inside this view.
|
|
*/
|
|
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
|
|
|
|
@end
|