@rubixscript/react-native-onboarding 1.0.1 → 1.1.1

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.
Files changed (37) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +383 -383
  3. package/dist/components/NavigationButtons.js +17 -17
  4. package/dist/components/Onboarding.js +16 -16
  5. package/dist/components/Pagination.js +30 -30
  6. package/dist/components/SimpleOnboardingScreen.d.ts +54 -0
  7. package/dist/components/SimpleOnboardingScreen.d.ts.map +1 -0
  8. package/dist/components/SimpleOnboardingScreen.js +184 -0
  9. package/dist/components/index.d.ts +2 -0
  10. package/dist/components/index.d.ts.map +1 -1
  11. package/dist/components/index.js +1 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -0
  15. package/dist/presets/index.d.ts.map +1 -1
  16. package/dist/presets/index.js +24 -27
  17. package/dist/slides/FormSlide.js +37 -37
  18. package/dist/slides/IconSlide.js +24 -24
  19. package/dist/slides/ImageSlide.js +20 -20
  20. package/dist/slides/VideoSlide.js +20 -20
  21. package/dist/themes/index.d.ts.map +1 -1
  22. package/dist/themes/index.js +9 -7
  23. package/package.json +71 -66
  24. package/src/components/NavigationButtons.tsx +198 -198
  25. package/src/components/Onboarding.tsx +337 -337
  26. package/src/components/Pagination.tsx +337 -337
  27. package/src/components/SimpleOnboardingScreen.tsx +266 -0
  28. package/src/components/index.ts +7 -5
  29. package/src/index.ts +69 -65
  30. package/src/presets/index.ts +391 -394
  31. package/src/slides/FormSlide.tsx +314 -314
  32. package/src/slides/IconSlide.tsx +166 -166
  33. package/src/slides/ImageSlide.tsx +132 -132
  34. package/src/slides/VideoSlide.tsx +146 -146
  35. package/src/slides/index.tsx +37 -37
  36. package/src/themes/index.ts +576 -574
  37. package/src/types/index.ts +247 -247
@@ -1,166 +1,166 @@
1
- import React, { useMemo } from 'react';
2
- import { View, Text, StyleSheet, ViewStyle } from 'react-native';
3
- import Animated, { FadeIn, FadeInDown, withSpring, useSharedValue, useAnimatedStyle, withDelay } from 'react-native-reanimated';
4
- import { Ionicons, MaterialIcons, MaterialCommunityIcons, FontAwesome, Octicons, Feather } from '@expo/vector-icons';
5
- import { LinearGradient } from 'expo-linear-gradient';
6
- import { IconSlideData, OnboardingTheme } from '../types';
7
-
8
- interface IconSlideProps {
9
- data: IconSlideData;
10
- theme: OnboardingTheme;
11
- darkMode?: boolean;
12
- }
13
-
14
- export const IconSlide: React.FC<IconSlideProps> = ({ data, theme, darkMode }) => {
15
- const { icon, title, description, subtitle, gradientColors } = data;
16
-
17
- const scale = useSharedValue(0);
18
- const rotate = useSharedValue(0);
19
-
20
- React.useEffect(() => {
21
- scale.value = withSpring(1, { damping: 15, stiffness: 150 });
22
- rotate.value = withDelay(200, withSpring(0, { damping: 20, stiffness: 100 }));
23
- }, []);
24
-
25
- const iconAnimatedStyle = useAnimatedStyle(() => ({
26
- transform: [
27
- { scale: scale.value },
28
- { rotate: `${rotate.value}deg` },
29
- ],
30
- }));
31
-
32
- const containerStyle = useMemo(() => {
33
- const styles: any = {
34
- flex: 1,
35
- justifyContent: 'center',
36
- alignItems: 'center',
37
- padding: theme.spacing.lg,
38
- };
39
-
40
- if (data.backgroundColor) {
41
- styles.backgroundColor = data.backgroundColor;
42
- } else if (gradientColors && gradientColors.length > 0) {
43
- // Will use LinearGradient
44
- } else {
45
- styles.backgroundColor = theme.colors.background;
46
- }
47
-
48
- return styles;
49
- }, [data, theme]);
50
-
51
- const iconContainerStyle: ViewStyle = useMemo(() => ({
52
- width: icon.backgroundSize || 160,
53
- height: icon.backgroundSize || 160,
54
- borderRadius: (icon.backgroundSize || 160) / 2,
55
- backgroundColor: icon.backgroundColor || theme.colors.primary,
56
- justifyContent: 'center',
57
- alignItems: 'center',
58
- marginBottom: theme.spacing.lg,
59
- }), [icon, theme]);
60
-
61
- const renderIcon = () => {
62
- const iconProps = {
63
- name: icon.name as any,
64
- size: icon.size || 64,
65
- color: icon.color || theme.colors.text.inverse,
66
- };
67
-
68
- switch (icon.type) {
69
- case 'material':
70
- return <MaterialIcons {...iconProps} />;
71
- case 'material-community':
72
- return <MaterialCommunityIcons {...iconProps} />;
73
- case 'font-awesome':
74
- return <FontAwesome {...iconProps} />;
75
- case 'octicons':
76
- return <Octicons {...iconProps} />;
77
- case 'feather':
78
- return <Feather {...iconProps} />;
79
- case 'ionicons':
80
- default:
81
- return <Ionicons {...iconProps} />;
82
- }
83
- };
84
-
85
- const titleStyle = useMemo(() => ({
86
- ...styles.title,
87
- color: gradientColors?.length ? theme.colors.text.primary : theme.colors.text.primary,
88
- }), [gradientColors, theme]);
89
-
90
- const subtitleStyle = useMemo(() => ({
91
- ...styles.subtitle,
92
- color: gradientColors?.length ? theme.colors.text.secondary : theme.colors.text.secondary,
93
- }), [gradientColors, theme]);
94
-
95
- const descriptionStyle = useMemo(() => ({
96
- ...styles.description,
97
- color: gradientColors?.length ? theme.colors.text.secondary : theme.colors.text.secondary,
98
- }), [gradientColors, theme]);
99
-
100
- const content = (
101
- <>
102
- {/* Icon */}
103
- <Animated.View style={iconAnimatedStyle}>
104
- <View style={iconContainerStyle}>
105
- {renderIcon()}
106
- </View>
107
- </Animated.View>
108
-
109
- {/* Title */}
110
- {title && (
111
- <Animated.Text entering={FadeInDown.delay(100).springify()} style={titleStyle}>
112
- {title}
113
- </Animated.Text>
114
- )}
115
-
116
- {/* Subtitle */}
117
- {subtitle && (
118
- <Animated.Text entering={FadeInDown.delay(200).springify()} style={subtitleStyle}>
119
- {subtitle}
120
- </Animated.Text>
121
- )}
122
-
123
- {/* Description */}
124
- {description && (
125
- <Animated.Text entering={FadeInDown.delay(300).springify()} style={descriptionStyle}>
126
- {description}
127
- </Animated.Text>
128
- )}
129
- </>
130
- );
131
-
132
- if (gradientColors && gradientColors.length > 0) {
133
- return (
134
- <LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
135
- <View style={containerStyle}>{content}</View>
136
- </LinearGradient>
137
- );
138
- }
139
-
140
- return <View style={containerStyle}>{content}</View>;
141
- };
142
-
143
- const styles = StyleSheet.create({
144
- title: {
145
- fontSize: 24,
146
- fontWeight: '700',
147
- textAlign: 'center',
148
- marginBottom: 8,
149
- paddingHorizontal: 20,
150
- },
151
- subtitle: {
152
- fontSize: 18,
153
- fontWeight: '600',
154
- textAlign: 'center',
155
- marginBottom: 12,
156
- paddingHorizontal: 20,
157
- },
158
- description: {
159
- fontSize: 15,
160
- textAlign: 'center',
161
- paddingHorizontal: 32,
162
- lineHeight: 22,
163
- },
164
- });
165
-
166
- export default IconSlide;
1
+ import React, { useMemo } from 'react';
2
+ import { View, Text, StyleSheet, ViewStyle } from 'react-native';
3
+ import Animated, { FadeIn, FadeInDown, withSpring, useSharedValue, useAnimatedStyle, withDelay } from 'react-native-reanimated';
4
+ import { Ionicons, MaterialIcons, MaterialCommunityIcons, FontAwesome, Octicons, Feather } from '@expo/vector-icons';
5
+ import { LinearGradient } from 'expo-linear-gradient';
6
+ import { IconSlideData, OnboardingTheme } from '../types';
7
+
8
+ interface IconSlideProps {
9
+ data: IconSlideData;
10
+ theme: OnboardingTheme;
11
+ darkMode?: boolean;
12
+ }
13
+
14
+ export const IconSlide: React.FC<IconSlideProps> = ({ data, theme, darkMode }) => {
15
+ const { icon, title, description, subtitle, gradientColors } = data;
16
+
17
+ const scale = useSharedValue(0);
18
+ const rotate = useSharedValue(0);
19
+
20
+ React.useEffect(() => {
21
+ scale.value = withSpring(1, { damping: 15, stiffness: 150 });
22
+ rotate.value = withDelay(200, withSpring(0, { damping: 20, stiffness: 100 }));
23
+ }, []);
24
+
25
+ const iconAnimatedStyle = useAnimatedStyle(() => ({
26
+ transform: [
27
+ { scale: scale.value },
28
+ { rotate: `${rotate.value}deg` },
29
+ ],
30
+ }));
31
+
32
+ const containerStyle = useMemo(() => {
33
+ const styles: any = {
34
+ flex: 1,
35
+ justifyContent: 'center',
36
+ alignItems: 'center',
37
+ padding: theme.spacing.lg,
38
+ };
39
+
40
+ if (data.backgroundColor) {
41
+ styles.backgroundColor = data.backgroundColor;
42
+ } else if (gradientColors && gradientColors.length > 0) {
43
+ // Will use LinearGradient
44
+ } else {
45
+ styles.backgroundColor = theme.colors.background;
46
+ }
47
+
48
+ return styles;
49
+ }, [data, theme]);
50
+
51
+ const iconContainerStyle: ViewStyle = useMemo(() => ({
52
+ width: icon.backgroundSize || 160,
53
+ height: icon.backgroundSize || 160,
54
+ borderRadius: (icon.backgroundSize || 160) / 2,
55
+ backgroundColor: icon.backgroundColor || theme.colors.primary,
56
+ justifyContent: 'center',
57
+ alignItems: 'center',
58
+ marginBottom: theme.spacing.lg,
59
+ }), [icon, theme]);
60
+
61
+ const renderIcon = () => {
62
+ const iconProps = {
63
+ name: icon.name as any,
64
+ size: icon.size || 64,
65
+ color: icon.color || theme.colors.text.inverse,
66
+ };
67
+
68
+ switch (icon.type) {
69
+ case 'material':
70
+ return <MaterialIcons {...iconProps} />;
71
+ case 'material-community':
72
+ return <MaterialCommunityIcons {...iconProps} />;
73
+ case 'font-awesome':
74
+ return <FontAwesome {...iconProps} />;
75
+ case 'octicons':
76
+ return <Octicons {...iconProps} />;
77
+ case 'feather':
78
+ return <Feather {...iconProps} />;
79
+ case 'ionicons':
80
+ default:
81
+ return <Ionicons {...iconProps} />;
82
+ }
83
+ };
84
+
85
+ const titleStyle = useMemo(() => ({
86
+ ...styles.title,
87
+ color: gradientColors?.length ? theme.colors.text.primary : theme.colors.text.primary,
88
+ }), [gradientColors, theme]);
89
+
90
+ const subtitleStyle = useMemo(() => ({
91
+ ...styles.subtitle,
92
+ color: gradientColors?.length ? theme.colors.text.secondary : theme.colors.text.secondary,
93
+ }), [gradientColors, theme]);
94
+
95
+ const descriptionStyle = useMemo(() => ({
96
+ ...styles.description,
97
+ color: gradientColors?.length ? theme.colors.text.secondary : theme.colors.text.secondary,
98
+ }), [gradientColors, theme]);
99
+
100
+ const content = (
101
+ <>
102
+ {/* Icon */}
103
+ <Animated.View style={iconAnimatedStyle}>
104
+ <View style={iconContainerStyle}>
105
+ {renderIcon()}
106
+ </View>
107
+ </Animated.View>
108
+
109
+ {/* Title */}
110
+ {title && (
111
+ <Animated.Text entering={FadeInDown.delay(100).springify()} style={titleStyle}>
112
+ {title}
113
+ </Animated.Text>
114
+ )}
115
+
116
+ {/* Subtitle */}
117
+ {subtitle && (
118
+ <Animated.Text entering={FadeInDown.delay(200).springify()} style={subtitleStyle}>
119
+ {subtitle}
120
+ </Animated.Text>
121
+ )}
122
+
123
+ {/* Description */}
124
+ {description && (
125
+ <Animated.Text entering={FadeInDown.delay(300).springify()} style={descriptionStyle}>
126
+ {description}
127
+ </Animated.Text>
128
+ )}
129
+ </>
130
+ );
131
+
132
+ if (gradientColors && gradientColors.length > 0) {
133
+ return (
134
+ <LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
135
+ <View style={containerStyle}>{content}</View>
136
+ </LinearGradient>
137
+ );
138
+ }
139
+
140
+ return <View style={containerStyle}>{content}</View>;
141
+ };
142
+
143
+ const styles = StyleSheet.create({
144
+ title: {
145
+ fontSize: 24,
146
+ fontWeight: '700',
147
+ textAlign: 'center',
148
+ marginBottom: 8,
149
+ paddingHorizontal: 20,
150
+ },
151
+ subtitle: {
152
+ fontSize: 18,
153
+ fontWeight: '600',
154
+ textAlign: 'center',
155
+ marginBottom: 12,
156
+ paddingHorizontal: 20,
157
+ },
158
+ description: {
159
+ fontSize: 15,
160
+ textAlign: 'center',
161
+ paddingHorizontal: 32,
162
+ lineHeight: 22,
163
+ },
164
+ });
165
+
166
+ export default IconSlide;
@@ -1,132 +1,132 @@
1
- import React, { useMemo } from 'react';
2
- import { View, Text, Image, StyleSheet, ImageStyle, Dimensions } from 'react-native';
3
- import Animated, { FadeIn, FadeInDown } from 'react-native-reanimated';
4
- import { LinearGradient } from 'expo-linear-gradient';
5
- import { Ionicons } from '@expo/vector-icons';
6
- import { ImageSlideData, OnboardingTheme } from '../types';
7
-
8
- interface ImageSlideProps {
9
- data: ImageSlideData;
10
- theme: OnboardingTheme;
11
- darkMode?: boolean;
12
- }
13
-
14
- const { width: SCREEN_WIDTH } = Dimensions.get('window');
15
-
16
- export const ImageSlide: React.FC<ImageSlideProps> = ({ data, theme, darkMode }) => {
17
- const { image, title, description, imageResizeMode = 'cover', imageStyle, overlayIcon, gradientColors } = data;
18
-
19
- const containerStyle = useMemo(() => {
20
- const styles: any = {
21
- flex: 1,
22
- justifyContent: 'center',
23
- alignItems: 'center',
24
- padding: theme.spacing.lg,
25
- };
26
-
27
- if (data.backgroundColor) {
28
- styles.backgroundColor = data.backgroundColor;
29
- } else if (gradientColors && gradientColors.length > 0) {
30
- // Will use LinearGradient
31
- } else {
32
- styles.backgroundColor = theme.colors.background;
33
- }
34
-
35
- return styles;
36
- }, [data, theme]);
37
-
38
- const imageContainerStyle = useMemo(() => ({
39
- ...styles.imageContainer,
40
- marginBottom: theme.spacing.lg,
41
- }), [theme]);
42
-
43
- const baseImageStyle: ImageStyle = useMemo(() => ({
44
- width: SCREEN_WIDTH - theme.spacing.xl * 2,
45
- height: 280,
46
- borderRadius: theme.borderRadius.lg,
47
- resizeMode: imageResizeMode,
48
- ...imageStyle,
49
- }), [theme, imageResizeMode, imageStyle]);
50
-
51
- const titleStyle = useMemo(() => ({
52
- ...styles.title,
53
- color: gradientColors?.length ? theme.colors.text.primary : theme.colors.text.primary,
54
- }), [gradientColors, theme]);
55
-
56
- const descriptionStyle = useMemo(() => ({
57
- ...styles.description,
58
- color: gradientColors?.length ? theme.colors.text.secondary : theme.colors.text.secondary,
59
- }), [gradientColors, theme]);
60
-
61
- const content = (
62
- <>
63
- {/* Image with optional overlay icon */}
64
- <Animated.View entering={FadeIn.duration(400).springify()} style={imageContainerStyle}>
65
- <Image source={image} style={baseImageStyle} />
66
- {overlayIcon && (
67
- <View style={styles.overlayIcon}>
68
- <Ionicons
69
- name={overlayIcon.name as any}
70
- size={overlayIcon.size || 48}
71
- color={overlayIcon.color || '#FFFFFF'}
72
- />
73
- </View>
74
- )}
75
- </Animated.View>
76
-
77
- {/* Title */}
78
- {title && (
79
- <Animated.Text entering={FadeInDown.delay(100).springify()} style={titleStyle}>
80
- {title}
81
- </Animated.Text>
82
- )}
83
-
84
- {/* Description */}
85
- {description && (
86
- <Animated.Text entering={FadeInDown.delay(200).springify()} style={descriptionStyle}>
87
- {description}
88
- </Animated.Text>
89
- )}
90
- </>
91
- );
92
-
93
- if (gradientColors && gradientColors.length > 0) {
94
- return (
95
- <LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
96
- <View style={containerStyle}>{content}</View>
97
- </LinearGradient>
98
- );
99
- }
100
-
101
- return <View style={containerStyle}>{content}</View>;
102
- };
103
-
104
- const styles = StyleSheet.create({
105
- imageContainer: {
106
- width: '100%',
107
- alignItems: 'center',
108
- },
109
- overlayIcon: {
110
- position: 'absolute',
111
- top: 20,
112
- right: 20,
113
- backgroundColor: 'rgba(0, 0, 0, 0.3)',
114
- borderRadius: 20,
115
- padding: 8,
116
- },
117
- title: {
118
- fontSize: 28,
119
- fontWeight: '700',
120
- textAlign: 'center',
121
- marginBottom: 12,
122
- paddingHorizontal: 20,
123
- },
124
- description: {
125
- fontSize: 15,
126
- textAlign: 'center',
127
- paddingHorizontal: 32,
128
- lineHeight: 22,
129
- },
130
- });
131
-
132
- export default ImageSlide;
1
+ import React, { useMemo } from 'react';
2
+ import { View, Text, Image, StyleSheet, ImageStyle, Dimensions } from 'react-native';
3
+ import Animated, { FadeIn, FadeInDown } from 'react-native-reanimated';
4
+ import { LinearGradient } from 'expo-linear-gradient';
5
+ import { Ionicons } from '@expo/vector-icons';
6
+ import { ImageSlideData, OnboardingTheme } from '../types';
7
+
8
+ interface ImageSlideProps {
9
+ data: ImageSlideData;
10
+ theme: OnboardingTheme;
11
+ darkMode?: boolean;
12
+ }
13
+
14
+ const { width: SCREEN_WIDTH } = Dimensions.get('window');
15
+
16
+ export const ImageSlide: React.FC<ImageSlideProps> = ({ data, theme, darkMode }) => {
17
+ const { image, title, description, imageResizeMode = 'cover', imageStyle, overlayIcon, gradientColors } = data;
18
+
19
+ const containerStyle = useMemo(() => {
20
+ const styles: any = {
21
+ flex: 1,
22
+ justifyContent: 'center',
23
+ alignItems: 'center',
24
+ padding: theme.spacing.lg,
25
+ };
26
+
27
+ if (data.backgroundColor) {
28
+ styles.backgroundColor = data.backgroundColor;
29
+ } else if (gradientColors && gradientColors.length > 0) {
30
+ // Will use LinearGradient
31
+ } else {
32
+ styles.backgroundColor = theme.colors.background;
33
+ }
34
+
35
+ return styles;
36
+ }, [data, theme]);
37
+
38
+ const imageContainerStyle = useMemo(() => ({
39
+ ...styles.imageContainer,
40
+ marginBottom: theme.spacing.lg,
41
+ }), [theme]);
42
+
43
+ const baseImageStyle: ImageStyle = useMemo(() => ({
44
+ width: SCREEN_WIDTH - theme.spacing.xl * 2,
45
+ height: 280,
46
+ borderRadius: theme.borderRadius.lg,
47
+ resizeMode: imageResizeMode,
48
+ ...imageStyle,
49
+ }), [theme, imageResizeMode, imageStyle]);
50
+
51
+ const titleStyle = useMemo(() => ({
52
+ ...styles.title,
53
+ color: gradientColors?.length ? theme.colors.text.primary : theme.colors.text.primary,
54
+ }), [gradientColors, theme]);
55
+
56
+ const descriptionStyle = useMemo(() => ({
57
+ ...styles.description,
58
+ color: gradientColors?.length ? theme.colors.text.secondary : theme.colors.text.secondary,
59
+ }), [gradientColors, theme]);
60
+
61
+ const content = (
62
+ <>
63
+ {/* Image with optional overlay icon */}
64
+ <Animated.View entering={FadeIn.duration(400).springify()} style={imageContainerStyle}>
65
+ <Image source={image} style={baseImageStyle} />
66
+ {overlayIcon && (
67
+ <View style={styles.overlayIcon}>
68
+ <Ionicons
69
+ name={overlayIcon.name as any}
70
+ size={overlayIcon.size || 48}
71
+ color={overlayIcon.color || '#FFFFFF'}
72
+ />
73
+ </View>
74
+ )}
75
+ </Animated.View>
76
+
77
+ {/* Title */}
78
+ {title && (
79
+ <Animated.Text entering={FadeInDown.delay(100).springify()} style={titleStyle}>
80
+ {title}
81
+ </Animated.Text>
82
+ )}
83
+
84
+ {/* Description */}
85
+ {description && (
86
+ <Animated.Text entering={FadeInDown.delay(200).springify()} style={descriptionStyle}>
87
+ {description}
88
+ </Animated.Text>
89
+ )}
90
+ </>
91
+ );
92
+
93
+ if (gradientColors && gradientColors.length > 0) {
94
+ return (
95
+ <LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
96
+ <View style={containerStyle}>{content}</View>
97
+ </LinearGradient>
98
+ );
99
+ }
100
+
101
+ return <View style={containerStyle}>{content}</View>;
102
+ };
103
+
104
+ const styles = StyleSheet.create({
105
+ imageContainer: {
106
+ width: '100%',
107
+ alignItems: 'center',
108
+ },
109
+ overlayIcon: {
110
+ position: 'absolute',
111
+ top: 20,
112
+ right: 20,
113
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
114
+ borderRadius: 20,
115
+ padding: 8,
116
+ },
117
+ title: {
118
+ fontSize: 28,
119
+ fontWeight: '700',
120
+ textAlign: 'center',
121
+ marginBottom: 12,
122
+ paddingHorizontal: 20,
123
+ },
124
+ description: {
125
+ fontSize: 15,
126
+ textAlign: 'center',
127
+ paddingHorizontal: 32,
128
+ lineHeight: 22,
129
+ },
130
+ });
131
+
132
+ export default ImageSlide;