fix: dynamically resolve RCTRootContentView for Expo SDK 56 static-framework builds - #41
Conversation
…amework builds Looking up `RCTRootContentView` via `NSClassFromString` instead of referencing the type statically. The static reference produced an `Undefined symbols ... _OBJC_CLASS_$_RCTRootContentView` link error under React Native 0.82 / Expo SDK 56 builds that use static frameworks. Mirrors the approach taken in 7936d90 for `FollyConvert.h`. Widens the return type of `closestParentReactContentView` from `RCTRootContentView?` to `RCTView?` — required because referencing `RCTRootContentView` in a type annotation reintroduces the same static link. Fixes dominicstop#40 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@nandorojo can we get your 👀 on this? Fixes #40 — verified in prod under Expo SDK 56. |
|
I hit this same iOS build blocker after upgrading to Expo SDK 56 / RN 0.85.3. I already fixed the related Galeria SDK 56 issue here: nandorojo/galeria#128, but this PR is still needed because the build now fails in Would be great to get this merged/released. cc: @dominicstop @nandorojo @OrkhanAlikhanov @julian-gargicevich |
|
merged thank you. i think we might need a version number bump for this to publish |
|
Can we get it released? |
|
Hey @nandorojo, can we get a new version pls? |
|
hey @nandorojo I saw you created a new release on Github, but it seems it never reached |
|
I unfortunately don't have Npm access but I reached out to @dominicstop |
|
Any updates on this? |
|
@nandorojo did you hear back from @dominicstop? |
|
hey gang - @dominicstop any chance this gets bumped and released? thank you! |
|
Is there any workaround to allow upgrading to Expo SDK 56 without this lib updated? |
|
@Bartek532 a couple of options until this gets published to npm:
|
|
This is embarrassing. Two months have passed and still no release on NPM. @nandorojo @dominicstop |
Summary
Fixes #40 — the
Undefined symbols ... _OBJC_CLASS_$_RCTRootContentViewlink error reported under Expo SDK 56 / RN 0.82 with static frameworks.RCTView+Helpers.swiftreferencesRCTRootContentViewdirectly, which is no longer reliably exposed as an Obj-C symbol underuse_frameworks! :linkage => :staticin newer React Native versions. This PR looks it up at runtime viaNSClassFromString("RCTRootContentView")instead — the same pattern as commit 7936d90 (fix FollyConvert.h for static frameworks).Changes
closestParentReactContentViewresolvesRCTRootContentViewviaNSClassFromStringand uses the closure-basedrecursivelyFindParentView(where:)/recursivelyFindSubview(where:)helpers withisKind(of:).RCTRootContentView?→RCTView?. This is unavoidable: keepingRCTRootContentView?as the declared return type reintroduces the static type reference that caused the link error in the first place.import FoundationforNSClassFromString.Why this version vs. the patch in #40
@julian-gargicevich posted a similar workaround in #40 using:
This PR uses
isKind(of:)with the closure-based helpers instead, which avoids relying on the dynamic metaclass being castable toRCTView.Typeand matches the existingwhereType:semantics more directly. Credit to @julian-gargicevich for identifying the dynamic-lookup approach.API change note
The return-type change is source-breaking for any external consumer that explicitly annotated the result as
RCTRootContentView?or relied on subclass-specific members. In practice the only member used internally isreactTouchHandlers(line 68), which is defined onRCTView, so the internal caller still works. Calling out explicitly so the maintainer can weigh.Test plan
consumer-app). The exact same change resolves the_OBJC_CLASS_$_RCTRootContentViewlink error reported in Expo SDK 56 #40 and has been running in our Expo SDK 56 builds.examples/example-v0.80.1was attempted withUSE_FRAMEWORKS='static' RCT_NEW_ARCH_ENABLED=1(the failing config from Expo SDK 56 #40) but is blocked by a pre-existing toolchain incompat — Xcode 26 vs thefmtversion pinned by RN 0.80.1 (constevalstrictness change infmt/format-inl.h). This fails identically on clean upstream master, so it's not introduced by this change.scripts/test-build-ios-all.shon the supported Xcode (16.2 perlog-test-build-ios-all.txt) and refresh that log if accepted.🤖 Generated with Claude Code