Ошибка: [Необработанное отклонение обещания: Ошибка: Ожидаемая схема URL 'http' или 'https', но была 'file'] *
Я пытался использовать pixi js в проекте exopact-native. 1003 *
Это файл 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
...
Я запускаю этот проект как начало выставки. Но я получаю вышеупомянутую ошибку. Как я могу исправить эту проблему? Помоги мне. Спасибо.