Skip to content

Doesn't support asset:/ on Android #1068

@JamesMahy

Description

@JamesMahy

Describe the bug
On Android, files inside android/app/src/main/assets directory are usually accessed via assets:/ but they don't work with FastImage.

Local images don't show at all for me on release builds so the only way I can access them is by using the assets directory.

To be honest if anyone can help me solve why release versions aren't showing images - that'd be a huge help too. But this is still a bug!

To Reproduce
Steps to reproduce the behavior if possible, or a link to a reproduction repo:

  1. Add a file to android/app/src/main/assets
  2. Add <FastImage source={{uri: 'assets:/myfile.png'}} />
  3. See no image and logcat error java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but was 'asset'

Expected behavior
It should show the image, like the native image component does

Screenshots
If applicable, add screenshots to help explain your problem.

Dependency versions

  • React Native version: 0.76.5
  • React version: 18.3.1
  • React Native Fast Image version: 8.9.2

Note: if these are not the latest versions of each I recommend updating as extra effort will not be taken to be backwards compatible, and updating might resolving your issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions