@rubixscript/react-native-onboarding 1.0.0 → 1.0.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.
- 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/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/presets/index.d.ts +27 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +373 -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 +545 -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 +10 -4
- package/src/components/Onboarding.tsx +8 -11
- package/src/components/Pagination.tsx +1 -1
- package/src/slides/FormSlide.tsx +1 -1
- package/src/slides/IconSlide.tsx +1 -1
- package/src/slides/ImageSlide.tsx +1 -1
- package/src/slides/VideoSlide.tsx +1 -1
- package/src/slides/{index.ts → index.tsx} +0 -7
- package/src/types/index.ts +3 -3
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { ImageSourcePropType, ViewStyle, TextStyle, ImageStyle } from 'react-native';
|
|
2
|
+
export type SlideType = 'image' | 'icon' | 'form' | 'video' | 'custom';
|
|
3
|
+
export interface BaseSlideData {
|
|
4
|
+
id: string;
|
|
5
|
+
type: SlideType;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
gradientColors?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ImageSlideData extends BaseSlideData {
|
|
12
|
+
type: 'image';
|
|
13
|
+
image: ImageSourcePropType;
|
|
14
|
+
imageResizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
|
|
15
|
+
imageStyle?: ImageStyle;
|
|
16
|
+
overlayIcon?: {
|
|
17
|
+
name: string;
|
|
18
|
+
size?: number;
|
|
19
|
+
color?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface IconSlideData extends BaseSlideData {
|
|
23
|
+
type: 'icon';
|
|
24
|
+
icon: {
|
|
25
|
+
name: string;
|
|
26
|
+
type?: 'ionicons' | 'material' | 'material-community' | 'font-awesome' | 'octicons' | 'feather';
|
|
27
|
+
size?: number;
|
|
28
|
+
color?: string;
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
backgroundSize?: number;
|
|
31
|
+
};
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface FormFieldConfig {
|
|
35
|
+
key: string;
|
|
36
|
+
label: string;
|
|
37
|
+
placeholder: string;
|
|
38
|
+
type: 'text' | 'number' | 'email' | 'password' | 'select' | 'multiselect';
|
|
39
|
+
required?: boolean;
|
|
40
|
+
options?: Array<{
|
|
41
|
+
value: string;
|
|
42
|
+
label: string;
|
|
43
|
+
icon?: string;
|
|
44
|
+
}>;
|
|
45
|
+
validation?: (value: any) => boolean | string;
|
|
46
|
+
multiline?: boolean;
|
|
47
|
+
numberOfLines?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface FormSlideData extends BaseSlideData {
|
|
50
|
+
type: 'form';
|
|
51
|
+
fields: FormFieldConfig[];
|
|
52
|
+
submitLabel?: string;
|
|
53
|
+
onSubmit?: (data: Record<string, any>) => void | Promise<void>;
|
|
54
|
+
customFormComponent?: React.ComponentType<FormSlideCustomProps>;
|
|
55
|
+
}
|
|
56
|
+
export interface VideoSlideData extends BaseSlideData {
|
|
57
|
+
type: 'video';
|
|
58
|
+
videoSource: string | {
|
|
59
|
+
uri: string;
|
|
60
|
+
};
|
|
61
|
+
autoPlay?: boolean;
|
|
62
|
+
loop?: boolean;
|
|
63
|
+
muted?: boolean;
|
|
64
|
+
poster?: ImageSourcePropType;
|
|
65
|
+
}
|
|
66
|
+
export interface CustomSlideData extends BaseSlideData {
|
|
67
|
+
type: 'custom';
|
|
68
|
+
component: React.ComponentType<any>;
|
|
69
|
+
props?: Record<string, any>;
|
|
70
|
+
}
|
|
71
|
+
export type SlideData = ImageSlideData | IconSlideData | FormSlideData | VideoSlideData | CustomSlideData;
|
|
72
|
+
export interface OnboardingTheme {
|
|
73
|
+
colors: {
|
|
74
|
+
primary: string;
|
|
75
|
+
secondary: string;
|
|
76
|
+
background: string;
|
|
77
|
+
surface: string;
|
|
78
|
+
text: {
|
|
79
|
+
primary: string;
|
|
80
|
+
secondary: string;
|
|
81
|
+
inverse: string;
|
|
82
|
+
};
|
|
83
|
+
border: string;
|
|
84
|
+
overlay?: string;
|
|
85
|
+
};
|
|
86
|
+
typography: {
|
|
87
|
+
title: TextStyle;
|
|
88
|
+
description: TextStyle;
|
|
89
|
+
button: TextStyle;
|
|
90
|
+
label?: TextStyle;
|
|
91
|
+
};
|
|
92
|
+
spacing: {
|
|
93
|
+
xs: number;
|
|
94
|
+
sm: number;
|
|
95
|
+
md: number;
|
|
96
|
+
lg: number;
|
|
97
|
+
xl: number;
|
|
98
|
+
xxl: number;
|
|
99
|
+
};
|
|
100
|
+
borderRadius: {
|
|
101
|
+
sm: number;
|
|
102
|
+
md: number;
|
|
103
|
+
lg: number;
|
|
104
|
+
xl: number;
|
|
105
|
+
full: number;
|
|
106
|
+
};
|
|
107
|
+
shadows?: {
|
|
108
|
+
sm?: ViewStyle;
|
|
109
|
+
md?: ViewStyle;
|
|
110
|
+
lg?: ViewStyle;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export type NavigationStyle = 'dots' | 'progress-bar' | 'steps' | 'numbers' | 'none';
|
|
114
|
+
export interface NavigationConfig {
|
|
115
|
+
style: NavigationStyle;
|
|
116
|
+
position?: 'top' | 'bottom' | 'floating';
|
|
117
|
+
showSkip?: boolean;
|
|
118
|
+
showBack?: boolean;
|
|
119
|
+
skipLabel?: string;
|
|
120
|
+
backLabel?: string;
|
|
121
|
+
nextLabel?: string;
|
|
122
|
+
doneLabel?: string;
|
|
123
|
+
containerStyle?: ViewStyle;
|
|
124
|
+
}
|
|
125
|
+
export type AnimationType = 'slide' | 'fade' | 'scale' | 'parallax' | 'cube' | 'none';
|
|
126
|
+
export interface AnimationConfig {
|
|
127
|
+
type: AnimationType;
|
|
128
|
+
duration?: number;
|
|
129
|
+
easing?: (t: number) => number;
|
|
130
|
+
parallaxFactor?: number;
|
|
131
|
+
}
|
|
132
|
+
export interface StorageConfig {
|
|
133
|
+
key: string;
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
onComplete?: () => void | Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
export interface OnboardingConfig {
|
|
138
|
+
slides: SlideData[];
|
|
139
|
+
theme?: Partial<OnboardingTheme>;
|
|
140
|
+
navigation?: Partial<NavigationConfig>;
|
|
141
|
+
animation?: Partial<AnimationConfig>;
|
|
142
|
+
storage?: Partial<StorageConfig>;
|
|
143
|
+
onboardingComplete?: (data?: Record<string, any>) => void | Promise<void>;
|
|
144
|
+
onSlideChange?: (index: number) => void;
|
|
145
|
+
onSkip?: () => void | Promise<void>;
|
|
146
|
+
initialSlide?: number;
|
|
147
|
+
swipeEnabled?: boolean;
|
|
148
|
+
containerStyle?: ViewStyle;
|
|
149
|
+
safeAreaEnabled?: boolean;
|
|
150
|
+
}
|
|
151
|
+
export interface OnboardingProps extends OnboardingConfig {
|
|
152
|
+
visible: boolean;
|
|
153
|
+
darkMode?: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface FormSlideCustomProps {
|
|
156
|
+
data: FormSlideData;
|
|
157
|
+
theme: OnboardingTheme;
|
|
158
|
+
onSubmit: (data: Record<string, any>) => void;
|
|
159
|
+
isSubmitting?: boolean;
|
|
160
|
+
darkMode?: boolean;
|
|
161
|
+
}
|
|
162
|
+
export interface PaginationProps {
|
|
163
|
+
currentIndex: number;
|
|
164
|
+
totalSlides: number;
|
|
165
|
+
theme: OnboardingTheme;
|
|
166
|
+
config?: NavigationConfig;
|
|
167
|
+
style?: ViewStyle;
|
|
168
|
+
}
|
|
169
|
+
export interface NavigationButtonProps {
|
|
170
|
+
label: string;
|
|
171
|
+
onPress: () => void;
|
|
172
|
+
theme: OnboardingTheme;
|
|
173
|
+
variant?: 'primary' | 'secondary' | 'ghost';
|
|
174
|
+
disabled?: boolean;
|
|
175
|
+
loading?: boolean;
|
|
176
|
+
style?: ViewStyle;
|
|
177
|
+
textStyle?: TextStyle;
|
|
178
|
+
}
|
|
179
|
+
export type OnboardingPreset = 'onepage' | 'zaprecipe' | 'pomodo' | 'modern' | 'minimal' | 'gradient';
|
|
180
|
+
export interface PresetConfig {
|
|
181
|
+
theme: OnboardingTheme;
|
|
182
|
+
navigation: NavigationConfig;
|
|
183
|
+
animation: AnimationConfig;
|
|
184
|
+
defaultSlideStyles: {
|
|
185
|
+
image?: ImageStyle;
|
|
186
|
+
icon?: ViewStyle;
|
|
187
|
+
title?: TextStyle;
|
|
188
|
+
description?: TextStyle;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAY,MAAM,cAAc,CAAC;AAM/F,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,mBAAmB,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC7D,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,oBAAoB,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,CAAC;QAChG,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC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CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAMD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAEtG,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,eAAe,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,SAAS,EAAE,eAAe,CAAC;IAC3B,kBAAkB,EAAE;QAClB,KAAK,CAAC,EAAE,UAAU,CAAC;QACnB,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,KAAK,CAAC,EAAE,SAAS,CAAC;QAClB,WAAW,CAAC,EAAE,SAAS,CAAC;KACzB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubixscript/react-native-onboarding",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A comprehensive React Native onboarding library with customizable slide types, animations, and themes",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
8
10
|
"test": "jest",
|
|
9
11
|
"lint": "eslint src --ext .ts,.tsx",
|
|
10
12
|
"type-check": "tsc --noEmit"
|
|
@@ -35,8 +37,11 @@
|
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@expo/vector-icons": "^15.0.2",
|
|
37
39
|
"@react-native-async-storage/async-storage": ">=1.19.0",
|
|
40
|
+
"expo-av": "~15.0.0",
|
|
38
41
|
"expo-blur": "~15.0.7",
|
|
39
|
-
"expo-linear-gradient": "~15.0.7"
|
|
42
|
+
"expo-linear-gradient": "~15.0.7",
|
|
43
|
+
"react-native-reanimated": ">=3.0.0",
|
|
44
|
+
"react-native-safe-area-context": "~5.0.0"
|
|
40
45
|
},
|
|
41
46
|
"devDependencies": {
|
|
42
47
|
"@testing-library/react-native": "^12.0.0",
|
|
@@ -50,6 +55,7 @@
|
|
|
50
55
|
"typescript": "~5.9.2"
|
|
51
56
|
},
|
|
52
57
|
"files": [
|
|
58
|
+
"dist",
|
|
53
59
|
"src",
|
|
54
60
|
"README.md",
|
|
55
61
|
"LICENSE"
|
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
Animated,
|
|
10
10
|
} from 'react-native';
|
|
11
11
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
12
|
-
import
|
|
13
|
-
FlatList,
|
|
14
|
-
AnimatedFlatListType,
|
|
15
|
-
} from 'react-native-reanimated';
|
|
12
|
+
import FlatList from 'react-native-reanimated';
|
|
16
13
|
import { BlurView } from 'expo-blur';
|
|
17
14
|
import { LinearGradient } from 'expo-linear-gradient';
|
|
18
15
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
@@ -22,8 +19,8 @@ import { mergeTheme, getPreset } from '../themes';
|
|
|
22
19
|
import { SlideRenderer } from '../slides';
|
|
23
20
|
import { Pagination, NavigationButtons } from './index';
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
// Type assertion for AnimatedFlatList from react-native-reanimated
|
|
23
|
+
const AnimatedFlatListImplemented = FlatList as any;
|
|
27
24
|
|
|
28
25
|
export const Onboarding: React.FC<OnboardingProps> = ({
|
|
29
26
|
visible,
|
|
@@ -47,7 +44,7 @@ export const Onboarding: React.FC<OnboardingProps> = ({
|
|
|
47
44
|
const [formData, setFormData] = useState<Record<string, any>>({});
|
|
48
45
|
|
|
49
46
|
//Refs
|
|
50
|
-
const flatListRef = React.useRef<
|
|
47
|
+
const flatListRef = React.useRef<any>(null);
|
|
51
48
|
|
|
52
49
|
// Merge theme with preset
|
|
53
50
|
const preset = useMemo(() => {
|
|
@@ -172,8 +169,8 @@ export const Onboarding: React.FC<OnboardingProps> = ({
|
|
|
172
169
|
[currentIndex, onSlideChange]
|
|
173
170
|
);
|
|
174
171
|
|
|
175
|
-
const handleFormDataChange = useCallback((
|
|
176
|
-
setFormData(prev => ({ ...prev,
|
|
172
|
+
const handleFormDataChange = useCallback((data: Record<string, any>) => {
|
|
173
|
+
setFormData(prev => ({ ...prev, ...data }));
|
|
177
174
|
}, []);
|
|
178
175
|
|
|
179
176
|
// Renderers
|
|
@@ -210,7 +207,7 @@ export const Onboarding: React.FC<OnboardingProps> = ({
|
|
|
210
207
|
{/* Background Gradient if applicable */}
|
|
211
208
|
{currentSlide?.gradientColors && currentSlide.gradientColors.length > 0 && (
|
|
212
209
|
<LinearGradient
|
|
213
|
-
colors={currentSlide.gradientColors}
|
|
210
|
+
colors={currentSlide.gradientColors as any}
|
|
214
211
|
style={StyleSheet.absoluteFillObject}
|
|
215
212
|
/>
|
|
216
213
|
)}
|
|
@@ -239,7 +236,7 @@ export const Onboarding: React.FC<OnboardingProps> = ({
|
|
|
239
236
|
scrollEnabled={swipeEnabled}
|
|
240
237
|
bounces={false}
|
|
241
238
|
initialScrollIndex={initialSlide}
|
|
242
|
-
onScrollToIndexFailed={(info) => {
|
|
239
|
+
onScrollToIndexFailed={(info: any) => {
|
|
243
240
|
// Retry if scroll to index fails
|
|
244
241
|
setTimeout(() => {
|
|
245
242
|
flatListRef.current?.scrollToIndex({
|
|
@@ -166,7 +166,7 @@ const FloatingDotsPagination: React.FC<PaginationProps> = ({ currentIndex, total
|
|
|
166
166
|
|
|
167
167
|
// MAIN PAGINATION COMPONENT
|
|
168
168
|
export const Pagination: React.FC<PaginationProps> = ({ currentIndex, totalSlides, theme, config, style }) => {
|
|
169
|
-
const { style: navStyle, position } = config;
|
|
169
|
+
const { style: navStyle, position } = config || { style: 'dots' as const, position: 'bottom' as const };
|
|
170
170
|
|
|
171
171
|
const containerStyle: ViewStyle = useMemo(() => {
|
|
172
172
|
const base: ViewStyle = {};
|
package/src/slides/FormSlide.tsx
CHANGED
|
@@ -207,7 +207,7 @@ export const FormSlide: React.FC<FormSlideProps> = ({
|
|
|
207
207
|
|
|
208
208
|
if (gradientColors && gradientColors.length > 0) {
|
|
209
209
|
return (
|
|
210
|
-
<LinearGradient colors={gradientColors} style={StyleSheet.absoluteFillObject}>
|
|
210
|
+
<LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
|
|
211
211
|
<View style={containerStyle}>{content}</View>
|
|
212
212
|
</LinearGradient>
|
|
213
213
|
);
|
package/src/slides/IconSlide.tsx
CHANGED
|
@@ -131,7 +131,7 @@ export const IconSlide: React.FC<IconSlideProps> = ({ data, theme, darkMode }) =
|
|
|
131
131
|
|
|
132
132
|
if (gradientColors && gradientColors.length > 0) {
|
|
133
133
|
return (
|
|
134
|
-
<LinearGradient colors={gradientColors} style={StyleSheet.absoluteFillObject}>
|
|
134
|
+
<LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
|
|
135
135
|
<View style={containerStyle}>{content}</View>
|
|
136
136
|
</LinearGradient>
|
|
137
137
|
);
|
|
@@ -92,7 +92,7 @@ export const ImageSlide: React.FC<ImageSlideProps> = ({ data, theme, darkMode })
|
|
|
92
92
|
|
|
93
93
|
if (gradientColors && gradientColors.length > 0) {
|
|
94
94
|
return (
|
|
95
|
-
<LinearGradient colors={gradientColors} style={StyleSheet.absoluteFillObject}>
|
|
95
|
+
<LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
|
|
96
96
|
<View style={containerStyle}>{content}</View>
|
|
97
97
|
</LinearGradient>
|
|
98
98
|
);
|
|
@@ -113,7 +113,7 @@ export const VideoSlide: React.FC<VideoSlideProps> = ({ data, theme, darkMode })
|
|
|
113
113
|
|
|
114
114
|
if (gradientColors && gradientColors.length > 0) {
|
|
115
115
|
return (
|
|
116
|
-
<LinearGradient colors={gradientColors} style={StyleSheet.absoluteFillObject}>
|
|
116
|
+
<LinearGradient colors={gradientColors as any} style={StyleSheet.absoluteFillObject}>
|
|
117
117
|
<View style={containerStyle}>{content}</View>
|
|
118
118
|
</LinearGradient>
|
|
119
119
|
);
|
package/src/types/index.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface FormFieldConfig {
|
|
|
44
44
|
key: string;
|
|
45
45
|
label: string;
|
|
46
46
|
placeholder: string;
|
|
47
|
-
type: 'text' | 'number' | 'email' | 'select' | 'multiselect';
|
|
47
|
+
type: 'text' | 'number' | 'email' | 'password' | 'select' | 'multiselect';
|
|
48
48
|
required?: boolean;
|
|
49
49
|
options?: Array<{ value: string; label: string; icon?: string }>;
|
|
50
50
|
validation?: (value: any) => boolean | string;
|
|
@@ -159,7 +159,7 @@ export type AnimationType = 'slide' | 'fade' | 'scale' | 'parallax' | 'cube' | '
|
|
|
159
159
|
export interface AnimationConfig {
|
|
160
160
|
type: AnimationType;
|
|
161
161
|
duration?: number;
|
|
162
|
-
easing?:
|
|
162
|
+
easing?: (t: number) => number;
|
|
163
163
|
parallaxFactor?: number;
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -213,7 +213,7 @@ export interface PaginationProps {
|
|
|
213
213
|
currentIndex: number;
|
|
214
214
|
totalSlides: number;
|
|
215
215
|
theme: OnboardingTheme;
|
|
216
|
-
config
|
|
216
|
+
config?: NavigationConfig;
|
|
217
217
|
style?: ViewStyle;
|
|
218
218
|
}
|
|
219
219
|
|