|
@@ -12,6 +12,8 @@ const { |
|
@@ -12,6 +12,8 @@ const { |
12
|
TouchableOpacity,
|
12
|
TouchableOpacity,
|
13
|
StyleSheet,
|
13
|
StyleSheet,
|
14
|
Dimensions,
|
14
|
Dimensions,
|
|
|
15
|
+ Platform,
|
|
|
16
|
+
|
15
|
} = ReactNative;
|
17
|
} = ReactNative;
|
16
|
|
18
|
|
17
|
export default class Banner extends React.Component {
|
19
|
export default class Banner extends React.Component {
|
|
@@ -57,6 +59,26 @@ export default class Banner extends React.Component { |
|
@@ -57,6 +59,26 @@ export default class Banner extends React.Component { |
57
|
let height = this.props.height;
|
59
|
let height = this.props.height;
|
58
|
let data = this.props.data.toArray();
|
60
|
let data = this.props.data.toArray();
|
59
|
|
61
|
|
|
|
62
|
+
|
|
|
63
|
+
|
|
|
64
|
+ if (data.length == 1) {
|
|
|
65
|
+
|
|
|
66
|
+ return (
|
|
|
67
|
+ <TouchableOpacity
|
|
|
68
|
+ activeOpacity={1}
|
|
|
69
|
+ style={{width: width, height: height}}
|
|
|
70
|
+ onPress={() => {
|
|
|
71
|
+ this.props.onPress && this.props.onPress(data[0].get('url'), 0);
|
|
|
72
|
+ }}
|
|
|
73
|
+ >
|
|
|
74
|
+ <SlicedImage
|
|
|
75
|
+ source={{uri: data[0].get('src').replace('{width}', width).replace('{height}', height).replace('{mode}',2)}}
|
|
|
76
|
+ style={{ width: width, height: height}}
|
|
|
77
|
+ />
|
|
|
78
|
+ </TouchableOpacity>
|
|
|
79
|
+ );
|
|
|
80
|
+ }
|
|
|
81
|
+
|
60
|
return (
|
82
|
return (
|
61
|
<Swiper
|
83
|
<Swiper
|
62
|
style={styles.banner}
|
84
|
style={styles.banner}
|
|
@@ -66,7 +88,7 @@ export default class Banner extends React.Component { |
|
@@ -66,7 +88,7 @@ export default class Banner extends React.Component { |
66
|
autoplayTimeout={this.props.duration}
|
88
|
autoplayTimeout={this.props.duration}
|
67
|
paginationStyle={{bottom: 8}}
|
89
|
paginationStyle={{bottom: 8}}
|
68
|
dot={this.dot}
|
90
|
dot={this.dot}
|
69
|
- activeDot={this.activeDot}
|
91
|
+ activeDot={(Platform.OS === 'ios')?this.activeDot:null}
|
70
|
height={height}
|
92
|
height={height}
|
71
|
>
|
93
|
>
|
72
|
{data.map((item, i) => {
|
94
|
{data.map((item, i) => {
|