mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Summary: * Now all `RCTViewComponentView` subclasses are required to set `_props` instance variable in the constructor with a default value; * `RCTViewComponentView`'s `_props` instance variable now has `ShadredViewProps` type (that enforced by `static_assert` in `ConcreteViewShadowNode` template); * New we use `static_pointer_cast` instead of `dynamic_pointer_cast` for casting props. Reviewed By: mdvacca Differential Revision: D9734199 fbshipit-source-id: b0a0939c936f8b5b540fa5fa1e4a2f1037346fc5
74 lines
2.3 KiB
Objective-C
74 lines
2.3 KiB
Objective-C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* 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/RCTComponentViewProtocol.h>
|
|
#import <React/UIView+ComponentViewProtocol.h>
|
|
#import <fabric/core/LayoutMetrics.h>
|
|
#import <fabric/core/Props.h>
|
|
#import <fabric/components/view/ViewEventEmitter.h>
|
|
#import <fabric/components/view/ViewProps.h>
|
|
#import <fabric/events/EventEmitter.h>
|
|
#import <React/RCTTouchableComponentViewProtocol.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
/**
|
|
* UIView class for <View> component.
|
|
*/
|
|
@interface RCTViewComponentView : UIView <RCTComponentViewProtocol, RCTTouchableComponentViewProtocol> {
|
|
@protected
|
|
facebook::react::LayoutMetrics _layoutMetrics;
|
|
facebook::react::SharedViewProps _props;
|
|
facebook::react::SharedViewEventEmitter _eventEmitter;
|
|
}
|
|
|
|
/**
|
|
* Represents the `UIView` instance that is being automatically attached to
|
|
* the component view and laid out using on `layoutMetrics` (especially `size`
|
|
* and `padding`) of the component.
|
|
* This view must not be a component view; it's just a convenient way
|
|
* to embed/bridge pure native views as component views.
|
|
* Defaults to `nil`. Assing `nil` to remove view as subview.
|
|
*/
|
|
@property (nonatomic, strong, nullable) UIView *contentView;
|
|
|
|
/**
|
|
* Provides access to `nativeId` prop of the component.
|
|
* It might be used by subclasses (which need to refer to the view from
|
|
* other platform-specific external views or systems by some id) or
|
|
* by debugging/inspection tools.
|
|
* Defaults to `nil`.
|
|
*/
|
|
@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;
|
|
|
|
/**
|
|
* Returns the object - usually (sub)view - which represents this
|
|
* component view in terms of accessibility.
|
|
* All accessibility properties will be applied to this object.
|
|
* May be overridden in subclass which needs to be accessiblitywise
|
|
* transparent in favour of some subview.
|
|
* Defaults to `self`.
|
|
*/
|
|
@property (nonatomic, strong, nullable, readonly) NSObject *accessibilityElement;
|
|
|
|
/**
|
|
* Insets used when hit testing inside this view.
|
|
*/
|
|
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|