-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
91 lines (82 loc) · 1.76 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
VrButton
} from 'react-360';
export default class VRBlog extends React.Component {
componentDidMount() {
setInterval(this._incrementCount, 1000);
}
state = {
show: false,
count: 0,
}
show = () => {
this.setState({show: true})
}
hide = () => {
this.setState({show: false})
}
_incrementCount = () => {
this.setState({count: this.state.count + 1});
};
render() {
return (
<View>
<View style={{transform: [ {translate: [0, 0, -2]} ]}}></View>
<View style={styles.panel}>
<VrButton onClick={this.show}>
<View style={styles.greetingBox}>
<Text style={styles.greeting}>
Show the Last View
</Text>
</View>
</VrButton>
<VrButton onClick={this.hide}>
<View style={styles.greetingBox}>
<Text style={styles.greeting}>
Hide the Last View
</Text>
</View>
</VrButton>
<View style={styles.greetingBox}>
<Text style={styles.greeting}>
Welcome
</Text>
</View>
{
this.state.show ?
<View style={styles.greetingBox}>
<Text style={styles.greeting}>
Last View
</Text>
</View> : null
}
</View>
</View>
);
}
};
const styles = StyleSheet.create({
panel: {
// Fill the entire surface
width: 1000,
height: 600,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
alignContent: 'stretch',
},
greetingBox: {
padding: 20,
margin: 20,
backgroundColor: '#000000',
},
greeting: {
fontSize: 20,
},
});
AppRegistry.registerComponent('VRBlog', () => VRBlog);