mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Problem: In Paper rendering system, view managers are native modules that are created and retained by the bridge. Whenever rendering layer needs to create a view, it asks the bridge for the view manager. In bridgeless mode, these view managers are never created. Solution: In bridgeless mode, let `RCTComponentData` create and retain a view manager. Having a 1:1 relationship of `RCTComponentData`:`ViewManager` is desirable, since their lifecycles should be similar. This implementation also maintains the lazy-instantiation behavior for bridgeless view managers. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D27375991 fbshipit-source-id: e76d966ba4b98972a49df1bc520b904fb2f4b3b5
47 lines
1.5 KiB
Objective-C
47 lines
1.5 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 <Foundation/Foundation.h>
|
|
|
|
#import <React/RCTComponent.h>
|
|
#import <React/RCTDefines.h>
|
|
#import <React/RCTViewManager.h>
|
|
|
|
@class RCTBridge;
|
|
@class RCTShadowView;
|
|
@class UIView;
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface RCTComponentData : NSObject
|
|
|
|
@property (nonatomic, readonly) Class managerClass;
|
|
@property (nonatomic, copy, readonly) NSString *name;
|
|
@property (nonatomic, weak, readonly) RCTViewManager *manager;
|
|
/*
|
|
* When running React Native with the bridge, view managers are retained by the
|
|
* bridge. When running in bridgeless mode, allocate and retain view managers
|
|
* in this class.
|
|
*/
|
|
@property (nonatomic, strong, readonly) RCTViewManager *bridgelessViewManager;
|
|
|
|
- (instancetype)initWithManagerClass:(Class)managerClass bridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
|
|
|
|
- (UIView *)createViewWithTag:(nullable NSNumber *)tag rootTag:(nullable NSNumber *)rootTag;
|
|
- (RCTShadowView *)createShadowViewWithTag:(NSNumber *)tag;
|
|
- (void)setProps:(NSDictionary<NSString *, id> *)props forView:(id<RCTComponent>)view;
|
|
- (void)setProps:(NSDictionary<NSString *, id> *)props forShadowView:(RCTShadowView *)shadowView;
|
|
|
|
@property (nonatomic, copy, nullable) void (^eventInterceptor)
|
|
(NSString *eventName, NSDictionary *event, NSNumber *reactTag);
|
|
|
|
- (NSDictionary<NSString *, id> *)viewConfig;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|