我刚刚开始通过安装初始项目来探索 React 360。初始项目始终在用户面前显示初始加载文本。我正在尝试使用绝对位置将文本向右移动,但是在它超出初始表面之后就再也看不到了。我已阅读文档,但不清楚。我需要做什么?我是否需要增加表面的宽度以使其环绕整个视图(围绕用户)才能看到该文本?我该怎么做呢?或者实际上是否有任何其他首选的常用技术。我正在寻找过去 2 小时无法找到任何解决方案的解决方案。
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
asset,
VrButton,
Environment,
} from "react-360";
export default class Hello360 extends React.Component {
state = {
name: 'Click me'
}
handleClick = () => {
this.setState({
name: 'You have clicked me'
})
}
componentDidMount() {
Environment.clearBackground();
Environment.setBackgroundImage(asset("360_house.jpg"), { format: "2D" });
}
render() {
return <View style={styles.panel}>
<View style={styles.greetingBox}>
<Text style={styles.greeting}>{this.state.name}</Text>
<VrButton onClick={this.handleClick} style={styles.button}>
<Text style={styles.buttonText}>Click</Text>
</VrButton>
</View>
</View>;
}
};
const styles = StyleSheet.create({
panel: {
// Fill the entire surface
width: 1000,
height: 600,
backgroundColor: 'rgba(255, 255, 255, 0.5)',
justifyContent: 'center',
alignItems: 'center',
position: 'absolute',
},
greetingBox: {
padding: 20,
backgroundColor: '#000000',
borderColor: '#639dda',
borderWidth: 2,
},
greeting: {
fontSize: 30,
},
button: {
padding: 20,
backgroundColor: '#000000',
borderColor: '#639dda',
borderWidth: 2,
},
buttonText: {
fontSize: 10,
}
});
AppRegistry.registerComponent('Hello360', () => Hello360);