Fabric: Using RCTUIColorFromSharedColor everywhere
Summary: Even though we have wonderful helper functions converting SharedColor to UIColor and CGColorRef, in many places we still use some hardcoded things. This diff fixes that; it will be important for the next diff. Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross Differential Revision: D23753508 fbshipit-source-id: 09d280b132266252753526c2735ab3e41b96c8d5
This commit is contained in:
Родитель
f2ca6f568e
Коммит
d3bb76b8b6
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#import "RCTActivityIndicatorViewComponentView.h"
|
#import "RCTActivityIndicatorViewComponentView.h"
|
||||||
|
|
||||||
|
#import <React/RCTConversions.h>
|
||||||
|
|
||||||
#import <react/renderer/components/rncore/ComponentDescriptors.h>
|
#import <react/renderer/components/rncore/ComponentDescriptors.h>
|
||||||
#import <react/renderer/components/rncore/EventEmitters.h>
|
#import <react/renderer/components/rncore/EventEmitters.h>
|
||||||
#import <react/renderer/components/rncore/Props.h>
|
#import <react/renderer/components/rncore/Props.h>
|
||||||
|
@ -50,7 +52,7 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti
|
||||||
} else {
|
} else {
|
||||||
[_activityIndicatorView stopAnimating];
|
[_activityIndicatorView stopAnimating];
|
||||||
}
|
}
|
||||||
_activityIndicatorView.color = [UIColor colorWithCGColor:defaultProps->color.get()];
|
_activityIndicatorView.color = RCTUIColorFromSharedColor(defaultProps->color);
|
||||||
_activityIndicatorView.hidesWhenStopped = defaultProps->hidesWhenStopped;
|
_activityIndicatorView.hidesWhenStopped = defaultProps->hidesWhenStopped;
|
||||||
_activityIndicatorView.activityIndicatorViewStyle = convertActivityIndicatorViewStyle(defaultProps->size);
|
_activityIndicatorView.activityIndicatorViewStyle = convertActivityIndicatorViewStyle(defaultProps->size);
|
||||||
|
|
||||||
|
@ -73,8 +75,8 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldViewProps.color.get() != newViewProps.color.get()) {
|
if (oldViewProps.color != newViewProps.color) {
|
||||||
_activityIndicatorView.color = [UIColor colorWithCGColor:newViewProps.color.get()];
|
_activityIndicatorView.color = RCTUIColorFromSharedColor(newViewProps.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This prop should be deprecated.
|
// TODO: This prop should be deprecated.
|
||||||
|
|
|
@ -74,7 +74,7 @@ using namespace facebook::react;
|
||||||
|
|
||||||
// `tintColor`
|
// `tintColor`
|
||||||
if (oldImageProps.tintColor != newImageProps.tintColor) {
|
if (oldImageProps.tintColor != newImageProps.tintColor) {
|
||||||
_imageView.tintColor = [UIColor colorWithCGColor:newImageProps.tintColor.get()];
|
_imageView.tintColor = RCTUIColorFromSharedColor(newImageProps.tintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
[super updateProps:props oldProps:oldProps];
|
[super updateProps:props oldProps:oldProps];
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
|
|
||||||
#import "RCTSliderComponentView.h"
|
#import "RCTSliderComponentView.h"
|
||||||
|
|
||||||
|
#import <React/RCTConversions.h>
|
||||||
#import <React/RCTImageResponseDelegate.h>
|
#import <React/RCTImageResponseDelegate.h>
|
||||||
#import <React/RCTImageResponseObserverProxy.h>
|
#import <React/RCTImageResponseObserverProxy.h>
|
||||||
|
|
||||||
#import <react/renderer/components/rncore/EventEmitters.h>
|
#import <react/renderer/components/rncore/EventEmitters.h>
|
||||||
#import <react/renderer/components/rncore/Props.h>
|
#import <react/renderer/components/rncore/Props.h>
|
||||||
#import <react/renderer/components/slider/SliderComponentDescriptor.h>
|
#import <react/renderer/components/slider/SliderComponentDescriptor.h>
|
||||||
|
@ -131,17 +133,17 @@ using namespace facebook::react;
|
||||||
|
|
||||||
// `thumbTintColor`
|
// `thumbTintColor`
|
||||||
if (oldSliderProps.thumbTintColor != newSliderProps.thumbTintColor) {
|
if (oldSliderProps.thumbTintColor != newSliderProps.thumbTintColor) {
|
||||||
_sliderView.thumbTintColor = [UIColor colorWithCGColor:newSliderProps.thumbTintColor.get()];
|
_sliderView.thumbTintColor = RCTUIColorFromSharedColor(newSliderProps.thumbTintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `minimumTrackTintColor`
|
// `minimumTrackTintColor`
|
||||||
if (oldSliderProps.minimumTrackTintColor != newSliderProps.minimumTrackTintColor) {
|
if (oldSliderProps.minimumTrackTintColor != newSliderProps.minimumTrackTintColor) {
|
||||||
_sliderView.minimumTrackTintColor = [UIColor colorWithCGColor:newSliderProps.minimumTrackTintColor.get()];
|
_sliderView.minimumTrackTintColor = RCTUIColorFromSharedColor(newSliderProps.minimumTrackTintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `maximumTrackTintColor`
|
// `maximumTrackTintColor`
|
||||||
if (oldSliderProps.maximumTrackTintColor != newSliderProps.maximumTrackTintColor) {
|
if (oldSliderProps.maximumTrackTintColor != newSliderProps.maximumTrackTintColor) {
|
||||||
_sliderView.maximumTrackTintColor = [UIColor colorWithCGColor:newSliderProps.maximumTrackTintColor.get()];
|
_sliderView.maximumTrackTintColor = RCTUIColorFromSharedColor(newSliderProps.maximumTrackTintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
[super updateProps:props oldProps:oldProps];
|
[super updateProps:props oldProps:oldProps];
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#import "RCTSwitchComponentView.h"
|
#import "RCTSwitchComponentView.h"
|
||||||
|
|
||||||
|
#import <React/RCTConversions.h>
|
||||||
|
|
||||||
#import <react/renderer/components/rncore/ComponentDescriptors.h>
|
#import <react/renderer/components/rncore/ComponentDescriptors.h>
|
||||||
#import <react/renderer/components/rncore/EventEmitters.h>
|
#import <react/renderer/components/rncore/EventEmitters.h>
|
||||||
#import <react/renderer/components/rncore/Props.h>
|
#import <react/renderer/components/rncore/Props.h>
|
||||||
|
@ -75,17 +77,17 @@ using namespace facebook::react;
|
||||||
|
|
||||||
// `tintColor`
|
// `tintColor`
|
||||||
if (oldSwitchProps.tintColor != newSwitchProps.tintColor) {
|
if (oldSwitchProps.tintColor != newSwitchProps.tintColor) {
|
||||||
_switchView.tintColor = [UIColor colorWithCGColor:newSwitchProps.tintColor.get()];
|
_switchView.tintColor = RCTUIColorFromSharedColor(newSwitchProps.tintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `onTintColor
|
// `onTintColor
|
||||||
if (oldSwitchProps.onTintColor != newSwitchProps.onTintColor) {
|
if (oldSwitchProps.onTintColor != newSwitchProps.onTintColor) {
|
||||||
_switchView.onTintColor = [UIColor colorWithCGColor:newSwitchProps.onTintColor.get()];
|
_switchView.onTintColor = RCTUIColorFromSharedColor(newSwitchProps.onTintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `thumbTintColor`
|
// `thumbTintColor`
|
||||||
if (oldSwitchProps.thumbTintColor != newSwitchProps.thumbTintColor) {
|
if (oldSwitchProps.thumbTintColor != newSwitchProps.thumbTintColor) {
|
||||||
_switchView.thumbTintColor = [UIColor colorWithCGColor:newSwitchProps.thumbTintColor.get()];
|
_switchView.thumbTintColor = RCTUIColorFromSharedColor(newSwitchProps.thumbTintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
[super updateProps:props oldProps:oldProps];
|
[super updateProps:props oldProps:oldProps];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче