Skip to content

SourceCodeModule returns empty string for bundle root path #10620

Closed

Description

@rozele

Problem Description

This pretty much explains it:
https://github.com/microsoft/react-native-windows/blob/main/vnext/Shared/OInstance.cpp#L610

The problem this causes is that Image.resolveAssetSource returns relative paths prefixed with file://, and native modules and view managers must manually construct appropriate absolute paths. We should not need to do this for each module that depends on package asset resolution, but instead should just produce the fully qualified URI via JS.

Steps To Reproduce

  1. Produce a bundled app (either debug or release)
  2. In the app, call Image.resolveAssetSource(require('path/to/some/asset.png'))
  3. Notice that the path is file://path/to/some/asset.png

Expected Results

The resolved path should be:
<bundleRootPath>/path/to/some/asset.png

CLI version

npx react-native --version

Environment

npx react-native info

Target Platform Version

No response

Target Device(s)

No response

Visual Studio Version

No response

Build Configuration

No response

Snack, code example, screenshot, or link to a repository

No response

Activity

  1. ghost added
    Needs: Triage 🔍
    on Sep 22, 2022
  2. added 3 commits that reference this issue on Sep 22, 2022
    9d9eba1
    cfe4cf2
    265301b
  3. added and removed
    Needs: Triage 🔍
    on Sep 26, 2022
  4. added this to the 0.71 milestone on Sep 26, 2022
  5. added a commit that references this issue on Oct 11, 2022
    022c972
  6. added a commit that references this issue on Oct 23, 2022
    5de8e38
  7. added
    Needs: Attention 👋
    on Jan 9, 2023
  8. chiaramooney commented on Jan 9, 2023

    @chiaramooney
    Contributor

    Flagging to discuss. Issue has milestone but no assignee.

  9. 7 remaining items

  10. added a commit that references this issue on Apr 2, 2023
    1d1fee7
  11. added a commit that references this issue on Apr 27, 2023
    986e19d
  12. added 2 commits that reference this issue on Jun 2, 2023
    26952da
    0c67b7e
  13. added 3 commits that reference this issue on Oct 10, 2023
    fc047bd
    eba988b
    2a2433d
  14. added a commit that references this issue on Oct 14, 2023
    e3c7f02
  15. added a commit that references this issue on Oct 18, 2023
    4ae1857
  16. added
    New Architecture
    on Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FabricArea: ImageNew ArchitecturePartner: Facebookbug

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions