Commit d4f3d71
fix(ios): guard +load with #ifdef RCT_DYNAMIC_FRAMEWORKS (#3828)
## Summary
12 ComponentView files had unconditional `+load { [super load]; }`
methods, 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.
### Changes
1. **Guarded existing `+load` methods** — wrapped 12 existing
unconditional `+load` calls with `#ifdef RCT_DYNAMIC_FRAMEWORKS`.
2. **Added missing guarded `+load` methods** — 9 additional
ComponentView files (gamma, tabs) were missing `+load` entirely, which
would break component registration when using dynamic frameworks. Added
guarded `+load` to these files.
3. **Relocated `+load` to end of `@implementation`** — moved all `+load`
methods to a dedicated `#pragma mark - Dynamic frameworks support`
section just before `@end` for consistency and readability.
4. **Normalized `#endif` comments** — ensured all `#endif` directives
have consistent trailing comments (e.g. `#endif //
RCT_DYNAMIC_FRAMEWORKS`).
### Affected files
**Existing `+load` guarded (12 files):**
- `RNSScreen.mm`
- `RNSScreenStack.mm`
- `RNSScreenContainer.mm`
- `RNSScreenNavigationContainer.mm`
- `RNSModalScreen.mm`
- `RNSFullWindowOverlay.mm`
- `RNSScreenFooter.mm`
- `RNSSafeAreaViewComponentView.mm`
- `RNSSearchBar.mm`
- `RNSScreenContentWrapper.mm`
- `RNSScreenStackHeaderConfig.mm`
- `RNSScreenStackHeaderSubview.mm`
**New guarded `+load` added (9 files):**
- `RNSScrollViewMarkerComponentView.mm`
- `RNSSplitHostComponentView.mm`
- `RNSSplitScreenComponentView.mm`
- `RNSStackHostComponentView.mm`
- `RNSStackScreenComponentView.mm`
- `RNSTabsHostComponentView.mm`
- `RNSTabsScreenComponentView.mm`
- `RNSTabsBottomAccessoryComponentView.mm`
- `RNSTabsBottomAccessoryContentComponentView.mm`
## Test plan
- Build xcframework with static linking (no `USE_FRAMEWORKS=dynamic`)
- Verify ComponentView `+load` methods are not in the binary (`nm`
check)
- Run on x86_64 simulator alongside Akamai BMP — no crash at launch
- Run on arm64 simulator — screens navigation works normally
---------
Co-authored-by: Kacper Kafara <kacperkafara@gmail.com>1 parent 33feebb commit d4f3d71
21 files changed
Lines changed: 198 additions & 59 deletions
File tree
- ios
- gamma
- scroll-view-marker
- split
- stack
- host
- screen
- safe-area
- tabs
- bottom-accessory
- host
- screen
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 74 | | |
81 | 75 | | |
82 | 76 | | |
| |||
227 | 221 | | |
228 | 222 | | |
229 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
32 | 31 | | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | | - | |
| 41 | + | |
39 | 42 | | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 70 | | |
77 | 71 | | |
78 | 72 | | |
| |||
1432 | 1426 | | |
1433 | 1427 | | |
1434 | 1428 | | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
1435 | 1439 | | |
1436 | 1440 | | |
1437 | 1441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | 253 | | |
260 | 254 | | |
261 | 255 | | |
| |||
316 | 310 | | |
317 | 311 | | |
318 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
186 | 188 | | |
| 189 | + | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
190 | 193 | | |
| 194 | + | |
191 | 195 | | |
192 | 196 | | |
193 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | 93 | | |
100 | 94 | | |
101 | 95 | | |
| |||
106 | 100 | | |
107 | 101 | | |
108 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | 184 | | |
191 | 185 | | |
192 | 186 | | |
| |||
1434 | 1428 | | |
1435 | 1429 | | |
1436 | 1430 | | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
1437 | 1441 | | |
1438 | 1442 | | |
1439 | 1443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 65 | | |
72 | 66 | | |
73 | 67 | | |
| |||
1113 | 1107 | | |
1114 | 1108 | | |
1115 | 1109 | | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1116 | 1120 | | |
1117 | 1121 | | |
1118 | 1122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 113 | | |
120 | 114 | | |
121 | 115 | | |
| |||
299 | 293 | | |
300 | 294 | | |
301 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
302 | 306 | | |
303 | 307 | | |
304 | 308 | | |
| |||
0 commit comments