一段时间以来,我一直在尝试在环境中设置一个外部图像。这是我的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似乎试图加载图像,但它只是出于某种原因而失败了。
Developer Tools: Network Screenshot
此外,控制台输出没有给出CORS或任何其他异常的指示:
我的场景背景仍然是黑色的。在react-360中动态包含外部图像的正确方式是什么?
发布于 2018-09-21 22:24:23
这仍然是加载外部图像的正确方式。
问题是,在我的控制台输出中有一个过滤器处于活动状态。因此,我无法在控制台中看到CORS警告。
在devcdn.player360.de服务器上,这仍然是一个CORS问题。我们修复了CORS头文件,现在可以加载外部图像了。
https://stackoverflow.com/questions/52223855
复制相似问题