Skip to content

Commit 46fd483

Browse files
DavidDuarte22kkafar
authored andcommitted
fix(ios): guard +load with #ifdef RCT_DYNAMIC_FRAMEWORKS
The +load methods in 12 ComponentView files are unconditional, but their parent RCTViewComponentView correctly guards its +load behind #ifdef RCT_DYNAMIC_FRAMEWORKS. Without the guard, these +load methods run even when dynamic frameworks are not used, causing conflicts with third-party SDKs (e.g. Akamai BMP) that also use +load — particularly on x86_64 simulators where the load order differs from arm64. This matches the pattern used by React Native core in RCTViewComponentView.mm (see facebook/react-native#37274). Note: UIViewController+RNScreens.mm is intentionally NOT changed as its +load performs method swizzling that is functionally required.
1 parent 01fc805 commit 46fd483

12 files changed

+24
-0
lines changed

ios/RNSFullWindowOverlay.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ @implementation RNSFullWindowOverlay {
8181
}
8282

8383
// Needed because of this: https://github.com/facebook/react-native/pull/37274
84+
#ifdef RCT_DYNAMIC_FRAMEWORKS
8485
+ (void)load
8586
{
8687
[super load];
8788
}
89+
#endif
8890

8991
#ifdef RCT_NEW_ARCH_ENABLED
9092
- (instancetype)init

ios/RNSModalScreen.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
3232
#ifdef RCT_NEW_ARCH_ENABLED
3333

3434
// Needed because of this: https://github.com/facebook/react-native/pull/37274
35+
#ifdef RCT_DYNAMIC_FRAMEWORKS
3536
+ (void)load
3637
{
3738
[super load];
3839
}
40+
#endif
3941

4042
+ (react::ComponentDescriptorProvider)componentDescriptorProvider
4143
{

ios/RNSScreen.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ @implementation RNSScreenView {
9393
#ifdef RCT_NEW_ARCH_ENABLED
9494

9595
// Needed because of this: https://github.com/facebook/react-native/pull/37274
96+
#ifdef RCT_DYNAMIC_FRAMEWORKS
9697
+ (void)load
9798
{
9899
[super load];
99100
}
101+
#endif
100102

101103
- (instancetype)initWithFrame:(CGRect)frame
102104
{

ios/RNSScreenContainer.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,12 @@ - (void)layoutSubviews
261261
#ifdef RCT_NEW_ARCH_ENABLED
262262

263263
// Needed because of this: https://github.com/facebook/react-native/pull/37274
264+
#ifdef RCT_DYNAMIC_FRAMEWORKS
264265
+ (void)load
265266
{
266267
[super load];
267268
}
269+
#endif
268270

269271
#pragma mark - RCTComponentViewProtocol
270272

ios/RNSScreenContentWrapper.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ - (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetric
209209
}
210210

211211
// Needed because of this: https://github.com/facebook/react-native/pull/37274
212+
#ifdef RCT_DYNAMIC_FRAMEWORKS
212213
+ (void)load
213214
{
214215
[super load];
215216
}
217+
#endif
216218
#endif // RCT_NEW_ARCH_ENABLED
217219

218220
@end

ios/RNSScreenFooter.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ - (void)layoutSubviews
100100
#pragma Fabric specific
101101

102102
// Needed because of this: https://github.com/facebook/react-native/pull/37274
103+
#ifdef RCT_DYNAMIC_FRAMEWORKS
103104
+ (void)load
104105
{
105106
[super load];
106107
}
108+
#endif
107109

108110
+ (react::ComponentDescriptorProvider)componentDescriptorProvider
109111
{

ios/RNSScreenNavigationContainer.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ - (void)updateContainer
4545
}
4646

4747
// Needed because of this: https://github.com/facebook/react-native/pull/37274
48+
#ifdef RCT_DYNAMIC_FRAMEWORKS
4849
+ (void)load
4950
{
5051
[super load];
5152
}
53+
#endif
5254

5355
#endif
5456

ios/RNSScreenStack.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@ @implementation RNSScreenStackView {
218218
#ifdef RCT_NEW_ARCH_ENABLED
219219

220220
// Needed because of this: https://github.com/facebook/react-native/pull/37274
221+
#ifdef RCT_DYNAMIC_FRAMEWORKS
221222
+ (void)load
222223
{
223224
[super load];
224225
}
226+
#endif
225227

226228
- (instancetype)initWithFrame:(CGRect)frame
227229
{

ios/RNSScreenStackHeaderConfig.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ @implementation RNSScreenStackHeaderConfig {
9191
#ifdef RCT_NEW_ARCH_ENABLED
9292

9393
// Needed because of this: https://github.com/facebook/react-native/pull/37274
94+
#ifdef RCT_DYNAMIC_FRAMEWORKS
9495
+ (void)load
9596
{
9697
[super load];
9798
}
99+
#endif
98100

99101
- (instancetype)initWithFrame:(CGRect)frame
100102
{

ios/RNSScreenStackHeaderSubview.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,12 @@ - (void)layoutSubviews
123123
}
124124

125125
// Needed because of this: https://github.com/facebook/react-native/pull/37274
126+
#ifdef RCT_DYNAMIC_FRAMEWORKS
126127
+ (void)load
127128
{
128129
[super load];
129130
}
131+
#endif
130132

131133
- (instancetype)initWithFrame:(CGRect)frame
132134
{

0 commit comments

Comments
 (0)