Shopify / react-native-skia

High-performance React Native Graphics using Skia
https://shopify.github.io/react-native-skia
MIT License
6.96k stars 448 forks source link

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

Open dppo opened 2 weeks ago

dppo commented 2 weeks ago

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");
wcandillon commented 1 week ago

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