Skip to content

Commit 48d1538

Browse files
sgaczolCopilot
andauthored
chore(iOS, Stack): remove legacy architecture related code (#3788)
## Description This PR removes legacy architecture related code from Stack related files. NOTE: Public headers in the RNScreens module are processed by the Clang dependency scanner without any preprocessor defines. Previously, `RCT_NEW_ARCH_ENABLED` guards shielded the scanner from C++ headers by falling through to the Paper (ObjC-only) branches. With Paper code removed, the scanner now hits C++ headers unconditionally and fails on <atomic> and other C++ stdlib headers. This PR guards C++ content (imports, namespaces, LayoutMetrics, method signatures) with `#if defined(__cplusplus)`. Closes https://github.com/issues/assigned?issue=software-mansion%7Creact-native-screens-labs%7C1035 ## Changes - remove `#ifdef RCT_NEW_ARCH_ENABLED` guards (replace them with `#if defined(__cplusplus)` when needed) - remove methods not used on Fabric architecture - provides minimal `UIView` fallbacks for the scanner - remove Paper-only imports ## After - visual documentation https://github.com/user-attachments/assets/c4471a88-f081-40e7-a6c2-27d940cdd599 ## Test plan Check if app builds and tests for Stack work correctly. ## Checklist - [ ] Included code example that can be used to test this change. - [ ] Updated / created local changelog entries in relevant test files. - [ ] For visual changes, included screenshots / GIFs / recordings documenting the change. - [ ] For API changes, updated relevant public types. - [x] Ensured that CI passes --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 5357fb1 commit 48d1538

32 files changed

Lines changed: 88 additions & 1329 deletions

ios/RCTConvert+RNScreens.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
#pragma once
22

3-
#if !RCT_NEW_ARCH_ENABLED
4-
5-
#import <React/RCTConvert.h>
6-
7-
NS_ASSUME_NONNULL_BEGIN
8-
9-
@interface RCTConvert (RNScreens)
10-
11-
@end
12-
13-
NS_ASSUME_NONNULL_END
14-
15-
#endif // !RCT_NEW_ARCH_ENABLED
3+
// This file is intentionally empty — all content was Paper-only and has been
4+
// removed as part of the Paper architecture removal. The file will be deleted
5+
// at the very end of the removal.

ios/RCTConvert+RNScreens.mm

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,4 @@
11
#import "RCTConvert+RNScreens.h"
22

3-
#if !RCT_NEW_ARCH_ENABLED
4-
5-
#import "RNSEnums.h"
6-
7-
@implementation RCTConvert (RNScreens)
8-
9-
+ (NSMutableDictionary *)blurEffectsForIOSVersion
10-
{
11-
NSMutableDictionary *blurEffects = [NSMutableDictionary new];
12-
[blurEffects addEntriesFromDictionary:@{
13-
@"none" : @(RNSBlurEffectStyleNone),
14-
@"systemDefault" : @(RNSBlurEffectStyleSystemDefault),
15-
@"extraLight" : @(RNSBlurEffectStyleExtraLight),
16-
@"light" : @(RNSBlurEffectStyleLight),
17-
@"dark" : @(RNSBlurEffectStyleDark),
18-
@"regular" : @(RNSBlurEffectStyleRegular),
19-
@"prominent" : @(RNSBlurEffectStyleProminent),
20-
}];
21-
22-
#if !TARGET_OS_TV
23-
[blurEffects addEntriesFromDictionary:@{
24-
@"systemUltraThinMaterial" : @(RNSBlurEffectStyleSystemUltraThinMaterial),
25-
@"systemThinMaterial" : @(RNSBlurEffectStyleSystemThinMaterial),
26-
@"systemMaterial" : @(RNSBlurEffectStyleSystemMaterial),
27-
@"systemThickMaterial" : @(RNSBlurEffectStyleSystemThickMaterial),
28-
@"systemChromeMaterial" : @(RNSBlurEffectStyleSystemChromeMaterial),
29-
@"systemUltraThinMaterialLight" : @(RNSBlurEffectStyleSystemUltraThinMaterialLight),
30-
@"systemThinMaterialLight" : @(RNSBlurEffectStyleSystemThinMaterialLight),
31-
@"systemMaterialLight" : @(RNSBlurEffectStyleSystemMaterialLight),
32-
@"systemThickMaterialLight" : @(RNSBlurEffectStyleSystemThickMaterialLight),
33-
@"systemChromeMaterialLight" : @(RNSBlurEffectStyleSystemChromeMaterialLight),
34-
@"systemUltraThinMaterialDark" : @(RNSBlurEffectStyleSystemUltraThinMaterialDark),
35-
@"systemThinMaterialDark" : @(RNSBlurEffectStyleSystemThinMaterialDark),
36-
@"systemMaterialDark" : @(RNSBlurEffectStyleSystemMaterialDark),
37-
@"systemThickMaterialDark" : @(RNSBlurEffectStyleSystemThickMaterialDark),
38-
@"systemChromeMaterialDark" : @(RNSBlurEffectStyleSystemChromeMaterialDark),
39-
}];
40-
#endif
41-
return blurEffects;
42-
}
43-
44-
RCT_ENUM_CONVERTER(RNSBlurEffectStyle, ([self blurEffectsForIOSVersion]), RNSBlurEffectStyleSystemDefault, integerValue)
45-
46-
RCT_ENUM_CONVERTER(
47-
RNSOptionalBoolean,
48-
(@{
49-
@"undefined" : @(RNSOptionalBooleanUndefined),
50-
@"true" : @(RNSOptionalBooleanTrue),
51-
@"false" : @(RNSOptionalBooleanFalse),
52-
}),
53-
RNSOptionalBooleanUndefined,
54-
integerValue)
55-
56-
RCT_ENUM_CONVERTER(
57-
RNSScrollEdgeEffect,
58-
(@{
59-
@"automatic" : @(RNSScrollEdgeEffectAutomatic),
60-
@"hard" : @(RNSScrollEdgeEffectHard),
61-
@"soft" : @(RNSScrollEdgeEffectSoft),
62-
@"hidden" : @(RNSScrollEdgeEffectHidden),
63-
}),
64-
RNSScrollEdgeEffectAutomatic,
65-
integerValue)
66-
67-
@end
68-
69-
#endif // !RCT_NEW_ARCH_ENABLED
3+
// This file is intentionally empty — all content was Paper-only and has been removed
4+
// as part of the Paper architecture removal. The file will be deleted at the very end of the removal.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#ifdef RCT_NEW_ARCH_ENABLED
3+
#if defined(__cplusplus)
44

55
#include <React/RCTImageComponentView.h>
66

@@ -10,4 +10,4 @@
1010

1111
@end
1212

13-
#endif // RCT_NEW_ARCH_ENABLED
13+
#endif // __cplusplus
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#ifdef RCT_NEW_ARCH_ENABLED
2-
31
#include "RCTImageComponentView+RNSScreenStackHeaderConfig.h"
42

53
@implementation RCTImageComponentView (RNSScreenStackHeaderConfig)
@@ -10,5 +8,3 @@ - (UIImage *)image
108
}
119

1210
@end
13-
14-
#endif // RCT_NEW_ARCH_ENABLED

ios/RNSConvert.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#pragma once
22

33
#import <UIKit/UIKit.h>
4-
#ifdef RCT_NEW_ARCH_ENABLED
4+
#if defined(__cplusplus)
55
#import <react/renderer/components/rnscreens/Props.h>
6-
#endif // RCT_NEW_ARCH_ENABLED
6+
#endif // __cplusplus
77
#import "RNSEnums.h"
88

9-
#ifdef RCT_NEW_ARCH_ENABLED
9+
#if defined(__cplusplus)
1010
namespace react = facebook::react;
11-
#endif // RCT_NEW_ARCH_ENABLED
11+
#endif // __cplusplus
1212

1313
@interface RNSConvert : NSObject
1414

15-
#ifdef RCT_NEW_ARCH_ENABLED
15+
#if defined(__cplusplus)
1616

1717
+ (UISemanticContentAttribute)UISemanticContentAttributeFromCppEquivalent:
1818
(react::RNSScreenStackHeaderConfigDirection)direction;
@@ -71,7 +71,7 @@ namespace react = facebook::react;
7171
(react::RNSScreenTopScrollEdgeEffect)edgeEffect;
7272
+ (id)idFromFollyDynamic:(const folly::dynamic &)dyn;
7373

74-
#endif // RCT_NEW_ARCH_ENABLED
74+
#endif // __cplusplus
7575

7676
/// This method fails (by assertion) when `blurEffect == RNSBlurEffectStyleNone` or `blurEffect ==
7777
/// RNSBlurEffectStyleSystemDefault` which have no counter parts in the UIKit types.

ios/RNSConvert.mm

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#import "RNSConvert.h"
22
#import <React/RCTLog.h>
33

4-
#ifndef RCT_NEW_ARCH_ENABLED
5-
#import <React/RCTAssert.h>
6-
#endif // !RCT_NEW_ARCH_ENABLED
7-
84
@implementation RNSConvert
9-
10-
#ifdef RCT_NEW_ARCH_ENABLED
115
+ (UISemanticContentAttribute)UISemanticContentAttributeFromCppEquivalent:
126
(react::RNSScreenStackHeaderConfigDirection)direction
137
{
@@ -386,17 +380,9 @@ + (id)idFromFollyDynamic:(const folly::dynamic &)dyn
386380
return nil;
387381
}
388382

389-
#endif // RCT_NEW_ARCH_ENABLED
390-
391383
+ (UIBlurEffectStyle)tryConvertRNSBlurEffectStyleToUIBlurEffectStyle:(RNSBlurEffectStyle)blurEffect
392384
{
393-
#ifdef RCT_NEW_ARCH_ENABLED
394385
react_native_assert(blurEffect != RNSBlurEffectStyleNone && blurEffect != RNSBlurEffectStyleSystemDefault);
395-
#else
396-
RCTAssert(
397-
blurEffect != RNSBlurEffectStyleNone && blurEffect != RNSBlurEffectStyleSystemDefault,
398-
@"RNSBlurEffectStyleNone and RNSBlurEffectStyleSystemDefault variants are not convertible to UIBlurEffectStyle");
399-
#endif // RCT_NEW_ARCH_ENABLED
400386

401387
// Cast safety: RNSBlurEffectStyle is defined in such way that its values map 1:1 with
402388
// UIBlurEffectStyle, except RNSBlurEffectStyleNone and RNSBlurEffectStyleSystemDefault which are excluded above.

ios/RNSFullWindowOverlay.h

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
#pragma once
22

33
#import <React/RCTViewManager.h>
4+
#import "RNSReactBaseView.h"
45

5-
#ifdef RCT_NEW_ARCH_ENABLED
6-
#import <React/RCTViewComponentView.h>
7-
#else
8-
#import <React/RCTInvalidating.h>
9-
#import <React/RCTView.h>
10-
#endif
11-
12-
#ifdef RCT_NEW_ARCH_ENABLED
6+
#if defined(__cplusplus)
137
namespace react = facebook::react;
14-
#endif // RCT_NEW_ARCH_ENABLED
8+
#endif // __cplusplus
159

1610
@interface RNSFullWindowOverlayManager : RCTViewManager
1711

@@ -21,18 +15,13 @@ namespace react = facebook::react;
2115

2216
@end
2317

24-
@interface RNSFullWindowOverlay :
25-
#ifdef RCT_NEW_ARCH_ENABLED
26-
RCTViewComponentView
27-
#else
28-
RCTView <RCTInvalidating>
29-
#endif // RCT_NEW_ARCH_ENABLED
18+
@interface RNSFullWindowOverlay : RNSReactBaseView
3019

3120
@property (nonatomic) BOOL accessibilityContainerViewIsModal;
3221

33-
#ifdef RCT_NEW_ARCH_ENABLED
22+
#if defined(__cplusplus)
3423
@property (nonatomic) react::LayoutMetrics oldLayoutMetrics;
3524
@property (nonatomic) react::LayoutMetrics newLayoutMetrics;
36-
#endif // RCT_NEW_ARCH_ENABLED
25+
#endif // __cplusplus
3726

3827
@end

ios/RNSFullWindowOverlay.mm

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
#import "RNSDefines.h"
44
#import "RNSFullWindowOverlay.h"
55

6-
#ifdef RCT_NEW_ARCH_ENABLED
76
#import <React/RCTConversions.h>
87
#import <React/RCTFabricComponentsPlugins.h>
98
#import <React/RCTSurfaceTouchHandler.h>
109
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
1110
#import <react/renderer/components/rnscreens/Props.h>
1211
#import <react/renderer/components/rnscreens/RCTComponentViewHelpers.h>
1312
#import <rnscreens/RNSFullWindowOverlayComponentDescriptor.h>
14-
#else
15-
#import <React/RCTTouchHandler.h>
16-
#endif // RCT_NEW_ARCH_ENABLED
1713

1814
@implementation RNSFullWindowOverlayContainer
1915

@@ -70,14 +66,9 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
7066
@end
7167

7268
@implementation RNSFullWindowOverlay {
73-
__weak RCTBridge *_bridge;
7469
RNSFullWindowOverlayContainer *_container;
7570
CGRect _reactFrame;
76-
#ifdef RCT_NEW_ARCH_ENABLED
7771
RCTSurfaceTouchHandler *_touchHandler;
78-
#else
79-
RCTTouchHandler *_touchHandler;
80-
#endif // RCT_NEW_ARCH_ENABLED
8172
}
8273

8374
// Needed because of this: https://github.com/facebook/react-native/pull/37274
@@ -86,7 +77,6 @@ + (void)load
8677
[super load];
8778
}
8879

89-
#ifdef RCT_NEW_ARCH_ENABLED
9080
- (instancetype)init
9181
{
9282
if (self = [super init]) {
@@ -96,17 +86,6 @@ - (instancetype)init
9686
}
9787
return self;
9888
}
99-
#else
100-
- (instancetype)initWithBridge:(RCTBridge *)bridge
101-
{
102-
if (self = [super init]) {
103-
_bridge = bridge;
104-
[self initCommonProps];
105-
}
106-
107-
return self;
108-
}
109-
#endif // RCT_NEW_ARCH_ENABLED
11089

11190
- (void)initCommonProps
11291
{
@@ -154,11 +133,7 @@ - (void)didMoveToSuperview
154133
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, _container);
155134
}
156135
if (_touchHandler == nil) {
157-
#ifdef RCT_NEW_ARCH_ENABLED
158136
_touchHandler = [RCTSurfaceTouchHandler new];
159-
#else
160-
_touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge];
161-
#endif
162137
}
163138
[_touchHandler attachToView:_container];
164139

@@ -193,7 +168,6 @@ - (void)maybeShow
193168
}
194169
}
195170

196-
#ifdef RCT_NEW_ARCH_ENABLED
197171
#pragma mark - Fabric Specific
198172

199173
+ (react::ComponentDescriptorProvider)componentDescriptorProvider
@@ -228,7 +202,7 @@ - (void)updateLayoutMetrics:(react::LayoutMetrics const &)layoutMetrics
228202
{
229203
CGRect frame = RCTCGRectFromRect(layoutMetrics.frame);
230204

231-
// Due to view flattening on new architecture there are situations
205+
// Due to view flattening there are situations
232206
// when we receive frames with origin different from (0, 0).
233207
// We account for this frame manipulation in shadow node by setting
234208
// RootNodeKind trait for the shadow node making state consistent
@@ -253,44 +227,13 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
253227
[super updateProps:props oldProps:oldProps];
254228
}
255229

256-
#else
257-
#pragma mark - Paper specific
258-
259-
- (void)reactSetFrame:(CGRect)frame
260-
{
261-
_reactFrame = frame;
262-
[_container setFrame:frame];
263-
}
264-
265-
- (void)invalidate
266-
{
267-
[_container removeFromSuperview];
268-
_container = nil;
269-
}
270-
271-
#endif // RCT_NEW_ARCH_ENABLED
272-
273230
@end
274231

275-
#ifdef RCT_NEW_ARCH_ENABLED
276232
Class<RCTComponentViewProtocol> RNSFullWindowOverlayCls(void)
277233
{
278234
return RNSFullWindowOverlay.class;
279235
}
280-
#endif // RCT_NEW_ARCH_ENABLED
281236

282237
@implementation RNSFullWindowOverlayManager
283238

284-
RCT_EXPORT_MODULE()
285-
286-
RCT_EXPORT_VIEW_PROPERTY(accessibilityContainerViewIsModal, BOOL)
287-
288-
#ifdef RCT_NEW_ARCH_ENABLED
289-
#else
290-
- (UIView *)view
291-
{
292-
return [[RNSFullWindowOverlay alloc] initWithBridge:self.bridge];
293-
}
294-
#endif // RCT_NEW_ARCH_ENABLED
295-
296239
@end

0 commit comments

Comments
 (0)