Skip to content

fix: support defaultSource on the New Architecture (Fabric) β€” iOS, Android & JS#387

Open
glc-helmbarki wants to merge 1 commit into
dream-horizon-org:mainfrom
glc-helmbarki:fix/default-source-new-architecture
Open

fix: support defaultSource on the New Architecture (Fabric) β€” iOS, Android & JS#387
glc-helmbarki wants to merge 1 commit into
dream-horizon-org:mainfrom
glc-helmbarki:fix/default-source-new-architecture

Conversation

@glc-helmbarki

Copy link
Copy Markdown

Problem

defaultSource is ignored when the New Architecture (Fabric) is enabled, so the
view stays blank while the remote image loads. Closes #385.

Root cause is per-platform:

  • iOS: the Fabric component view (FFFastImageViewComponentView.updateProps:)
    handled source, resizeMode, etc. but never applied defaultSource.
  • JS: under Fabric, defaultSource is typed as a String natively, but
    resolveDefaultSource returned the raw require() number on iOS, which was
    then String()-ified to e.g. "42" β€” unusable natively.
  • Android: setDefaultSource only resolves a local resource name via
    getResourceDrawable; a packager/remote URI (debug) returns null, and no
    placeholder was shown when the source was empty/invalid.

Fix

  • JS (src/index.tsx): under Fabric, resolve the asset to a URI
    (Image.resolveAssetSource(...).uri).
  • iOS (FFFastImageViewComponentView.mm): apply defaultSource in
    updateProps: by converting the URI to a UIImage via
    {uri, __packager_asset: YES} (works in debug and release). Builds on fix iOS support default image (new architecture).Β #355.
  • Android (FastImageViewWithUrl.java, FastImageViewManager.java): keep the
    raw URI and, when it isn't a local Drawable, load the placeholder through
    Glide β€” .thumbnail() while loading, .error() on failure β€” and show it when
    there is no valid source.

Tested

  • iOS New Arch β€” debug & release βœ…
  • Android New Arch β€” debug & release βœ…
  • Placeholder shown while loading, on 404, and when no source is provided.

defaultSource was ignored on the New Architecture, leaving a blank view
while the remote image loads (issue dream-horizon-org#385).

- iOS: the Fabric component view (updateProps:) never applied defaultSource.
  Convert the resolved URI to a UIImage via {uri, __packager_asset: YES} so it
  works in debug (Metro packager URL) and release.
- JS: under Fabric, defaultSource is typed as a String natively, so resolve the
  asset to a URI instead of returning the raw require() number (which iOS
  stringified to e.g. "42", unusable).
- Android: load the placeholder through Glide (thumbnail while loading, error on
  failure) and show it when there is no valid source, since getResourceDrawable
  cannot resolve a packager/remote URI.

Fixes dream-horizon-org#385

@orca-security-in orca-security-in Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

πŸš€ Thanks for your first Pull Request!
Your contribution is greatly appreciated, and a maintainer will review it soon.
Meanwhile, feel free to check out other issues or share your thoughts on the project.
We’re excited to have you on board! πŸŽ‰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defaultSource not working with Fabric (New Architecture) enabled

1 participant