@umituz/react-native-onboarding 2.5.0 → 2.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-onboarding",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
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",
|
|
@@ -19,9 +19,13 @@ export class OnboardingSlideService {
|
|
|
19
19
|
* @returns Filtered slides that should be shown
|
|
20
20
|
*/
|
|
21
21
|
static filterSlides(
|
|
22
|
-
slides: OnboardingSlide[],
|
|
22
|
+
slides: OnboardingSlide[] | undefined,
|
|
23
23
|
userData: OnboardingUserData,
|
|
24
24
|
): OnboardingSlide[] {
|
|
25
|
+
// Safety check: return empty array if slides is undefined or not an array
|
|
26
|
+
if (!slides || !Array.isArray(slides)) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
25
29
|
return slides.filter((slide) => {
|
|
26
30
|
if (slide.skipIf) {
|
|
27
31
|
return !slide.skipIf(userData.answers);
|
|
@@ -96,6 +96,10 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
|
|
|
96
96
|
|
|
97
97
|
// Filter slides using service
|
|
98
98
|
const filteredSlides = useMemo(() => {
|
|
99
|
+
// Safety check: if slides is undefined or empty, return empty array
|
|
100
|
+
if (!slides || !Array.isArray(slides) || slides.length === 0) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
99
103
|
const userData = onboardingStore.getUserData();
|
|
100
104
|
return OnboardingSlideService.filterSlides(slides, userData);
|
|
101
105
|
}, [slides, onboardingStore]);
|