|
@@ -1,411 +1,403 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
3
|
import * as React from 'react';
|
4
|
|
-import {Platform, StatusBar, StyleSheet, View} from "react-native";
|
5
|
|
-import type {MaterialCommunityIconsGlyphs} from "react-native-vector-icons/MaterialCommunityIcons";
|
6
|
|
-import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
|
|
4
|
+import {Platform, StatusBar, StyleSheet, View} from 'react-native';
|
|
5
|
+import type {MaterialCommunityIconsGlyphs} from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
6
|
+import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
7
|
7
|
import i18n from 'i18n-js';
|
8
|
|
-import AppIntroSlider from "react-native-app-intro-slider";
|
9
|
|
-import Update from "../../constants/Update";
|
10
|
|
-import ThemeManager from "../../managers/ThemeManager";
|
|
8
|
+import AppIntroSlider from 'react-native-app-intro-slider';
|
11
|
9
|
import LinearGradient from 'react-native-linear-gradient';
|
12
|
|
-import Mascot, {MASCOT_STYLE} from "../Mascot/Mascot";
|
13
|
|
-import * as Animatable from "react-native-animatable";
|
14
|
|
-import {Card} from "react-native-paper";
|
|
10
|
+import * as Animatable from 'react-native-animatable';
|
|
11
|
+import {Card} from 'react-native-paper';
|
|
12
|
+import Update from '../../constants/Update';
|
|
13
|
+import ThemeManager from '../../managers/ThemeManager';
|
|
14
|
+import Mascot, {MASCOT_STYLE} from '../Mascot/Mascot';
|
15
|
15
|
|
16
|
|
-type Props = {
|
17
|
|
- onDone: Function,
|
18
|
|
- isUpdate: boolean,
|
19
|
|
- isAprilFools: boolean,
|
|
16
|
+type PropsType = {
|
|
17
|
+ onDone: () => void,
|
|
18
|
+ isUpdate: boolean,
|
|
19
|
+ isAprilFools: boolean,
|
20
|
20
|
};
|
21
|
21
|
|
22
|
|
-type State = {
|
23
|
|
- currentSlide: number,
|
24
|
|
-}
|
|
22
|
+type StateType = {
|
|
23
|
+ currentSlide: number,
|
|
24
|
+};
|
25
|
25
|
|
26
|
|
-type Slide = {
|
27
|
|
- key: string,
|
28
|
|
- title: string,
|
29
|
|
- text: string,
|
30
|
|
- view: () => React.Node,
|
31
|
|
- mascotStyle: number,
|
32
|
|
- colors: [string, string]
|
|
26
|
+type IntroSlideType = {
|
|
27
|
+ key: string,
|
|
28
|
+ title: string,
|
|
29
|
+ text: string,
|
|
30
|
+ view: () => React.Node,
|
|
31
|
+ mascotStyle: number,
|
|
32
|
+ colors: [string, string],
|
33
|
33
|
};
|
34
|
34
|
|
|
35
|
+const styles = StyleSheet.create({
|
|
36
|
+ mainContent: {
|
|
37
|
+ paddingBottom: 100,
|
|
38
|
+ },
|
|
39
|
+ text: {
|
|
40
|
+ color: 'rgba(255, 255, 255, 0.8)',
|
|
41
|
+ backgroundColor: 'transparent',
|
|
42
|
+ textAlign: 'center',
|
|
43
|
+ paddingHorizontal: 16,
|
|
44
|
+ },
|
|
45
|
+ title: {
|
|
46
|
+ fontSize: 22,
|
|
47
|
+ color: 'white',
|
|
48
|
+ backgroundColor: 'transparent',
|
|
49
|
+ textAlign: 'center',
|
|
50
|
+ marginBottom: 16,
|
|
51
|
+ },
|
|
52
|
+ center: {
|
|
53
|
+ marginTop: 'auto',
|
|
54
|
+ marginBottom: 'auto',
|
|
55
|
+ marginRight: 'auto',
|
|
56
|
+ marginLeft: 'auto',
|
|
57
|
+ },
|
|
58
|
+});
|
|
59
|
+
|
35
|
60
|
/**
|
36
|
61
|
* Class used to create intro slides
|
37
|
62
|
*/
|
38
|
|
-export default class CustomIntroSlider extends React.Component<Props, State> {
|
|
63
|
+export default class CustomIntroSlider extends React.Component<
|
|
64
|
+ PropsType,
|
|
65
|
+ StateType,
|
|
66
|
+> {
|
|
67
|
+ sliderRef: {current: null | AppIntroSlider};
|
39
|
68
|
|
40
|
|
- state = {
|
41
|
|
- currentSlide: 0,
|
42
|
|
- }
|
43
|
|
-
|
44
|
|
- sliderRef: { current: null | AppIntroSlider };
|
|
69
|
+ introSlides: Array<IntroSlideType>;
|
45
|
70
|
|
46
|
|
- introSlides: Array<Slide>;
|
47
|
|
- updateSlides: Array<Slide>;
|
48
|
|
- aprilFoolsSlides: Array<Slide>;
|
49
|
|
- currentSlides: Array<Slide>;
|
|
71
|
+ updateSlides: Array<IntroSlideType>;
|
50
|
72
|
|
51
|
|
- /**
|
52
|
|
- * Generates intro slides
|
53
|
|
- */
|
54
|
|
- constructor() {
|
55
|
|
- super();
|
56
|
|
- this.sliderRef = React.createRef();
|
57
|
|
- this.introSlides = [
|
58
|
|
- {
|
59
|
|
- key: '0', // Mascot
|
60
|
|
- title: i18n.t('intro.slideMain.title'),
|
61
|
|
- text: i18n.t('intro.slideMain.text'),
|
62
|
|
- view: this.getWelcomeView,
|
63
|
|
- mascotStyle: MASCOT_STYLE.NORMAL,
|
64
|
|
- colors: ['#be1522', '#57080e'],
|
65
|
|
- },
|
66
|
|
- {
|
67
|
|
- key: '1',
|
68
|
|
- title: i18n.t('intro.slidePlanex.title'),
|
69
|
|
- text: i18n.t('intro.slidePlanex.text'),
|
70
|
|
- view: () => this.getIconView("calendar-clock"),
|
71
|
|
- mascotStyle: MASCOT_STYLE.INTELLO,
|
72
|
|
- colors: ['#be1522', '#57080e'],
|
73
|
|
- },
|
74
|
|
- {
|
75
|
|
- key: '2',
|
76
|
|
- title: i18n.t('intro.slideEvents.title'),
|
77
|
|
- text: i18n.t('intro.slideEvents.text'),
|
78
|
|
- view: () => this.getIconView("calendar-star",),
|
79
|
|
- mascotStyle: MASCOT_STYLE.HAPPY,
|
80
|
|
- colors: ['#be1522', '#57080e'],
|
81
|
|
- },
|
82
|
|
- {
|
83
|
|
- key: '3',
|
84
|
|
- title: i18n.t('intro.slideServices.title'),
|
85
|
|
- text: i18n.t('intro.slideServices.text'),
|
86
|
|
- view: () => this.getIconView("view-dashboard-variant",),
|
87
|
|
- mascotStyle: MASCOT_STYLE.CUTE,
|
88
|
|
- colors: ['#be1522', '#57080e'],
|
89
|
|
- },
|
90
|
|
- {
|
91
|
|
- key: '4',
|
92
|
|
- title: i18n.t('intro.slideDone.title'),
|
93
|
|
- text: i18n.t('intro.slideDone.text'),
|
94
|
|
- view: () => this.getEndView(),
|
95
|
|
- mascotStyle: MASCOT_STYLE.COOL,
|
96
|
|
- colors: ['#9c165b', '#3e042b'],
|
97
|
|
- },
|
98
|
|
- ];
|
99
|
|
- this.updateSlides = [];
|
100
|
|
- for (let i = 0; i < Update.slidesNumber; i++) {
|
101
|
|
- this.updateSlides.push(
|
102
|
|
- {
|
103
|
|
- key: i.toString(),
|
104
|
|
- title: Update.getInstance().titleList[i],
|
105
|
|
- text: Update.getInstance().descriptionList[i],
|
106
|
|
- icon: Update.iconList[i],
|
107
|
|
- colors: Update.colorsList[i],
|
108
|
|
- },
|
109
|
|
- );
|
110
|
|
- }
|
|
73
|
+ aprilFoolsSlides: Array<IntroSlideType>;
|
111
|
74
|
|
112
|
|
- this.aprilFoolsSlides = [
|
113
|
|
- {
|
114
|
|
- key: '1',
|
115
|
|
- title: i18n.t('intro.aprilFoolsSlide.title'),
|
116
|
|
- text: i18n.t('intro.aprilFoolsSlide.text'),
|
117
|
|
- view: () => <View/>,
|
118
|
|
- mascotStyle: MASCOT_STYLE.NORMAL,
|
119
|
|
- colors: ['#e01928', '#be1522'],
|
120
|
|
- },
|
121
|
|
- ];
|
122
|
|
- }
|
|
75
|
+ currentSlides: Array<IntroSlideType>;
|
123
|
76
|
|
124
|
|
- /**
|
125
|
|
- * Render item to be used for the intro introSlides
|
126
|
|
- *
|
127
|
|
- * @param item The item to be displayed
|
128
|
|
- * @param dimensions Dimensions of the item
|
129
|
|
- */
|
130
|
|
- getIntroRenderItem = ({item, dimensions}: { item: Slide, dimensions: { width: number, height: number } }) => {
|
131
|
|
- const index = parseInt(item.key);
|
132
|
|
- return (
|
133
|
|
- <LinearGradient
|
134
|
|
- style={[
|
135
|
|
- styles.mainContent,
|
136
|
|
- dimensions
|
137
|
|
- ]}
|
138
|
|
- colors={item.colors}
|
139
|
|
- start={{x: 0, y: 0.1}}
|
140
|
|
- end={{x: 0.1, y: 1}}
|
141
|
|
- >
|
142
|
|
- {this.state.currentSlide === index
|
143
|
|
- ? <View style={{height: "100%", flex: 1}}>
|
144
|
|
- <View style={{flex: 1}}>
|
145
|
|
- {item.view()}
|
146
|
|
- </View>
|
147
|
|
- <Animatable.View
|
148
|
|
- animation={"fadeIn"}>
|
149
|
|
- {index !== 0 && index !== this.introSlides.length - 1
|
150
|
|
- ?
|
151
|
|
- <Mascot
|
152
|
|
- style={{
|
153
|
|
- marginLeft: 30,
|
154
|
|
- marginBottom: 0,
|
155
|
|
- width: 100,
|
156
|
|
- marginTop: -30,
|
157
|
|
- }}
|
158
|
|
- emotion={item.mascotStyle}
|
159
|
|
- animated={true}
|
160
|
|
- entryAnimation={{
|
161
|
|
- animation: "slideInLeft",
|
162
|
|
- duration: 500
|
163
|
|
- }}
|
164
|
|
- loopAnimation={{
|
165
|
|
- animation: "pulse",
|
166
|
|
- iterationCount: "infinite",
|
167
|
|
- duration: 2000,
|
168
|
|
- }}
|
169
|
|
- /> : null}
|
170
|
|
- <View style={{
|
171
|
|
- marginLeft: 50,
|
172
|
|
- width: 0,
|
173
|
|
- height: 0,
|
174
|
|
- borderLeftWidth: 20,
|
175
|
|
- borderRightWidth: 0,
|
176
|
|
- borderBottomWidth: 20,
|
177
|
|
- borderStyle: 'solid',
|
178
|
|
- backgroundColor: 'transparent',
|
179
|
|
- borderLeftColor: 'transparent',
|
180
|
|
- borderRightColor: 'transparent',
|
181
|
|
- borderBottomColor: "rgba(0,0,0,0.60)",
|
182
|
|
- }}/>
|
183
|
|
- <Card style={{
|
184
|
|
- backgroundColor: "rgba(0,0,0,0.38)",
|
185
|
|
- marginHorizontal: 20,
|
186
|
|
- borderColor: "rgba(0,0,0,0.60)",
|
187
|
|
- borderWidth: 4,
|
188
|
|
- borderRadius: 10,
|
189
|
|
- }}>
|
190
|
|
- <Card.Content>
|
191
|
|
- <Animatable.Text
|
192
|
|
- animation={"fadeIn"}
|
193
|
|
- delay={100}
|
194
|
|
- style={styles.title}>
|
195
|
|
- {item.title}
|
196
|
|
- </Animatable.Text>
|
197
|
|
- <Animatable.Text
|
198
|
|
- animation={"fadeIn"}
|
199
|
|
- delay={200}
|
200
|
|
- style={styles.text}>
|
201
|
|
- {item.text}
|
202
|
|
- </Animatable.Text>
|
203
|
|
- </Card.Content>
|
204
|
|
- </Card>
|
205
|
|
- </Animatable.View>
|
206
|
|
- </View> : null}
|
207
|
|
- </LinearGradient>
|
208
|
|
- );
|
|
77
|
+ /**
|
|
78
|
+ * Generates intro slides
|
|
79
|
+ */
|
|
80
|
+ constructor() {
|
|
81
|
+ super();
|
|
82
|
+ this.state = {
|
|
83
|
+ currentSlide: 0,
|
|
84
|
+ };
|
|
85
|
+ this.sliderRef = React.createRef();
|
|
86
|
+ this.introSlides = [
|
|
87
|
+ {
|
|
88
|
+ key: '0', // Mascot
|
|
89
|
+ title: i18n.t('intro.slideMain.title'),
|
|
90
|
+ text: i18n.t('intro.slideMain.text'),
|
|
91
|
+ view: this.getWelcomeView,
|
|
92
|
+ mascotStyle: MASCOT_STYLE.NORMAL,
|
|
93
|
+ colors: ['#be1522', '#57080e'],
|
|
94
|
+ },
|
|
95
|
+ {
|
|
96
|
+ key: '1',
|
|
97
|
+ title: i18n.t('intro.slidePlanex.title'),
|
|
98
|
+ text: i18n.t('intro.slidePlanex.text'),
|
|
99
|
+ view: (): React.Node => CustomIntroSlider.getIconView('calendar-clock'),
|
|
100
|
+ mascotStyle: MASCOT_STYLE.INTELLO,
|
|
101
|
+ colors: ['#be1522', '#57080e'],
|
|
102
|
+ },
|
|
103
|
+ {
|
|
104
|
+ key: '2',
|
|
105
|
+ title: i18n.t('intro.slideEvents.title'),
|
|
106
|
+ text: i18n.t('intro.slideEvents.text'),
|
|
107
|
+ view: (): React.Node => CustomIntroSlider.getIconView('calendar-star'),
|
|
108
|
+ mascotStyle: MASCOT_STYLE.HAPPY,
|
|
109
|
+ colors: ['#be1522', '#57080e'],
|
|
110
|
+ },
|
|
111
|
+ {
|
|
112
|
+ key: '3',
|
|
113
|
+ title: i18n.t('intro.slideServices.title'),
|
|
114
|
+ text: i18n.t('intro.slideServices.text'),
|
|
115
|
+ view: (): React.Node =>
|
|
116
|
+ CustomIntroSlider.getIconView('view-dashboard-variant'),
|
|
117
|
+ mascotStyle: MASCOT_STYLE.CUTE,
|
|
118
|
+ colors: ['#be1522', '#57080e'],
|
|
119
|
+ },
|
|
120
|
+ {
|
|
121
|
+ key: '4',
|
|
122
|
+ title: i18n.t('intro.slideDone.title'),
|
|
123
|
+ text: i18n.t('intro.slideDone.text'),
|
|
124
|
+ view: (): React.Node => this.getEndView(),
|
|
125
|
+ mascotStyle: MASCOT_STYLE.COOL,
|
|
126
|
+ colors: ['#9c165b', '#3e042b'],
|
|
127
|
+ },
|
|
128
|
+ ];
|
|
129
|
+ // $FlowFixMe
|
|
130
|
+ this.updateSlides = [];
|
|
131
|
+ for (let i = 0; i < Update.slidesNumber; i += 1) {
|
|
132
|
+ this.updateSlides.push({
|
|
133
|
+ key: i.toString(),
|
|
134
|
+ title: Update.getInstance().titleList[i],
|
|
135
|
+ text: Update.getInstance().descriptionList[i],
|
|
136
|
+ icon: Update.iconList[i],
|
|
137
|
+ colors: Update.colorsList[i],
|
|
138
|
+ });
|
209
|
139
|
}
|
210
|
140
|
|
211
|
|
- getEndView = () => {
|
212
|
|
- return (
|
213
|
|
- <View style={{flex: 1}}>
|
214
|
|
- <Mascot
|
215
|
|
- style={{
|
216
|
|
- ...styles.center,
|
217
|
|
- height: "80%"
|
218
|
|
- }}
|
219
|
|
- emotion={MASCOT_STYLE.COOL}
|
220
|
|
- animated={true}
|
221
|
|
- entryAnimation={{
|
222
|
|
- animation: "slideInDown",
|
223
|
|
- duration: 2000,
|
224
|
|
- }}
|
225
|
|
- loopAnimation={{
|
226
|
|
- animation: "pulse",
|
227
|
|
- duration: 2000,
|
228
|
|
- iterationCount: "infinite"
|
229
|
|
- }}
|
230
|
|
- />
|
231
|
|
- </View>
|
232
|
|
- );
|
233
|
|
- }
|
|
141
|
+ this.aprilFoolsSlides = [
|
|
142
|
+ {
|
|
143
|
+ key: '1',
|
|
144
|
+ title: i18n.t('intro.aprilFoolsSlide.title'),
|
|
145
|
+ text: i18n.t('intro.aprilFoolsSlide.text'),
|
|
146
|
+ view: (): React.Node => <View />,
|
|
147
|
+ mascotStyle: MASCOT_STYLE.NORMAL,
|
|
148
|
+ colors: ['#e01928', '#be1522'],
|
|
149
|
+ },
|
|
150
|
+ ];
|
|
151
|
+ }
|
234
|
152
|
|
235
|
|
- getWelcomeView = () => {
|
236
|
|
- return (
|
237
|
|
- <View style={{flex: 1}}>
|
|
153
|
+ /**
|
|
154
|
+ * Render item to be used for the intro introSlides
|
|
155
|
+ *
|
|
156
|
+ * @param item The item to be displayed
|
|
157
|
+ * @param dimensions Dimensions of the item
|
|
158
|
+ */
|
|
159
|
+ getIntroRenderItem = ({
|
|
160
|
+ item,
|
|
161
|
+ dimensions,
|
|
162
|
+ }: {
|
|
163
|
+ item: IntroSlideType,
|
|
164
|
+ dimensions: {width: number, height: number},
|
|
165
|
+ }): React.Node => {
|
|
166
|
+ const {state} = this;
|
|
167
|
+ const index = parseInt(item.key, 10);
|
|
168
|
+ return (
|
|
169
|
+ <LinearGradient
|
|
170
|
+ style={[styles.mainContent, dimensions]}
|
|
171
|
+ colors={item.colors}
|
|
172
|
+ start={{x: 0, y: 0.1}}
|
|
173
|
+ end={{x: 0.1, y: 1}}>
|
|
174
|
+ {state.currentSlide === index ? (
|
|
175
|
+ <View style={{height: '100%', flex: 1}}>
|
|
176
|
+ <View style={{flex: 1}}>{item.view()}</View>
|
|
177
|
+ <Animatable.View animation="fadeIn">
|
|
178
|
+ {index !== 0 && index !== this.introSlides.length - 1 ? (
|
238
|
179
|
<Mascot
|
239
|
|
- style={{
|
240
|
|
- ...styles.center,
|
241
|
|
- height: "80%"
|
242
|
|
- }}
|
243
|
|
- emotion={MASCOT_STYLE.NORMAL}
|
244
|
|
- animated={true}
|
245
|
|
- entryAnimation={{
|
246
|
|
- animation: "bounceIn",
|
247
|
|
- duration: 2000,
|
248
|
|
- }}
|
|
180
|
+ style={{
|
|
181
|
+ marginLeft: 30,
|
|
182
|
+ marginBottom: 0,
|
|
183
|
+ width: 100,
|
|
184
|
+ marginTop: -30,
|
|
185
|
+ }}
|
|
186
|
+ emotion={item.mascotStyle}
|
|
187
|
+ animated
|
|
188
|
+ entryAnimation={{
|
|
189
|
+ animation: 'slideInLeft',
|
|
190
|
+ duration: 500,
|
|
191
|
+ }}
|
|
192
|
+ loopAnimation={{
|
|
193
|
+ animation: 'pulse',
|
|
194
|
+ iterationCount: 'infinite',
|
|
195
|
+ duration: 2000,
|
|
196
|
+ }}
|
249
|
197
|
/>
|
250
|
|
- <Animatable.Text
|
251
|
|
- useNativeDriver={true}
|
252
|
|
- animation={"fadeInUp"}
|
253
|
|
- duration={500}
|
254
|
|
-
|
255
|
|
- style={{
|
256
|
|
- color: "#fff",
|
257
|
|
- textAlign: "center",
|
258
|
|
- fontSize: 25,
|
259
|
|
- }}>
|
260
|
|
- PABLO
|
261
|
|
- </Animatable.Text>
|
262
|
|
- <Animatable.View
|
263
|
|
- useNativeDriver={true}
|
264
|
|
- animation={"fadeInUp"}
|
265
|
|
- duration={500}
|
|
198
|
+ ) : null}
|
|
199
|
+ <View
|
|
200
|
+ style={{
|
|
201
|
+ marginLeft: 50,
|
|
202
|
+ width: 0,
|
|
203
|
+ height: 0,
|
|
204
|
+ borderLeftWidth: 20,
|
|
205
|
+ borderRightWidth: 0,
|
|
206
|
+ borderBottomWidth: 20,
|
|
207
|
+ borderStyle: 'solid',
|
|
208
|
+ backgroundColor: 'transparent',
|
|
209
|
+ borderLeftColor: 'transparent',
|
|
210
|
+ borderRightColor: 'transparent',
|
|
211
|
+ borderBottomColor: 'rgba(0,0,0,0.60)',
|
|
212
|
+ }}
|
|
213
|
+ />
|
|
214
|
+ <Card
|
|
215
|
+ style={{
|
|
216
|
+ backgroundColor: 'rgba(0,0,0,0.38)',
|
|
217
|
+ marginHorizontal: 20,
|
|
218
|
+ borderColor: 'rgba(0,0,0,0.60)',
|
|
219
|
+ borderWidth: 4,
|
|
220
|
+ borderRadius: 10,
|
|
221
|
+ }}>
|
|
222
|
+ <Card.Content>
|
|
223
|
+ <Animatable.Text
|
|
224
|
+ animation="fadeIn"
|
|
225
|
+ delay={100}
|
|
226
|
+ style={styles.title}>
|
|
227
|
+ {item.title}
|
|
228
|
+ </Animatable.Text>
|
|
229
|
+ <Animatable.Text
|
|
230
|
+ animation="fadeIn"
|
266
|
231
|
delay={200}
|
|
232
|
+ style={styles.text}>
|
|
233
|
+ {item.text}
|
|
234
|
+ </Animatable.Text>
|
|
235
|
+ </Card.Content>
|
|
236
|
+ </Card>
|
|
237
|
+ </Animatable.View>
|
|
238
|
+ </View>
|
|
239
|
+ ) : null}
|
|
240
|
+ </LinearGradient>
|
|
241
|
+ );
|
|
242
|
+ };
|
267
|
243
|
|
268
|
|
- style={{
|
269
|
|
- position: "absolute",
|
270
|
|
- bottom: 30,
|
271
|
|
- right: "20%",
|
272
|
|
- width: 50,
|
273
|
|
- height: 50,
|
274
|
|
- }}>
|
275
|
|
- <MaterialCommunityIcons
|
276
|
|
- style={{
|
277
|
|
- ...styles.center,
|
278
|
|
- transform: [{rotateZ: "70deg"}],
|
279
|
|
- }}
|
280
|
|
- name={"undo"}
|
281
|
|
- color={'#fff'}
|
282
|
|
- size={40}/>
|
283
|
|
- </Animatable.View>
|
284
|
|
- </View>
|
285
|
|
- )
|
286
|
|
- }
|
287
|
|
-
|
288
|
|
- getIconView(icon: MaterialCommunityIconsGlyphs) {
|
289
|
|
- return (
|
290
|
|
- <View style={{flex: 1}}>
|
291
|
|
- <Animatable.View
|
292
|
|
- style={styles.center}
|
293
|
|
- animation={"fadeIn"}
|
294
|
|
- >
|
295
|
|
- <MaterialCommunityIcons
|
296
|
|
- name={icon}
|
297
|
|
- color={'#fff'}
|
298
|
|
- size={200}/>
|
299
|
|
- </Animatable.View>
|
300
|
|
- </View>
|
301
|
|
- )
|
302
|
|
- }
|
303
|
|
-
|
304
|
|
- setStatusBarColor(color: string) {
|
305
|
|
- if (Platform.OS === 'android')
|
306
|
|
- StatusBar.setBackgroundColor(color, true);
|
307
|
|
- }
|
308
|
|
-
|
309
|
|
- onSlideChange = (index: number, lastIndex: number) => {
|
310
|
|
- this.setStatusBarColor(this.currentSlides[index].colors[0]);
|
311
|
|
- this.setState({currentSlide: index});
|
312
|
|
- };
|
313
|
|
-
|
314
|
|
- onSkip = () => {
|
315
|
|
- this.setStatusBarColor(this.currentSlides[this.currentSlides.length - 1].colors[0]);
|
316
|
|
- if (this.sliderRef.current != null)
|
317
|
|
- this.sliderRef.current.goToSlide(this.currentSlides.length - 1);
|
318
|
|
- }
|
|
244
|
+ getEndView = (): React.Node => {
|
|
245
|
+ return (
|
|
246
|
+ <View style={{flex: 1}}>
|
|
247
|
+ <Mascot
|
|
248
|
+ style={{
|
|
249
|
+ ...styles.center,
|
|
250
|
+ height: '80%',
|
|
251
|
+ }}
|
|
252
|
+ emotion={MASCOT_STYLE.COOL}
|
|
253
|
+ animated
|
|
254
|
+ entryAnimation={{
|
|
255
|
+ animation: 'slideInDown',
|
|
256
|
+ duration: 2000,
|
|
257
|
+ }}
|
|
258
|
+ loopAnimation={{
|
|
259
|
+ animation: 'pulse',
|
|
260
|
+ duration: 2000,
|
|
261
|
+ iterationCount: 'infinite',
|
|
262
|
+ }}
|
|
263
|
+ />
|
|
264
|
+ </View>
|
|
265
|
+ );
|
|
266
|
+ };
|
319
|
267
|
|
320
|
|
- onDone = () => {
|
321
|
|
- this.setStatusBarColor(ThemeManager.getCurrentTheme().colors.surface);
|
322
|
|
- this.props.onDone();
|
323
|
|
- }
|
|
268
|
+ getWelcomeView = (): React.Node => {
|
|
269
|
+ return (
|
|
270
|
+ <View style={{flex: 1}}>
|
|
271
|
+ <Mascot
|
|
272
|
+ style={{
|
|
273
|
+ ...styles.center,
|
|
274
|
+ height: '80%',
|
|
275
|
+ }}
|
|
276
|
+ emotion={MASCOT_STYLE.NORMAL}
|
|
277
|
+ animated
|
|
278
|
+ entryAnimation={{
|
|
279
|
+ animation: 'bounceIn',
|
|
280
|
+ duration: 2000,
|
|
281
|
+ }}
|
|
282
|
+ />
|
|
283
|
+ <Animatable.Text
|
|
284
|
+ useNativeDriver
|
|
285
|
+ animation="fadeInUp"
|
|
286
|
+ duration={500}
|
|
287
|
+ style={{
|
|
288
|
+ color: '#fff',
|
|
289
|
+ textAlign: 'center',
|
|
290
|
+ fontSize: 25,
|
|
291
|
+ }}>
|
|
292
|
+ PABLO
|
|
293
|
+ </Animatable.Text>
|
|
294
|
+ <Animatable.View
|
|
295
|
+ useNativeDriver
|
|
296
|
+ animation="fadeInUp"
|
|
297
|
+ duration={500}
|
|
298
|
+ delay={200}
|
|
299
|
+ style={{
|
|
300
|
+ position: 'absolute',
|
|
301
|
+ bottom: 30,
|
|
302
|
+ right: '20%',
|
|
303
|
+ width: 50,
|
|
304
|
+ height: 50,
|
|
305
|
+ }}>
|
|
306
|
+ <MaterialCommunityIcons
|
|
307
|
+ style={{
|
|
308
|
+ ...styles.center,
|
|
309
|
+ transform: [{rotateZ: '70deg'}],
|
|
310
|
+ }}
|
|
311
|
+ name="undo"
|
|
312
|
+ color="#fff"
|
|
313
|
+ size={40}
|
|
314
|
+ />
|
|
315
|
+ </Animatable.View>
|
|
316
|
+ </View>
|
|
317
|
+ );
|
|
318
|
+ };
|
324
|
319
|
|
325
|
|
- renderNextButton = () => {
|
326
|
|
- return (
|
327
|
|
- <Animatable.View
|
328
|
|
- animation={"fadeIn"}
|
|
320
|
+ static getIconView(icon: MaterialCommunityIconsGlyphs): React.Node {
|
|
321
|
+ return (
|
|
322
|
+ <View style={{flex: 1}}>
|
|
323
|
+ <Animatable.View style={styles.center} animation="fadeIn">
|
|
324
|
+ <MaterialCommunityIcons name={icon} color="#fff" size={200} />
|
|
325
|
+ </Animatable.View>
|
|
326
|
+ </View>
|
|
327
|
+ );
|
|
328
|
+ }
|
329
|
329
|
|
330
|
|
- style={{
|
331
|
|
- borderRadius: 25,
|
332
|
|
- padding: 5,
|
333
|
|
- backgroundColor: "rgba(0,0,0,0.2)"
|
334
|
|
- }}>
|
335
|
|
- <MaterialCommunityIcons
|
336
|
|
- name={"arrow-right"}
|
337
|
|
- color={'#fff'}
|
338
|
|
- size={40}/>
|
339
|
|
- </Animatable.View>
|
340
|
|
- )
|
341
|
|
- }
|
|
330
|
+ static setStatusBarColor(color: string) {
|
|
331
|
+ if (Platform.OS === 'android') StatusBar.setBackgroundColor(color, true);
|
|
332
|
+ }
|
342
|
333
|
|
343
|
|
- renderDoneButton = () => {
|
344
|
|
- return (
|
345
|
|
- <Animatable.View
|
346
|
|
- animation={"bounceIn"}
|
|
334
|
+ onSlideChange = (index: number) => {
|
|
335
|
+ CustomIntroSlider.setStatusBarColor(this.currentSlides[index].colors[0]);
|
|
336
|
+ this.setState({currentSlide: index});
|
|
337
|
+ };
|
347
|
338
|
|
348
|
|
- style={{
|
349
|
|
- borderRadius: 25,
|
350
|
|
- padding: 5,
|
351
|
|
- backgroundColor: "rgb(190,21,34)"
|
352
|
|
- }}>
|
353
|
|
- <MaterialCommunityIcons
|
354
|
|
- name={"check"}
|
355
|
|
- color={'#fff'}
|
356
|
|
- size={40}/>
|
357
|
|
- </Animatable.View>
|
358
|
|
- )
|
359
|
|
- }
|
|
339
|
+ onSkip = () => {
|
|
340
|
+ CustomIntroSlider.setStatusBarColor(
|
|
341
|
+ this.currentSlides[this.currentSlides.length - 1].colors[0],
|
|
342
|
+ );
|
|
343
|
+ if (this.sliderRef.current != null)
|
|
344
|
+ this.sliderRef.current.goToSlide(this.currentSlides.length - 1);
|
|
345
|
+ };
|
360
|
346
|
|
361
|
|
- render() {
|
362
|
|
- this.currentSlides = this.introSlides;
|
363
|
|
- if (this.props.isUpdate)
|
364
|
|
- this.currentSlides = this.updateSlides;
|
365
|
|
- else if (this.props.isAprilFools)
|
366
|
|
- this.currentSlides = this.aprilFoolsSlides;
|
367
|
|
- this.setStatusBarColor(this.currentSlides[0].colors[0]);
|
368
|
|
- return (
|
369
|
|
- <AppIntroSlider
|
370
|
|
- ref={this.sliderRef}
|
371
|
|
- data={this.currentSlides}
|
372
|
|
- extraData={this.state.currentSlide}
|
|
347
|
+ onDone = () => {
|
|
348
|
+ const {props} = this;
|
|
349
|
+ CustomIntroSlider.setStatusBarColor(
|
|
350
|
+ ThemeManager.getCurrentTheme().colors.surface,
|
|
351
|
+ );
|
|
352
|
+ props.onDone();
|
|
353
|
+ };
|
373
|
354
|
|
374
|
|
- renderItem={this.getIntroRenderItem}
|
375
|
|
- renderNextButton={this.renderNextButton}
|
376
|
|
- renderDoneButton={this.renderDoneButton}
|
|
355
|
+ getRenderNextButton = (): React.Node => {
|
|
356
|
+ return (
|
|
357
|
+ <Animatable.View
|
|
358
|
+ animation="fadeIn"
|
|
359
|
+ style={{
|
|
360
|
+ borderRadius: 25,
|
|
361
|
+ padding: 5,
|
|
362
|
+ backgroundColor: 'rgba(0,0,0,0.2)',
|
|
363
|
+ }}>
|
|
364
|
+ <MaterialCommunityIcons name="arrow-right" color="#fff" size={40} />
|
|
365
|
+ </Animatable.View>
|
|
366
|
+ );
|
|
367
|
+ };
|
377
|
368
|
|
378
|
|
- onDone={this.onDone}
|
379
|
|
- onSlideChange={this.onSlideChange}
|
380
|
|
- onSkip={this.onSkip}
|
381
|
|
- />
|
382
|
|
- );
|
383
|
|
- }
|
|
369
|
+ getRenderDoneButton = (): React.Node => {
|
|
370
|
+ return (
|
|
371
|
+ <Animatable.View
|
|
372
|
+ animation="bounceIn"
|
|
373
|
+ style={{
|
|
374
|
+ borderRadius: 25,
|
|
375
|
+ padding: 5,
|
|
376
|
+ backgroundColor: 'rgb(190,21,34)',
|
|
377
|
+ }}>
|
|
378
|
+ <MaterialCommunityIcons name="check" color="#fff" size={40} />
|
|
379
|
+ </Animatable.View>
|
|
380
|
+ );
|
|
381
|
+ };
|
384
|
382
|
|
|
383
|
+ render(): React.Node {
|
|
384
|
+ const {props, state} = this;
|
|
385
|
+ this.currentSlides = this.introSlides;
|
|
386
|
+ if (props.isUpdate) this.currentSlides = this.updateSlides;
|
|
387
|
+ else if (props.isAprilFools) this.currentSlides = this.aprilFoolsSlides;
|
|
388
|
+ CustomIntroSlider.setStatusBarColor(this.currentSlides[0].colors[0]);
|
|
389
|
+ return (
|
|
390
|
+ <AppIntroSlider
|
|
391
|
+ ref={this.sliderRef}
|
|
392
|
+ data={this.currentSlides}
|
|
393
|
+ extraData={state.currentSlide}
|
|
394
|
+ renderItem={this.getIntroRenderItem}
|
|
395
|
+ renderNextButton={this.getRenderNextButton}
|
|
396
|
+ renderDoneButton={this.getRenderDoneButton}
|
|
397
|
+ onDone={this.onDone}
|
|
398
|
+ onSlideChange={this.onSlideChange}
|
|
399
|
+ onSkip={this.onSkip}
|
|
400
|
+ />
|
|
401
|
+ );
|
|
402
|
+ }
|
385
|
403
|
}
|
386
|
|
-
|
387
|
|
-
|
388
|
|
-const styles = StyleSheet.create({
|
389
|
|
- mainContent: {
|
390
|
|
- paddingBottom: 100,
|
391
|
|
- },
|
392
|
|
- text: {
|
393
|
|
- color: 'rgba(255, 255, 255, 0.8)',
|
394
|
|
- backgroundColor: 'transparent',
|
395
|
|
- textAlign: 'center',
|
396
|
|
- paddingHorizontal: 16,
|
397
|
|
- },
|
398
|
|
- title: {
|
399
|
|
- fontSize: 22,
|
400
|
|
- color: 'white',
|
401
|
|
- backgroundColor: 'transparent',
|
402
|
|
- textAlign: 'center',
|
403
|
|
- marginBottom: 16,
|
404
|
|
- },
|
405
|
|
- center: {
|
406
|
|
- marginTop: 'auto',
|
407
|
|
- marginBottom: 'auto',
|
408
|
|
- marginRight: 'auto',
|
409
|
|
- marginLeft: 'auto',
|
410
|
|
- },
|
411
|
|
-});
|