YH_Swiper.js
1.61 KB
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
import React from 'react';
import ReactNative from 'react-native';
import Swiper from 'react-native-swiper';
import RecyclerSwiper from '../recycler-swiper/recyclerswiper'
const {
Component,
} = React;
const {
View,
Platform,
} = ReactNative;
/**
* 轮播图片
*
**/
export default class YH_Swiper extends Component {
constructor(props) {
super (props);
this.dot = <View
style={{
backgroundColor:'rgba(237, 237, 237, 0.5)',
width: 6,
height: 6,
borderRadius: 3,
marginLeft: 3,
marginRight: 3,
marginTop: 0,
}}
/>;
this.activeDot = <View
style={{
backgroundColor:'white',
width: 6,
height: 6,
borderRadius: 3,
marginLeft: 3,
marginRight: 3,
marginTop: 0,
}}
/>;
}
render() {
if (Platform.OS === 'ios') {
return (
<Swiper
dot={this.dot}
activeDot={this.activeDot}
{...this.props}
>
{this.props.children}
</Swiper>
);
}
else{
return (
<RecyclerSwiper
dot={this.dot}
activeDot={this.activeDot}
{...this.props}
>
{this.props.children}
</RecyclerSwiper>
);
}
}
}