You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit acc0cca
Browse filesBrowse the repository at this point in the historyBrowse files
Skip third-party components whose class is not linked instead of crashing at launch (#59067)
Summary:
`RCTThirdPartyComponentsProvider.mm` builds its component map from a dictionary literal of `NSClassFromString` results. When a component's library is not linked into the target, such as an app extension or App Clip that leaves a library out (#56469), or a macOS app whose dependencies include an iOS-only component library (react-native-macos generates the same file), `NSClassFromString` returns nil and the literal throws at launch:
```
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
```
The provider now maps component names to class names and registers the classes the runtime has, the way `RCTModuleProviders.mm` already handles a module provider that cannot be found. A component left out this way falls back to `<UnimplementedView>` if it is rendered, as an unknown component does.
## Changelog:
[IOS] [FIXED] - Skip third-party components whose class is not linked instead of crashing at launch
Pull Request resolved: #59067
Test Plan:
- `generate-artifacts-executor-test.js`: the provider snapshots and the crawl case expect the name-to-class-name map. In Linux (WSL) the file's 52 tests and 24 snapshots pass; its suite-level `fs.rmdirSync(…, {recursive: true})` cleanup fails under Node 26, on `main` too.
- The generated `RCTThirdPartyComponentsProvider.mm` for two component libraries, compiled into a binary that links only one of their classes (clang++, Foundation, macOS):
- `main`: `NSInvalidArgumentException … attempt to insert nil object from objects[1]`
- this change: `registered components: LinkedComponent`
- `yarn flow`: no errors; eslint and prettier on the changed files: clean.
Reviewed By: christophpurrer
Differential Revision: D125236957
Pulled By: cipolleschi
fbshipit-source-id: 55126e43352aad7275298978dceaa744a163f966
0 commit comments