-
Notifications
You must be signed in to change notification settings - Fork 9
/
CustomStyles.tsx
109 lines (107 loc) · 2.34 KB
/
CustomStyles.tsx
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
import React from "react";
import {
AccessibilityInfo,
Platform,
Text,
TextStyle,
View,
ViewStyle
} from "react-native";
import Carousel, { defaultStyles } from "../../src/index";
const styles = {
slide1: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#a3c9a8"
} as ViewStyle,
slide2: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#84b59f"
} as ViewStyle,
slide3: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#69a297"
} as ViewStyle,
text: {
color: "#1f2d3d",
opacity: 0.7,
fontSize: 48,
fontWeight: "bold"
} as TextStyle
};
export const CustomStyles = (): JSX.Element => (
<Carousel
dotsContainerStyle={{
position: "absolute",
top: 25,
left: 0,
right: 0,
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center"
}}
activeDotStyle={{
backgroundColor: "#eace15",
width: 8,
height: 8,
marginLeft: 3,
marginRight: 3,
marginTop: 3,
marginBottom: 3
}}
dotStyle={{
backgroundColor: "rgba(0,0,0,.2)",
width: 8,
height: 8,
marginLeft: 3,
marginRight: 3,
marginTop: 3,
marginBottom: 3
}}
controlsContainerStyle={{
...defaultStyles.controlsContainer,
position: "absolute",
top: 30,
left: 0,
right: 0,
paddingHorizontal: 10,
paddingVertical: 10,
}}
controlsButtonStyle={{
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
width: 80,
height: 80,
backgroundColor: "black",
borderRadius: 60,
opacity: 0.5
}}
controlsTextStyle={{ fontSize: 50, color: "#eace15" }}
onIndexChanged={({ index, total }): void => {
if (Platform.OS === "ios") {
const page = index + 1;
AccessibilityInfo.announceForAccessibility(
`Changed to page ${page}/${total}`
);
}
}}
>
<View style={styles.slide1}>
<Text style={styles.text}>1</Text>
</View>
<View style={styles.slide2}>
<Text style={styles.text}>2</Text>
</View>
<View style={styles.slide3}>
<Text style={styles.text}>3</Text>
</View>
</Carousel>
);