@rubixscript/react-native-onboarding 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +383 -383
- package/dist/components/NavigationButtons.d.ts +23 -0
- package/dist/components/NavigationButtons.d.ts.map +1 -0
- package/dist/components/NavigationButtons.js +106 -0
- package/dist/components/Onboarding.d.ts +11 -0
- package/dist/components/Onboarding.d.ts.map +1 -0
- package/dist/components/Onboarding.js +219 -0
- package/dist/components/Pagination.d.ts +5 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +269 -0
- package/dist/components/SimpleOnboardingScreen.d.ts +54 -0
- package/dist/components/SimpleOnboardingScreen.d.ts.map +1 -0
- package/dist/components/SimpleOnboardingScreen.js +184 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +5 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/presets/index.d.ts +27 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +370 -0
- package/dist/slides/FormSlide.d.ts +12 -0
- package/dist/slides/FormSlide.d.ts.map +1 -0
- package/dist/slides/FormSlide.js +227 -0
- package/dist/slides/IconSlide.d.ts +10 -0
- package/dist/slides/IconSlide.d.ts.map +1 -0
- package/dist/slides/IconSlide.js +133 -0
- package/dist/slides/ImageSlide.d.ts +10 -0
- package/dist/slides/ImageSlide.d.ts.map +1 -0
- package/dist/slides/ImageSlide.js +99 -0
- package/dist/slides/VideoSlide.d.ts +10 -0
- package/dist/slides/VideoSlide.d.ts.map +1 -0
- package/dist/slides/VideoSlide.js +101 -0
- package/dist/slides/index.d.ts +14 -0
- package/dist/slides/index.d.ts.map +1 -0
- package/dist/slides/index.js +25 -0
- package/dist/themes/index.d.ts +35 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +547 -0
- package/dist/types/index.d.ts +191 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +73 -60
- package/src/components/NavigationButtons.tsx +198 -198
- package/src/components/Onboarding.tsx +337 -340
- package/src/components/Pagination.tsx +337 -337
- package/src/components/SimpleOnboardingScreen.tsx +266 -0
- package/src/components/index.ts +7 -5
- package/src/index.ts +69 -65
- package/src/presets/index.ts +391 -394
- package/src/slides/FormSlide.tsx +314 -314
- package/src/slides/IconSlide.tsx +166 -166
- package/src/slides/ImageSlide.tsx +132 -132
- package/src/slides/VideoSlide.tsx +146 -146
- package/src/slides/{index.ts → index.tsx} +37 -44
- package/src/themes/index.ts +576 -574
- package/src/types/index.ts +247 -247
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/** METADATA
|
|
2
|
+
* @component SimpleOnboardingScreen
|
|
3
|
+
* @description A simple, beautiful onboarding screen with customizable slides, colors, and styling
|
|
4
|
+
*
|
|
5
|
+
* @props
|
|
6
|
+
* - onComplete: () => void - Handler called when onboarding is finished
|
|
7
|
+
* - slides: SimpleSlide[] - Array of slides to display (optional, has default)
|
|
8
|
+
* - primaryColor: string - Primary color for buttons and active dots (default: '#FF6B6B')
|
|
9
|
+
* - backgroundColor: string - Background color of the screen (default: '#F6F6F6')
|
|
10
|
+
* - iconBackgroundColor: string - Background color for icon container (default: 'rgba(255, 107, 107, 0.1)')
|
|
11
|
+
* - textColor: string - Color for titles (default: '#000000')
|
|
12
|
+
* - descriptionColor: string - Color for descriptions (default: '#666666')
|
|
13
|
+
* - buttonTextNext: string - Text for next button (default: 'Next')
|
|
14
|
+
* - buttonTextDone: string - Text for done button (default: 'Get Started')
|
|
15
|
+
* - testID?: string - Test identifier for testing
|
|
16
|
+
*
|
|
17
|
+
* @states
|
|
18
|
+
* - currentIndex: number - Current onboarding screen index
|
|
19
|
+
*
|
|
20
|
+
* @features
|
|
21
|
+
* - Step-by-step app introduction
|
|
22
|
+
* - Interactive animations
|
|
23
|
+
* - Feature highlights
|
|
24
|
+
* - Progress indication
|
|
25
|
+
* - Fully customizable styling
|
|
26
|
+
*
|
|
27
|
+
* @dependencies
|
|
28
|
+
* - react-native-reanimated: For animations
|
|
29
|
+
* - @expo/vector-icons: For UI icons
|
|
30
|
+
* - react-native components
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import React, { useRef, useState } from 'react';
|
|
34
|
+
import {
|
|
35
|
+
View,
|
|
36
|
+
Text,
|
|
37
|
+
StyleSheet,
|
|
38
|
+
Dimensions,
|
|
39
|
+
TouchableOpacity,
|
|
40
|
+
FlatList,
|
|
41
|
+
Platform,
|
|
42
|
+
StatusBar,
|
|
43
|
+
} from 'react-native';
|
|
44
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
45
|
+
import { BlurView } from 'expo-blur';
|
|
46
|
+
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
|
47
|
+
import Animated, { FadeIn } from 'react-native-reanimated';
|
|
48
|
+
|
|
49
|
+
const { width } = Dimensions.get('window');
|
|
50
|
+
|
|
51
|
+
export interface SimpleSlide {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
description: string;
|
|
55
|
+
icon: keyof typeof MaterialCommunityIcons.glyphMap;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const defaultSlides: SimpleSlide[] = [
|
|
59
|
+
{
|
|
60
|
+
id: '1',
|
|
61
|
+
title: 'Focus Timer',
|
|
62
|
+
description: 'Stay productive with our Pomodoro timer. Work in focused intervals for better results.',
|
|
63
|
+
icon: 'timer-outline',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: '2',
|
|
67
|
+
title: 'Task Management',
|
|
68
|
+
description: 'Organize your tasks efficiently. Track progress and set priorities with ease.',
|
|
69
|
+
icon: 'checkbox-marked-circle-outline',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: '3',
|
|
73
|
+
title: 'Statistics',
|
|
74
|
+
description: 'Monitor your productivity with detailed statistics and insights.',
|
|
75
|
+
icon: 'chart-line',
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
interface SimpleOnboardingScreenProps {
|
|
80
|
+
onComplete: () => Promise<void>;
|
|
81
|
+
slides?: SimpleSlide[];
|
|
82
|
+
primaryColor?: string;
|
|
83
|
+
backgroundColor?: string;
|
|
84
|
+
iconBackgroundColor?: string;
|
|
85
|
+
textColor?: string;
|
|
86
|
+
descriptionColor?: string;
|
|
87
|
+
buttonTextNext?: string;
|
|
88
|
+
buttonTextDone?: string;
|
|
89
|
+
testID?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default function SimpleOnboardingScreen({
|
|
93
|
+
onComplete,
|
|
94
|
+
slides = defaultSlides,
|
|
95
|
+
primaryColor = '#FF6B6B',
|
|
96
|
+
backgroundColor = '#F6F6F6',
|
|
97
|
+
iconBackgroundColor = 'rgba(255, 107, 107, 0.1)',
|
|
98
|
+
textColor = '#000000',
|
|
99
|
+
descriptionColor = '#666666',
|
|
100
|
+
buttonTextNext = 'Next',
|
|
101
|
+
buttonTextDone = 'Get Started',
|
|
102
|
+
testID,
|
|
103
|
+
}: SimpleOnboardingScreenProps) {
|
|
104
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
105
|
+
const flatListRef = useRef<FlatList>(null);
|
|
106
|
+
|
|
107
|
+
const renderSlide = ({ item }: { item: SimpleSlide }) => (
|
|
108
|
+
<View style={styles.slide}>
|
|
109
|
+
<Animated.View
|
|
110
|
+
entering={FadeIn.duration(500)}
|
|
111
|
+
style={[styles.iconContainer, { backgroundColor: iconBackgroundColor }]}
|
|
112
|
+
>
|
|
113
|
+
<MaterialCommunityIcons
|
|
114
|
+
name={item.icon}
|
|
115
|
+
size={80}
|
|
116
|
+
color={textColor}
|
|
117
|
+
/>
|
|
118
|
+
</Animated.View>
|
|
119
|
+
<Text style={[styles.title, { color: textColor }]}>
|
|
120
|
+
{item.title}
|
|
121
|
+
</Text>
|
|
122
|
+
<Text style={[styles.description, { color: descriptionColor }]}>
|
|
123
|
+
{item.description}
|
|
124
|
+
</Text>
|
|
125
|
+
</View>
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const handleNext = () => {
|
|
129
|
+
if (currentIndex < slides.length - 1) {
|
|
130
|
+
flatListRef.current?.scrollToIndex({
|
|
131
|
+
index: currentIndex + 1,
|
|
132
|
+
animated: true,
|
|
133
|
+
});
|
|
134
|
+
setCurrentIndex(currentIndex + 1);
|
|
135
|
+
} else {
|
|
136
|
+
onComplete();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<SafeAreaView testID={testID} style={[styles.container, { backgroundColor }]} edges={['top', 'bottom']}>
|
|
142
|
+
<StatusBar
|
|
143
|
+
barStyle="dark-content"
|
|
144
|
+
backgroundColor="transparent"
|
|
145
|
+
translucent
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<FlatList
|
|
149
|
+
ref={flatListRef}
|
|
150
|
+
data={slides}
|
|
151
|
+
renderItem={renderSlide}
|
|
152
|
+
horizontal
|
|
153
|
+
pagingEnabled
|
|
154
|
+
showsHorizontalScrollIndicator={false}
|
|
155
|
+
onMomentumScrollEnd={(event) => {
|
|
156
|
+
const index = Math.round(event.nativeEvent.contentOffset.x / width);
|
|
157
|
+
setCurrentIndex(index);
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
|
|
161
|
+
<BlurView
|
|
162
|
+
intensity={80}
|
|
163
|
+
tint="light"
|
|
164
|
+
style={styles.footer}
|
|
165
|
+
>
|
|
166
|
+
<View style={styles.pagination}>
|
|
167
|
+
{slides.map((_, index) => (
|
|
168
|
+
<View
|
|
169
|
+
key={index}
|
|
170
|
+
style={[
|
|
171
|
+
styles.paginationDot,
|
|
172
|
+
index === currentIndex && styles.paginationDotActive,
|
|
173
|
+
index === currentIndex && { backgroundColor: primaryColor },
|
|
174
|
+
]}
|
|
175
|
+
/>
|
|
176
|
+
))}
|
|
177
|
+
</View>
|
|
178
|
+
|
|
179
|
+
<TouchableOpacity
|
|
180
|
+
style={[styles.button, { backgroundColor: primaryColor }]}
|
|
181
|
+
onPress={handleNext}
|
|
182
|
+
>
|
|
183
|
+
<Text style={styles.buttonText}>
|
|
184
|
+
{currentIndex === slides.length - 1 ? buttonTextDone : buttonTextNext}
|
|
185
|
+
</Text>
|
|
186
|
+
</TouchableOpacity>
|
|
187
|
+
</BlurView>
|
|
188
|
+
</SafeAreaView>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const styles = StyleSheet.create({
|
|
193
|
+
container: {
|
|
194
|
+
flex: 1,
|
|
195
|
+
},
|
|
196
|
+
slide: {
|
|
197
|
+
width,
|
|
198
|
+
alignItems: 'center',
|
|
199
|
+
justifyContent: 'center',
|
|
200
|
+
paddingHorizontal: 40,
|
|
201
|
+
},
|
|
202
|
+
iconContainer: {
|
|
203
|
+
width: 160,
|
|
204
|
+
height: 160,
|
|
205
|
+
borderRadius: 80,
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
justifyContent: 'center',
|
|
208
|
+
marginBottom: 40,
|
|
209
|
+
},
|
|
210
|
+
title: {
|
|
211
|
+
fontSize: 28,
|
|
212
|
+
fontWeight: '700',
|
|
213
|
+
marginBottom: 16,
|
|
214
|
+
textAlign: 'center',
|
|
215
|
+
},
|
|
216
|
+
description: {
|
|
217
|
+
fontSize: 17,
|
|
218
|
+
textAlign: 'center',
|
|
219
|
+
lineHeight: 24,
|
|
220
|
+
},
|
|
221
|
+
footer: {
|
|
222
|
+
position: 'absolute',
|
|
223
|
+
bottom: 0,
|
|
224
|
+
left: 0,
|
|
225
|
+
right: 0,
|
|
226
|
+
paddingHorizontal: 20,
|
|
227
|
+
paddingVertical: 20,
|
|
228
|
+
flexDirection: 'row',
|
|
229
|
+
justifyContent: 'space-between',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
},
|
|
232
|
+
pagination: {
|
|
233
|
+
flexDirection: 'row',
|
|
234
|
+
gap: 8,
|
|
235
|
+
},
|
|
236
|
+
paginationDot: {
|
|
237
|
+
width: 8,
|
|
238
|
+
height: 8,
|
|
239
|
+
borderRadius: 4,
|
|
240
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
241
|
+
},
|
|
242
|
+
paginationDotActive: {
|
|
243
|
+
width: 20,
|
|
244
|
+
},
|
|
245
|
+
button: {
|
|
246
|
+
paddingHorizontal: 32,
|
|
247
|
+
paddingVertical: 16,
|
|
248
|
+
borderRadius: 24,
|
|
249
|
+
...Platform.select({
|
|
250
|
+
ios: {
|
|
251
|
+
shadowColor: '#000',
|
|
252
|
+
shadowOffset: { width: 0, height: 8 },
|
|
253
|
+
shadowOpacity: 0.15,
|
|
254
|
+
shadowRadius: 12,
|
|
255
|
+
},
|
|
256
|
+
android: {
|
|
257
|
+
elevation: 8,
|
|
258
|
+
},
|
|
259
|
+
}),
|
|
260
|
+
},
|
|
261
|
+
buttonText: {
|
|
262
|
+
color: '#FFFFFF',
|
|
263
|
+
fontSize: 17,
|
|
264
|
+
fontWeight: '600',
|
|
265
|
+
},
|
|
266
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { Pagination } from './Pagination';
|
|
2
|
-
export { NavigationButton, NavigationButtons } from './NavigationButtons';
|
|
3
|
-
export { Onboarding, useOnboarding } from './Onboarding';
|
|
4
|
-
|
|
5
|
-
export {
|
|
1
|
+
export { Pagination } from './Pagination';
|
|
2
|
+
export { NavigationButton, NavigationButtons } from './NavigationButtons';
|
|
3
|
+
export { Onboarding, useOnboarding } from './Onboarding';
|
|
4
|
+
export { default as SimpleOnboardingScreen } from './SimpleOnboardingScreen';
|
|
5
|
+
export type { SimpleSlide } from './SimpleOnboardingScreen';
|
|
6
|
+
|
|
7
|
+
export { default } from './Onboarding';
|
package/src/index.ts
CHANGED
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
// Main Component
|
|
2
|
-
export { Onboarding, useOnboarding } from './components/Onboarding';
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
export {
|
|
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
|
-
|
|
1
|
+
// Main Component
|
|
2
|
+
export { Onboarding, useOnboarding } from './components/Onboarding';
|
|
3
|
+
|
|
4
|
+
// Simple Onboarding Screen - A simple, customizable onboarding component
|
|
5
|
+
export { SimpleOnboardingScreen } from './components';
|
|
6
|
+
export type { SimpleSlide } from './components';
|
|
7
|
+
|
|
8
|
+
// Slide Components
|
|
9
|
+
export {
|
|
10
|
+
ImageSlide,
|
|
11
|
+
IconSlide,
|
|
12
|
+
FormSlide,
|
|
13
|
+
VideoSlide,
|
|
14
|
+
SlideRenderer,
|
|
15
|
+
} from './slides';
|
|
16
|
+
|
|
17
|
+
// UI Components
|
|
18
|
+
export {
|
|
19
|
+
Pagination,
|
|
20
|
+
NavigationButton,
|
|
21
|
+
NavigationButtons,
|
|
22
|
+
} from './components';
|
|
23
|
+
|
|
24
|
+
// Themes & Presets
|
|
25
|
+
export {
|
|
26
|
+
onepageTheme,
|
|
27
|
+
zaprecipeTheme,
|
|
28
|
+
pomodoTheme,
|
|
29
|
+
modernTheme,
|
|
30
|
+
minimalTheme,
|
|
31
|
+
gradientTheme,
|
|
32
|
+
onepagePreset,
|
|
33
|
+
zaprecipePreset,
|
|
34
|
+
pomodoPreset,
|
|
35
|
+
modernPreset,
|
|
36
|
+
minimalPreset,
|
|
37
|
+
gradientPreset,
|
|
38
|
+
getTheme,
|
|
39
|
+
getPreset,
|
|
40
|
+
mergeTheme,
|
|
41
|
+
} from './themes';
|
|
42
|
+
|
|
43
|
+
// Types
|
|
44
|
+
export type {
|
|
45
|
+
SlideType,
|
|
46
|
+
BaseSlideData,
|
|
47
|
+
ImageSlideData,
|
|
48
|
+
IconSlideData,
|
|
49
|
+
FormSlideData,
|
|
50
|
+
VideoSlideData,
|
|
51
|
+
CustomSlideData,
|
|
52
|
+
SlideData,
|
|
53
|
+
OnboardingTheme,
|
|
54
|
+
NavigationStyle,
|
|
55
|
+
NavigationConfig,
|
|
56
|
+
AnimationType,
|
|
57
|
+
AnimationConfig,
|
|
58
|
+
StorageConfig,
|
|
59
|
+
OnboardingConfig,
|
|
60
|
+
OnboardingProps,
|
|
61
|
+
FormSlideCustomProps,
|
|
62
|
+
PaginationProps,
|
|
63
|
+
NavigationButtonProps,
|
|
64
|
+
OnboardingPreset,
|
|
65
|
+
PresetConfig,
|
|
66
|
+
} from './types';
|
|
67
|
+
|
|
68
|
+
// Default export
|
|
69
|
+
export { default } from './components/Onboarding';
|