-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
135 lines (120 loc) · 3.48 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
VrButton,
} from 'react-360';
import ReactNYCView from './entities/ReactNYCView';
import Doggo from './entities/Doggo';
import CaptainFalcon from './entities/CaptainFalcon';
import Kirby from './entities/Kirby';
import KirbyStage from './entities/KirbyStage';
import Pupper from './entities/Pupper';
const slidesText = [
"Virtual Reality on the Web with React 360",
"@veekas everywhere",
"What is React 360?",
"open source web VR library managed by Facebook and Oculus",
"the library formerly known as react-vr (RIP) in early 2017",
"rebuilt from first principles in 2018",
"How does it work?",
"It's built on React Native to work on mobile, web, and VR devices...",
"including the Oculus VR UI...",
"and Three.js for lower level 3D rendering in the browser...",
"and WebVR for browser APIs.",
"What's great about it?",
"It's pretty easy!",
"`npm i -g react-360-cli`",
"`react-360 init projectName`",
"`yarn start`",
"let's see some code!",
"What's not great about it?",
"npm package not updated in 8 months",
"scaleZ???",
"few primitives",
"`import Entity from 'Entity'`",
"so please make some PRs!",
"Thank you!!!",
]
export default class ReactVRPlayground extends React.Component {
state = { slide: 0, totalSlides: slidesText.length };
nextSlide = () => {
const { totalSlides } = this.state;
const nextIndex = this.state.slide + 1;
const slide = nextIndex < totalSlides ? nextIndex : totalSlides - 1;
this.setState({ slide });
}
prevSlide = () => {
const previousIndex = this.state.slide - 1;
const slide = previousIndex >= 0 ? previousIndex : 0;
this.setState({ slide });
};
render() {
return (
<View style={ styles.panel }>
<View style={ styles.greetingBox }>
<VrButton onClick={this.prevSlide} style={styles.button}>
<Text style={styles.buttonText}>{'<'}</Text>
</VrButton>
<View style={styles.titleView}>
<Text style={styles.title}>
{slidesText[this.state.slide]}
</Text>
</View>
<VrButton onClick={this.nextSlide} style={styles.button}>
<Text style={styles.buttonText}>{'>'}</Text>
</VrButton>
</View>
</View>
);
}
};
const styles = StyleSheet.create({
button: {
backgroundColor: '#ccc',
width: 40,
height: '100%',
display: 'flex',
justifyContent: 'center',
},
buttonText: {
textAlign: 'center',
color: '#000000',
fontSize: 30,
fontWeight: 'bold',
},
panel: {
// Fill the entire surface
width: 900,
height: 600,
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center',
},
greetingBox: {
height: '100%',
width: '100%',
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
},
title: {
color: 'black',
fontSize: 40,
},
titleView: {
height: '100%',
display: 'flex',
justifyContent: 'center',
maxWidth: '80%',
},
});
AppRegistry.registerComponent('ReactVRPlayground', () => ReactVRPlayground);
AppRegistry.registerComponent('KirbyStage', () => KirbyStage);
AppRegistry.registerComponent('Pupper', () => Pupper);
AppRegistry.registerComponent('Kirby', () => Kirby);
AppRegistry.registerComponent('CaptainFalcon', () => CaptainFalcon);
AppRegistry.registerComponent('Doggo', () => Doggo);
AppRegistry.registerComponent('ReactNYCView', () => ReactNYCView);