forked from crowdbotics-apps/haileyshealthyhango-48467
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
139 lines (131 loc) · 3.4 KB
/
index.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import React from "react";
import { View, Image, Text, StyleSheet } from "react-native";
import PropTypes from "prop-types";
import AppIntroSlider from "react-native-app-intro-slider";
const Onboarding = ({
slidesData,
onDone,
onSkip,
onSlideChange,
bottomButton = false,
dotStyle,
activeDotStyle,
skipLabel,
doneLabel,
showSkipButton = true,
prevLabel,
nextLabel,
showPrevButton = true,
showNextButton = true,
showDoneButton = true,
renderNextButton,
renderPrevButton,
renderDoneButton,
renderSkipButton,
mainContainerStyle = {},
imageStyle = {},
titleStyle = {},
descriptionStyle = {}
}) => {
const renderItem = ({ item, index }) => {
return (
<View style={[styles.slide, { backgroundColor: item.backgroundColor }]} key={index}>
<Text style={[styles.title, titleStyle]}>{item?.title}</Text>
<Image style={[styles.image, imageStyle]} source={{ uri: item?.imageURL }} />
<Text style={[styles.text, descriptionStyle]}>{item?.description}</Text>
</View>
);
};
const handleDone = () => {
};
return (
<View style={[{ flex: 1 }, mainContainerStyle]}>
{slidesData
? <AppIntroSlider
renderItem={renderItem}
data={slidesData}
onDone={onDone || handleDone}
onSkip={onSkip || ""}
onSlideChange={onSlideChange || ""}
showSkipButton={showSkipButton}
bottomButton={bottomButton}
dotStyle={dotStyle}
activeDotStyle={activeDotStyle}
skipLabel={skipLabel}
doneLabel={doneLabel}
nextLabel={nextLabel}
prevLabel={prevLabel}
showPrevButton={showPrevButton}
showNextButton={showNextButton}
showDoneButton={showDoneButton}
renderNextButton={renderNextButton}
renderPrevButton={renderPrevButton}
renderDoneButton={renderDoneButton}
renderSkipButton={renderSkipButton}
/>
: <Text style={styles.warText}>No data found!</Text>}
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
marginHorizontal: 16
},
slide: {
flex: 1,
alignItems: "center",
justifyContent: "center"
},
image: {
width: 320,
height: 320,
marginVertical: 32
},
text: {
color: "rgba(255, 255, 255, 0.8)",
textAlign: "center"
},
title: {
fontSize: 22,
color: "white",
textAlign: "center"
},
warText: {
top: "20%",
marginHorizontal: "20%",
textAlign: "center",
fontSize: 20,
fontFamily: "system-ui",
fontWeight: "bold"
}
});
Onboarding.propTypes = {
slidesData: PropTypes.array,
onDone: PropTypes.func,
onSkip: PropTypes.func,
onSlideChange: PropTypes.func,
bottomButton: PropTypes.bool,
dotStyle: PropTypes.object,
activeDotStyle: PropTypes.object,
skipLabel: PropTypes.string,
doneLabel: PropTypes.string,
showSkipButton: PropTypes.bool,
prevLabel: PropTypes.string,
nextLabel: PropTypes.string,
showPrevButton: PropTypes.bool,
showNextButton: PropTypes.bool,
showDoneButton: PropTypes.bool,
renderNextButton: PropTypes.func,
renderPrevButton: PropTypes.func,
renderDoneButton: PropTypes.func,
renderSkipButton: PropTypes.func,
mainContainerStyle: PropTypes.object,
imageStyle: PropTypes.object,
titleStyle: PropTypes.object,
descriptionStyle: PropTypes.object
};
export default {
title: "Onboarding",
navigator: Onboarding
};