Add an iOS withDangerousMod to the Expo config plugin that patches RCTThirdPartyComponentsProvider.mm#176
Open
Th0mYT wants to merge 8 commits intoazesmway:mainfrom
Open
Add an iOS withDangerousMod to the Expo config plugin that patches RCTThirdPartyComponentsProvider.mm#176Th0mYT wants to merge 8 commits intoazesmway:mainfrom
Th0mYT wants to merge 8 commits intoazesmway:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed: plugin/src/index.ts (and its compiled output plugin/build/index.js)
What was broken: Expo's prebuild ran the C++ codegen for unityview but never generated the Fabric registration step. RNUnityViewCls() was defined in RNUnityView.mm but never
called, so Fabric couldn't find the component by name, fell back to the legacy interop layer, and updateProps was never dispatched.
The fix — withIosFabricRegistration: A new iOS withDangerousMod that runs at the end of every npx expo prebuild and patches RCTThirdPartyComponentsProvider.mm with two insertions:
// 1. Forward declaration (before @implementation)
Class RNUnityViewCls(void);
// 2. Dictionary entry (inside thirdPartyFabricComponents)
@"RNUnityView" : RNUnityViewCls(),
Call chain after the fix (matches what should happen):
codegenNativeComponent('RNUnityView')
→ Fabric finds RNUnityView via RCTThirdPartyComponentsProvider
→ initWithFrame: (lambda set, initUnityModule called as belt-and-suspenders)
→ updateEventEmitter:
→ updateProps: ← initUnityModule() ← Unity starts ✓
The initUnityModule call in initWithFrame: from the previous commit remains — it acts as a safety net for any edge case where updateProps might still be delayed.