-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
64 lines (51 loc) · 1.34 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
import React, { PropTypes } from 'react'
import {
View,
NativeModules,
requireNativeComponent
} from 'react-native'
const { GoogleVRPanoramaManager } = NativeModules
const { inputType } = GoogleVRPanoramaManager
class PanoramaView extends React.Component {
constructor(props) {
super(props)
this._onImageLoaded = this._onImageLoaded.bind(this)
this._onImageLoadingFailed = this._onImageLoadingFailed.bind(this)
}
render() {
return (
<RNGoogleVRPanoramaView
{...this.props}
ref={ref => this.ref = ref}
/>
)
}
_onImageLoaded() {
if (this.props.onImageLoaded) this.props.onImageLoaded()
}
_onImageLoadingFailed() {
if (this.props.onImageLoadingFailed) this.props.onImageLoadingFailed()
}
}
PanoramaView.propTypes = {
...View.propTypes,
imageUrl: React.PropTypes.string.isRequired,
dimensions: React.PropTypes.shape({
width: React.PropTypes.number,
height: React.PropTypes.number,
}),
inputType: React.PropTypes.number,
onImageLoaded: React.PropTypes.func,
onImageLoadingFailed: React.PropTypes.func,
}
PanoramaView.defaultProps = {
inputType: inputType.mono,
}
const RNGoogleVRPanoramaView = requireNativeComponent('RNGoogleVRPanorama', PanoramaView, {
nativeOnly: {}
})
const GoogleVRPanorama = {
PanoramaView,
inputType,
}
module.exports = GoogleVRPanorama