Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace react-native/Libraries/Image/AssetRegistry with @react-native/assets-registry/registry #2702

Open
dppo opened this issue Oct 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dppo
Copy link

dppo commented Oct 24, 2024

Description

React-native/Libraries/Image/AssetRegistry is introduced in the Platform.web.js file, but an error will be reported when using react-native-web, because the AssetRegistry file does not exist in react-native-web and has been replaced in react-native. @react-native/assets-registry/registry

Version

latest

Steps to reproduce

if (typeof source === "number" && typeof require === "function") {
        const {
          getAssetByID,
        } = require("react-native/Libraries/Image/AssetRegistry");
        const { httpServerLocation, name, type } = getAssetByID(source);
        const uri = `${httpServerLocation}/${name}.${type}`;
        return uri;
      }

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

✘ [ERROR] Could not read from file: /Users/dppo/Projects/Yunlu/YunluApp/react-native-web/Libraries/Image/AssetRegistry

    node_modules/@shopify/react-native-skia/lib/module/Platform/Platform.web.js:132:20:
      132 │         } = require("react-native/Libraries/Image/AssetRegistry");

@dppo dppo added the bug Something isn't working label Oct 24, 2024
@wcandillon
Copy link
Contributor

Thanks for reporting this. Any chance you could make a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants