web - React-360:使用外部图像作为场景背景
问题描述
我一直在尝试在环境中设置外部图像。这是我的 index.js:
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
asset,
View,
VrButton,
} from 'react-360';
import {Environment} from 'react-360';
// Set the background to a 360 or 180 image
Environment.setBackgroundImage(
{uri: 'https://devcdn.player360.de/dev/media-768-raw.jpg'}
// asset('media-768-raw.jpg')
);
export default class Hello360 extends React.Component {
// Our component will keep track of this state
state = {
};
componentDidMount(){
}
render() {
return (
<View style={styles.panel}>
<Text>
<Text>Hey</Text>
</Text>
</View>
);
}
};
const styles = StyleSheet.create({
panel: {
// Fill the entire surface
width: 1000,
height: 600,
backgroundColor: 'rgba(255, 255, 255, 0.4)',
justifyContent: 'center',
alignItems: 'center',
}
});
AppRegistry.registerComponent('Hello360', () => Hello360);
React 似乎试图加载图像,但由于某种原因它只是取消了。
控制台输出也没有给出 CORS 或任何其他异常的指示:
我场景的背景仍然是黑色的。在 react-360 中动态包含外部图像的正确方法是什么?
解决方案
它仍然是加载外部图像的正确方法。
问题是,我的控制台输出中有一个过滤器处于活动状态。因此,我无法在控制台中看到 CORS 警告。
这仍然是 devcdn.player360.de 服务器上的 CORS 问题。我们修复了 CORS 标头,现在可以加载外部图像。
推荐阅读
- python - 在anaconda环境中导入tensorflow时出现DLL错误
- postgresql - 即使启用了 pgcrypto 扩展,AWS RDS Postgres Crypto 函数也不起作用
- prometheus - Prometheus 中每 X 分钟的计数值
- aws-sct - 无法为 SQL Server 仓库配置 SCT 数据提取器代理
- java - Stream.of(int[]) 返回 Stream
而 Stream.of(String[]) 返回 Stream 为什么? - ruby-on-rails - 我的 ubuntu 系统在启动弹性搜索服务时卡住了
- git - 创建新的 repo 并在新的 repo 中包含所有“旧”repo 文件
- mysql - 如何通过 Docker 在生产环境中处理数据备份
- elasticsearch - Elasticsearch 滚动查询返回错误
- python - 我的代码在超过 15500 次迭代时突然停止编写