@umituz/react-native-onboarding 1.0.6 → 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.
|
|
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
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 }),
|