[Unhandled promise rejection: Error: Expected URL scheme 'http' or 'https' but was 'file']

[Unhandled promise rejection: Error: Expected URL scheme 'http' or 'https' but was 'file']

错误: [未处理的承诺拒绝:错误:预期 URL 方案 'http' 或 'https' 但 'file']

我尝试在 react-native expo 项目上使用 pixi js。

这是 package.json 文件。

"dependencies": {
    "@expo/vector-icons": "^9.0.0",
    "expo": "^33.0.7",
    "expo-asset-utils": "^1.1.1",
    "expo-gl": "~5.0.1",
    "expo-pixi": "^1.1.0",
    "expokit": "^32.0.3",
    "lodash": "^4.17.11",
    "native-base": "^2.10.0",
    "prop-types": "^15.6.2",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
    "react-native-gesture-handler": "^1.0.9",
    "react-native-svg": "^9.11.1",
    "react-native-web": "^0.11.2",
    "react-navigation": "^3.0.9",
    "react-navigation-redux-helpers": "^2.0.9",
    "react-redux": "^6.0.0",
    "react-style-proptype": "^3.2.2",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.0.0",
    "expo-cli": "^2.10.1",
    "eslint": "^5.16.0",
    "eslint-config-universe": "^1.0.7",
    "prettier": "^1.17.0"
  },
  "resolutions": {
    "expo-pixi/@expo/browser-polyfill": "0.0.1-alpha.3"
  },
  "private": true

和app.json文件。

...

"privacy": "unlisted",
    "sdkVersion": "33.0.0",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./src/assets/images/icon.png",
    "splash": {
      "image": "./src/assets/images/splash.png",
      "resizeMode": "cover",
      "backgroundColor": "#222222"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    }

...

这是我的屏幕代码。

import React from 'react';
import { GLView } from 'expo-gl';
import ExpoPixi,{ PIXI } from 'expo-pixi';

export default class GameReady extends React.Component {
  render() {
    return (
      <GLView
        style={{ flex: 1 }}
        onContextCreate={async context => {
          const sprite = await PIXI.Sprite.fromExpoAsync('https://ubisafe.org/images/sans-transparent-8-bit.png');
          const app = new PIXI.Application({ context });
          app.stage.addChild(sprite);
        }}
      />
    );
  }
}

错误:



[Unhandled promise rejection: Error: Expected URL scheme 'http' or 'https' but was 'file']

Stack trace:
  node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:155:41 in createErrorFromErrorData
  node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:104:55 in <unknown>
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:414:4 in __invokeCallback
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:127:28 in <unknown>
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314:10 in __guard
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:126:17 in invokeCallbackAndReturnFlushedQueue
  ...

我运行这个项目作为世博会的开始。 但是我得到了上面的错误。 我该如何解决这个问题? 帮我。 谢谢

请查看带有本地精灵和网络上的固定零食示例:

https://snack.expo.io/@djalik/base-pixi.js