Skip to content

Commit ab45509

Browse files
fkgozalifacebook-github-bot
authored andcommitted
iOS: adding a few warning/enforcement for the new architecture
Summary: In the full bridgeless, the following aren't allowed: * using legacy view manager interop layer (won't support long term, but still needed today, so just warn) * initializing any subclass of RCTViewManager (won't support long term, but still used by legacy interop layer) * initializing RCTUIManager (fabric UIManager should be the only one used) Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D28111530 fbshipit-source-id: 4f5eab600c6c7896d51861545b7f878c25248e44
1 parent da899c0 commit ab45509

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#import "RCTLegacyViewManagerInteropComponentView.h"
99

10+
#import <React/RCTAssert.h>
1011
#import <React/UIView+React.h>
1112
#import <react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h>
1213
#import <react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h>
@@ -28,6 +29,8 @@ @implementation RCTLegacyViewManagerInteropComponentView {
2829
- (instancetype)initWithFrame:(CGRect)frame
2930
{
3031
if (self = [super initWithFrame:frame]) {
32+
RCTWarnNotAllowedForNewArchitecture(
33+
self, @"ViewManager with interop layer is not allowed in the new architecture.");
3134
static const auto defaultProps = std::make_shared<const LegacyViewManagerInteropViewProps>();
3235
_props = defaultProps;
3336
_viewsToBeMounted = [NSMutableArray new];

React/Modules/RCTUIManager.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ - (NSMapTable *)nativeIDRegistry
147147

148148
- (void)setBridge:(RCTBridge *)bridge
149149
{
150+
RCTEnforceNotAllowedForNewArchitecture(self, @"RCTUIManager must not be initialized for the new architecture");
151+
150152
RCTAssert(_bridge == nil, @"Should not re-use same UIManager instance");
151153
_bridge = bridge;
152154

React/Views/RCTViewManager.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#import "RCTViewManager.h"
99

10+
#import "RCTAssert.h"
1011
#import "RCTBorderStyle.h"
1112
#import "RCTBridge.h"
1213
#import "RCTConvert+Transform.h"
@@ -77,6 +78,12 @@ - (dispatch_queue_t)methodQueue
7778
return RCTGetUIManagerQueue();
7879
}
7980

81+
- (void)setBridge:(RCTBridge *)bridge
82+
{
83+
RCTWarnNotAllowedForNewArchitecture(self, @"RCTViewManager must not be initialized for the new architecture");
84+
_bridge = bridge;
85+
}
86+
8087
- (UIView *)view
8188
{
8289
return [RCTView new];

0 commit comments

Comments
 (0)