fix(ios): load thumbImage/trackImage without the legacy bridge on bridgeless (new arch)#821
Open
arron-kukadia wants to merge 1 commit into
Open
Conversation
arron-kukadia
force-pushed
the
fix/ios-thumbimage-bridgeless
branch
from
July 17, 2026 15:04
a6c01c2 to
0f4c906
Compare
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.
Summary
On bridgeless React Native (the default new-architecture mode since RN 0.74+),
thumbImage,trackImage,minimumTrackImageandmaximumTrackImagesilently fail to render on iOS.loadImageFromImageSourceresolves the ImageLoader through[RCTBridge currentBridge](flagged by the existing TODO in the file), which doesn't reliably provide a working ImageLoader without the legacy bridge — the completion never delivers an image, and the slider falls back to the default thumb.Fixes #773
Fix
Keep the existing ImageLoader path as the first attempt (no behaviour change where it works). If the module is unavailable or returns no image, fall back to fetching the image directly with
NSURLSessionusing the sameNSURLRequest— this covers bundledfile://assets, Metro URLs in dev, and remote images, and honours custom request headers. The retry-on-no-image (rather than only on missing module) is deliberate: on bridgeless, the interop layer can hand back an ImageLoader instance that exists but cannot load, so gating on module presence alone would not fix the bug.Details:
NSURLSessioncompletion invokes the callbacks on the main queue, sincefailureBlockcall sites inupdatePropsmutate UIKit directly and previously only ran synchronously on the main thread.RCTScreenScale()(not[UIScreen mainScreen], which is unavailable on visionOS — this pod declares visionOS support).Known limitations of the fallback
These apply only on bridgeless, where the fallback is effectively the primary path, and match the documented
thumbImageAPI surface (static local/network images):RCTImageURLLoaderplugin schemes (e.g.ph://, custom app-registered schemes) are not supported byNSURLSessionand will fail; they were undocumented for this component but worked via the bridge ImageLoader on the old architecture.source.size+ cover mode) or decoded-image caching. A remote{uri, width, height}source withoutthumbSizedecodes and renders at intrinsic bitmap size.Both could be addressed by resolving
RCTImageLoaderfrom the new-arch module registry (or ultimately the Fabric ImageManager pipeline) — left out of scope here to keep this a minimal fix for #773.Test plan
Verified in a production Expo SDK 56 / RN 0.85 app (bridgeless, new arch): before the change
thumbImagerenders the default circle; after it, the custom thumb renders correctly in both dev (Metro-served asset) and release (bundled asset). Android untouched.