@umituz/react-native-onboarding 3.6.2 → 3.6.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-onboarding",
3
- "version": "3.6.2",
3
+ "version": "3.6.4",
4
4
  "description": "Advanced onboarding flow for React Native apps with personalization questions, theme-aware colors, animations, and customizable slides. SOLID, DRY, KISS principles applied.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -11,6 +11,11 @@ import type { OnboardingQuestion } from "./OnboardingQuestion";
11
11
  */
12
12
  export type SlideType = "info" | "question" | "welcome" | "completion";
13
13
 
14
+ /**
15
+ * Content position - determines where the text content is positioned
16
+ */
17
+ export type ContentPosition = "center" | "bottom";
18
+
14
19
  /**
15
20
  * Onboarding Slide
16
21
  * Each slide represents one step in the onboarding flow
@@ -39,13 +44,23 @@ export interface OnboardingSlide {
39
44
  /**
40
45
  * Icon to display (emoji or icon name)
41
46
  */
42
- icon: string;
47
+ icon?: string;
43
48
 
44
49
  /**
45
50
  * Type of icon: 'emoji' or 'icon' (default: 'icon')
46
51
  */
47
52
  iconType?: 'emoji' | 'icon';
48
53
 
54
+ /**
55
+ * Hide icon even if provided (default: false)
56
+ */
57
+ hideIcon?: boolean;
58
+
59
+ /**
60
+ * Content position: 'center' or 'bottom' (default: 'center')
61
+ */
62
+ contentPosition?: ContentPosition;
63
+
49
64
  /**
50
65
  * Gradient colors for the slide background (optional)
51
66
  * [startColor, endColor] or [color1, color2, color3] for multi-stop gradients
@@ -101,4 +116,3 @@ export interface OnboardingSlide {
101
116
  */
102
117
  skipIf?: (answers: Record<string, any>) => boolean;
103
118
  }
104
-
@@ -33,13 +33,13 @@ export const useOnboardingStore = createStore<OnboardingStoreState, OnboardingAc
33
33
  name: "onboarding-store",
34
34
  initialState: initialOnboardingState,
35
35
  persist: false,
36
- actions: (set, get) => {
36
+ actions: (set: (state: Partial<OnboardingStoreState>) => void, get: () => OnboardingStoreState) => {
37
37
  const actions = createOnboardingStoreActions(set, get);
38
38
 
39
39
  return {
40
- setCurrentStep: (step) => set({ currentStep: step }),
41
- setLoading: (loading) => set({ loading }),
42
- setError: (error) => set({ error }),
40
+ setCurrentStep: (step: number) => set({ currentStep: step }),
41
+ setLoading: (loading: boolean) => set({ loading }),
42
+ setError: (error: string | null) => set({ error }),
43
43
  setState: set,
44
44
  getState: get,
45
45
 
@@ -5,37 +5,48 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, StyleSheet, ScrollView } from "react-native";
8
+ import type { ContentPosition } from "../../domain/entities/OnboardingSlide";
8
9
 
9
10
  export interface BaseSlideProps {
10
- children: React.ReactNode;
11
+ children: React.ReactNode;
12
+ contentPosition?: ContentPosition;
11
13
  }
12
14
 
13
- export const BaseSlide = ({ children }: BaseSlideProps) => {
14
- return (
15
- <ScrollView
16
- style={styles.container}
17
- contentContainerStyle={styles.content}
18
- showsVerticalScrollIndicator={false}
19
- bounces={false}
20
- >
21
- <View style={styles.slideContainer}>
22
- {children}
23
- </View>
24
- </ScrollView>
25
- );
15
+ export const BaseSlide = ({ children, contentPosition = "center" }: BaseSlideProps) => {
16
+ const isBottom = contentPosition === "bottom";
17
+
18
+ return (
19
+ <ScrollView
20
+ style={styles.container}
21
+ contentContainerStyle={[
22
+ styles.content,
23
+ isBottom && styles.contentBottom
24
+ ]}
25
+ showsVerticalScrollIndicator={false}
26
+ bounces={false}
27
+ >
28
+ <View style={styles.slideContainer}>
29
+ {children}
30
+ </View>
31
+ </ScrollView>
32
+ );
26
33
  };
27
34
 
28
35
  const styles = StyleSheet.create({
29
- container: {
30
- flex: 1,
31
- },
32
- content: {
33
- flexGrow: 1,
34
- justifyContent: "center",
35
- paddingVertical: 40,
36
- },
37
- slideContainer: {
38
- paddingHorizontal: 24,
39
- alignItems: "center",
40
- },
36
+ container: {
37
+ flex: 1,
38
+ },
39
+ content: {
40
+ flexGrow: 1,
41
+ justifyContent: "center",
42
+ paddingVertical: 40,
43
+ },
44
+ contentBottom: {
45
+ justifyContent: "flex-end",
46
+ paddingBottom: 140,
47
+ },
48
+ slideContainer: {
49
+ paddingHorizontal: 24,
50
+ alignItems: "center",
51
+ },
41
52
  });
@@ -21,13 +21,14 @@ export const OnboardingSlide = ({
21
21
  }: OnboardingSlideProps) => {
22
22
  const { colors } = useOnboardingTheme();
23
23
 
24
- const hasIcon = !!slide.icon;
24
+ const shouldShowIcon = slide.icon && !slide.hideIcon;
25
25
  const isEmoji = slide.iconType === 'emoji';
26
26
  const iconSize = variant === "minimal" ? 80 : 72;
27
+ const contentPosition = slide.contentPosition || "center";
27
28
 
28
29
  return (
29
- <BaseSlide>
30
- {hasIcon && (
30
+ <BaseSlide contentPosition={contentPosition}>
31
+ {shouldShowIcon && slide.icon && (
31
32
  <View style={styles.iconBox}>
32
33
  {isEmoji ? (
33
34
  <AtomicText style={{ fontSize: iconSize }}>{slide.icon}</AtomicText>