...
|
...
|
@@ -12,6 +12,8 @@ const { |
|
|
TouchableOpacity,
|
|
|
StyleSheet,
|
|
|
Dimensions,
|
|
|
Platform,
|
|
|
|
|
|
} = ReactNative;
|
|
|
|
|
|
export default class Banner extends React.Component {
|
...
|
...
|
@@ -57,6 +59,26 @@ export default class Banner extends React.Component { |
|
|
let height = this.props.height;
|
|
|
let data = this.props.data.toArray();
|
|
|
|
|
|
|
|
|
|
|
|
if (data.length == 1) {
|
|
|
|
|
|
return (
|
|
|
<TouchableOpacity
|
|
|
activeOpacity={1}
|
|
|
style={{width: width, height: height}}
|
|
|
onPress={() => {
|
|
|
this.props.onPress && this.props.onPress(data[0].get('url'), 0);
|
|
|
}}
|
|
|
>
|
|
|
<SlicedImage
|
|
|
source={{uri: data[0].get('src').replace('{width}', width).replace('{height}', height).replace('{mode}',2)}}
|
|
|
style={{ width: width, height: height}}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
<Swiper
|
|
|
style={styles.banner}
|
...
|
...
|
@@ -66,7 +88,7 @@ export default class Banner extends React.Component { |
|
|
autoplayTimeout={this.props.duration}
|
|
|
paginationStyle={{bottom: 8}}
|
|
|
dot={this.dot}
|
|
|
activeDot={this.activeDot}
|
|
|
activeDot={(Platform.OS === 'ios')?this.activeDot:null}
|
|
|
height={height}
|
|
|
>
|
|
|
{data.map((item, i) => {
|
...
|
...
|
|