@umituz/react-native-onboarding 1.0.5 → 1.0.7

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": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Generic onboarding flow for React Native apps with gradient backgrounds, animations, and customizable slides. SOLID, DRY, KISS principles applied.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -51,27 +51,45 @@ export const useOnboardingStore = create<OnboardingStore>((set, get) => ({
51
51
  },
52
52
 
53
53
  complete: async (storageKey = DEFAULT_STORAGE_KEY) => {
54
- set({ loading: true, error: null });
54
+ // Optimistic update: Update state immediately for instant UI feedback
55
+ set({
56
+ isOnboardingComplete: true,
57
+ loading: false,
58
+ error: null
59
+ });
55
60
 
61
+ // Persist to storage in background
56
62
  const result = await storageRepository.setString(storageKey, "true");
57
63
 
58
- set({
59
- isOnboardingComplete: result.success,
60
- loading: false,
61
- error: result.success ? null : result.error?.message || null,
62
- });
64
+ // Update state only if storage operation failed
65
+ if (!result.success) {
66
+ set({
67
+ isOnboardingComplete: false,
68
+ loading: false,
69
+ error: result.error?.message || "Failed to save onboarding completion",
70
+ });
71
+ }
63
72
  },
64
73
 
65
74
  skip: async (storageKey = DEFAULT_STORAGE_KEY) => {
66
- set({ loading: true, error: null });
75
+ // Optimistic update: Update state immediately for instant UI feedback
76
+ set({
77
+ isOnboardingComplete: true,
78
+ loading: false,
79
+ error: null
80
+ });
67
81
 
82
+ // Persist to storage in background
68
83
  const result = await storageRepository.setString(storageKey, "true");
69
84
 
70
- set({
71
- isOnboardingComplete: result.success,
72
- loading: false,
73
- error: result.success ? null : result.error?.message || null,
74
- });
85
+ // Update state only if storage operation failed
86
+ if (!result.success) {
87
+ set({
88
+ isOnboardingComplete: false,
89
+ loading: false,
90
+ error: result.error?.message || "Failed to save onboarding skip",
91
+ });
92
+ }
75
93
  },
76
94
 
77
95
  setCurrentStep: (step) => set({ currentStep: step }),
@@ -133,7 +133,7 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
133
133
  {renderSlide ? (
134
134
  renderSlide(currentSlide)
135
135
  ) : (
136
- <OnboardingSlide slide={currentSlide} />
136
+ <OnboardingSlideComponent slide={currentSlide} />
137
137
  )}
138
138
  {renderFooter ? (
139
139
  renderFooter({