-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwiper.js
85 lines (81 loc) · 1.93 KB
/
Swiper.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
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Dimensions,
} from 'react-native';
import Swiper from 'react-native-swiper';
var width = Dimensions.get('window').width;
var height = Dimensions.get('window').height;
var styles = StyleSheet.create({
SwiperBox : {
height: 300,
},
wrapper: {
},
slide1: {
height: 300,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#9DD6EB',
},
slide2: {
height: 300,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#97CAE5',
},
slide3: {
height: 300,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#92BBD9',
},
text: {
color: '#fff',
fontSize: 30,
fontWeight: 'bold',
},
flex : {
flex : 1,
},
content : {
flex : 1,
backgroundColor : 'gray',
justifyContent: 'center',
alignItems: 'center',
},
})
export default class ReactSwiper extends Component {
render() {
return (
<View style={styles.flex}>
<View style={styles.SwiperBox}>
<Swiper
style={styles.wrapper}
horizontal={true}
showsPagination={true}
paginationStyle={{height: height + 80}}
//activeDot={<View style={{backgroundColor: '#007aff', width: 8, height: 8, borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />}
autoplay={true}
autoplayTimeout={2}
showsButtons={false}>
<View style={styles.slide1}>
<Text style={styles.text}>Hello Swiper</Text>
</View>
<View style={styles.slide2}>
<Text style={styles.text}>Beautiful</Text>
</View>
<View style={styles.slide3}>
<Text style={styles.text}>And simple</Text>
</View>
</Swiper>
</View>
<View style={styles.content}>
<Text>看我吊不?</Text>
</View>
</View>
);
}
}