-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReactNativeVoodoo360fsView.js
110 lines (103 loc) · 2.61 KB
/
ReactNativeVoodoo360fsView.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
'use strict'
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Dimensions,
ActivityIndicator,
TouchableOpacity
} from 'react-native';
import Voodoo360 from './ReactNativeVoodoo360'
class ReactNativeVoodoo360fsView extends React.Component {
render() {
let overlay
let errMsgView
let loadingCountView
let resizeMode = this.props.resizeMode ? this.props.resizeMode : 'CENTER_CROP'
let downloadText = this.props.downloadText ? this.props.downloadText : 'Download'
if (!this.props.allLoaded){
if (this.props.errMsg){
errMsgView =
<View style={styles.errMsgView}>
<Text>{this.props.errMsg}</Text>
<TouchableOpacity style={styles.retry} onPress={this.props.onRetryDownloadFiles}>
<Text>Retry</Text>
</TouchableOpacity>
</View>
}
if (this.props.action == 'Download'){
loadingCountView =
<Text>{`${downloadText} ${this.props.index + 1} / ${this.props.imageURIs.length}`}</Text>
}
overlay =
<View style={styles.progressContainer}>
<View style={styles.progressWrapper}>
<ActivityIndicator size='large' />
{loadingCountView}
{errMsgView}
</View>
</View>
}
return (
<View style={this.props.style}>
<Voodoo360
sources={this.props.images}
style={styles.voodoo360}
onIndexChange={this.props.onVoodoo360IndexChange}
resizeMode={resizeMode}
/>
<Text style={styles.voodoo360IndexText}>{`${this.props.voodoo360Index + 1} / ${this.props.images.length}`}</Text>
{overlay}
</View>
);
}
};
let SCREEN_HEIGHT = Dimensions.get('window').height
let SCREEN_WIDTH = Dimensions.get('window').width
const styles = StyleSheet.create({
progressWrapper: {
width: SCREEN_WIDTH * 0.8,
height: 100,
alignItems: 'center'
},
progressContainer: {
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
width: SCREEN_WIDTH,
height: SCREEN_HEIGHT,
top: 0,
left: 0,
position: 'absolute'
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
retry: {
height: 25,
alignItems: 'center',
width: 75
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
errMsgView: {
alignItems: 'center'
},
voodoo360: {
flex: 1
},
voodoo360IndexText: {
position: 'absolute',
bottom: 5,
width: SCREEN_WIDTH,
textAlign: 'center'
}
})
module.exports = ReactNativeVoodoo360fsView