Fabric: Implementation of bunch of trivial <View> props
Summary: Pretty straightforward. Reviewed By: fkgozali Differential Revision: D8344063 fbshipit-source-id: e6d35353cb3f3e374d2f2b723a612eda2d19c8b7
This commit is contained in:
parent
8bdc1ff10b
commit
3c8c01791f
|
@ -45,6 +45,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
*/
|
||||
@property (nonatomic, strong, nullable) NSString *nativeId;
|
||||
|
||||
/**
|
||||
* Provides access to `foregroundColor` prop of the component.
|
||||
* Must be used by subclasses only.
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) UIColor *foregroundColor;
|
||||
|
||||
/**
|
||||
* Insets used when hit testing inside this view.
|
||||
*/
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#import <fabric/view/ViewProps.h>
|
||||
#import <fabric/view/ViewEventEmitter.h>
|
||||
|
||||
#import "RCTConversions.h"
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
|
@ -56,8 +57,37 @@ using namespace facebook::react;
|
|||
auto oldViewProps = *std::dynamic_pointer_cast<const ViewProps>(oldProps);
|
||||
auto newViewProps = *std::dynamic_pointer_cast<const ViewProps>(props);
|
||||
|
||||
// `opacity`
|
||||
if (oldViewProps.opacity != newViewProps.opacity) {
|
||||
self.layer.opacity = (CGFloat)newViewProps.opacity;
|
||||
}
|
||||
|
||||
// `backgroundColor`
|
||||
if (oldViewProps.backgroundColor != newViewProps.backgroundColor) {
|
||||
self.backgroundColor = [UIColor colorWithCGColor:newViewProps.backgroundColor.get()];
|
||||
self.backgroundColor = RCTUIColorFromSharedColor(newViewProps.backgroundColor);
|
||||
}
|
||||
|
||||
// `foregroundColor`
|
||||
if (oldViewProps.foregroundColor != newViewProps.foregroundColor) {
|
||||
self.foregroundColor = RCTUIColorFromSharedColor(newViewProps.foregroundColor);
|
||||
}
|
||||
|
||||
// `backfaceVisibility`
|
||||
if (oldViewProps.backfaceVisibility != newViewProps.backfaceVisibility) {
|
||||
self.layer.doubleSided = newViewProps.backfaceVisibility;
|
||||
}
|
||||
|
||||
// `shouldRasterize`
|
||||
if (oldViewProps.shouldRasterize != newViewProps.shouldRasterize) {
|
||||
self.layer.shouldRasterize = newViewProps.shouldRasterize;
|
||||
self.layer.rasterizationScale = newViewProps.shouldRasterize ? [UIScreen mainScreen].scale : 1.0;
|
||||
}
|
||||
|
||||
// `pointerEvents`
|
||||
if (oldViewProps.pointerEvents != newViewProps.pointerEvents) {
|
||||
self.userInteractionEnabled = newViewProps.pointerEvents != PointerEventsMode::None;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Implement all sutable non-layout <View> props.
|
||||
|
@ -66,6 +96,11 @@ using namespace facebook::react;
|
|||
self.hitTestEdgeInsets = RCTUIEdgeInsetsFromEdgeInsets(newViewProps.hitSlop);
|
||||
}
|
||||
|
||||
// `zIndex`
|
||||
if (oldViewProps.zIndex != newViewProps.zIndex) {
|
||||
self.layer.zPosition = (CGFloat)newViewProps.zIndex;
|
||||
}
|
||||
|
||||
// `nativeId`
|
||||
if (oldViewProps.nativeId != newViewProps.nativeId) {
|
||||
self.nativeId = [NSString stringWithCString:newViewProps.nativeId.c_str()
|
||||
|
|
Loading…
Reference in New Issue