@umituz/react-native-onboarding 1.0.0 → 1.0.2
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.2",
|
|
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",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@umituz/react-native-storage": "latest",
|
|
35
35
|
"@umituz/react-native-localization": "latest",
|
|
36
|
-
"@umituz/react-native-theme": "latest",
|
|
36
|
+
"@umituz/react-native-design-system-theme": "latest",
|
|
37
|
+
"@umituz/react-native-design-system": "latest",
|
|
37
38
|
"expo-linear-gradient": "^15.0.0",
|
|
38
39
|
"react": ">=18.2.0",
|
|
39
40
|
"react-native": ">=0.74.0",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"@types/react-native": "^0.73.0",
|
|
45
46
|
"@umituz/react-native-storage": "^1.1.0",
|
|
46
47
|
"@umituz/react-native-localization": "latest",
|
|
47
|
-
"@umituz/react-native-theme": "latest",
|
|
48
|
+
"@umituz/react-native-design-system-theme": "latest",
|
|
48
49
|
"expo-linear-gradient": "^15.0.7",
|
|
49
50
|
"react": "^18.2.0",
|
|
50
51
|
"react-native": "^0.74.0",
|
package/src/index.ts
CHANGED
|
@@ -51,7 +51,14 @@ export {
|
|
|
51
51
|
// =============================================================================
|
|
52
52
|
|
|
53
53
|
export { OnboardingScreen, type OnboardingScreenProps } from "./presentation/screens/OnboardingScreen";
|
|
54
|
-
export { OnboardingSlide, type OnboardingSlideProps } from "./presentation/components/OnboardingSlide";
|
|
55
54
|
export { OnboardingHeader, type OnboardingHeaderProps } from "./presentation/components/OnboardingHeader";
|
|
56
55
|
export { OnboardingFooter, type OnboardingFooterProps } from "./presentation/components/OnboardingFooter";
|
|
57
56
|
|
|
57
|
+
// Export OnboardingSlide component
|
|
58
|
+
// Note: We export it with the same name as the type, which TypeScript allows
|
|
59
|
+
// because one is a type (from domain) and one is a value (component)
|
|
60
|
+
// Users can import both:
|
|
61
|
+
// import type { OnboardingSlide } from '@umituz/react-native-onboarding'; // type
|
|
62
|
+
// import { OnboardingSlide } from '@umituz/react-native-onboarding'; // component
|
|
63
|
+
export { OnboardingSlide, type OnboardingSlideProps } from "./presentation/components/OnboardingSlide";
|
|
64
|
+
|
|
@@ -8,7 +8,7 @@ import React, { useMemo } from "react";
|
|
|
8
8
|
import { View, TouchableOpacity, Text, StyleSheet } from "react-native";
|
|
9
9
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
10
10
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
11
|
-
import { useAppDesignTokens } from "@umituz/react-native-theme";
|
|
11
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
12
12
|
|
|
13
13
|
export interface OnboardingFooterProps {
|
|
14
14
|
currentIndex: number;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import React, { useMemo } from "react";
|
|
8
8
|
import { View, Text, StyleSheet, ScrollView } from "react-native";
|
|
9
|
+
import { AtomicIcon } from "@umituz/react-native-design-system";
|
|
9
10
|
import type { OnboardingSlide as OnboardingSlideType } from "../../domain/entities/OnboardingSlide";
|
|
10
11
|
|
|
11
12
|
export interface OnboardingSlideProps {
|
|
@@ -15,6 +16,9 @@ export interface OnboardingSlideProps {
|
|
|
15
16
|
export const OnboardingSlide: React.FC<OnboardingSlideProps> = ({ slide }) => {
|
|
16
17
|
const styles = useMemo(() => getStyles(), []);
|
|
17
18
|
|
|
19
|
+
// Check if icon is an emoji (contains emoji characters) or Lucide icon name
|
|
20
|
+
const isEmoji = /[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/u.test(slide.icon);
|
|
21
|
+
|
|
18
22
|
return (
|
|
19
23
|
<ScrollView
|
|
20
24
|
contentContainerStyle={styles.content}
|
|
@@ -23,7 +27,15 @@ export const OnboardingSlide: React.FC<OnboardingSlideProps> = ({ slide }) => {
|
|
|
23
27
|
>
|
|
24
28
|
<View style={styles.slideContent}>
|
|
25
29
|
<View style={styles.iconContainer}>
|
|
26
|
-
|
|
30
|
+
{isEmoji ? (
|
|
31
|
+
<Text style={styles.icon}>{slide.icon}</Text>
|
|
32
|
+
) : (
|
|
33
|
+
<AtomicIcon
|
|
34
|
+
name={slide.icon as any}
|
|
35
|
+
customSize={60}
|
|
36
|
+
customColor="#FFFFFF"
|
|
37
|
+
/>
|
|
38
|
+
)}
|
|
27
39
|
</View>
|
|
28
40
|
<Text style={styles.title}>{slide.title}</Text>
|
|
29
41
|
<Text style={styles.description}>{slide.description}</Text>
|
package/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Ümit UZ
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
package/README.md
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# @umituz/react-native-onboarding
|
|
2
|
-
|
|
3
|
-
Generic onboarding flow for React Native apps with gradient backgrounds, animations, and customizable slides. Follows SOLID, DRY, KISS principles - fully reusable across hundreds of apps.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- ✅ **Generic & Reusable**: Works with any app, fully customizable via props
|
|
8
|
-
- ✅ **Gradient Backgrounds**: Beautiful gradient backgrounds for each slide
|
|
9
|
-
- ✅ **Animations**: Smooth transitions and animations
|
|
10
|
-
- ✅ **SOLID Principles**: Clean architecture, easy to extend
|
|
11
|
-
- ✅ **DRY**: No code duplication, generic components
|
|
12
|
-
- ✅ **KISS**: Simple API, easy to understand and use
|
|
13
|
-
- ✅ **Type-Safe**: Full TypeScript support
|
|
14
|
-
- ✅ **Customizable**: Icons, messages, gradients, buttons - all configurable
|
|
15
|
-
- ✅ **Storage Integration**: Uses @umituz/react-native-storage for persistence
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @umituz/react-native-onboarding
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
### Basic Example
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
import { OnboardingScreen } from '@umituz/react-native-onboarding';
|
|
29
|
-
|
|
30
|
-
const slides = [
|
|
31
|
-
{
|
|
32
|
-
id: '1',
|
|
33
|
-
title: 'Welcome',
|
|
34
|
-
description: 'Welcome to the app',
|
|
35
|
-
icon: '🎉',
|
|
36
|
-
gradient: ['#3B82F6', '#8B5CF6'],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: '2',
|
|
40
|
-
title: 'Features',
|
|
41
|
-
description: 'Discover amazing features',
|
|
42
|
-
icon: '✨',
|
|
43
|
-
gradient: ['#60A5FA', '#A78BFA'],
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
<OnboardingScreen
|
|
48
|
-
slides={slides}
|
|
49
|
-
onComplete={() => {
|
|
50
|
-
// Navigate to main app
|
|
51
|
-
}}
|
|
52
|
-
/>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Advanced Example with Customization
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
import { OnboardingScreen } from '@umituz/react-native-onboarding';
|
|
59
|
-
|
|
60
|
-
<OnboardingScreen
|
|
61
|
-
slides={slides}
|
|
62
|
-
onComplete={handleComplete}
|
|
63
|
-
onSkip={handleSkip}
|
|
64
|
-
skipButtonText="Skip"
|
|
65
|
-
nextButtonText="Next"
|
|
66
|
-
getStartedButtonText="Get Started"
|
|
67
|
-
showSkipButton={true}
|
|
68
|
-
showBackButton={true}
|
|
69
|
-
showProgressBar={true}
|
|
70
|
-
showDots={true}
|
|
71
|
-
showProgressText={true}
|
|
72
|
-
storageKey="@myapp_onboarding_completed"
|
|
73
|
-
autoComplete={false}
|
|
74
|
-
/>
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### With Features List
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
const slides = [
|
|
81
|
-
{
|
|
82
|
-
id: '1',
|
|
83
|
-
title: 'Powerful Features',
|
|
84
|
-
description: 'Everything you need in one place',
|
|
85
|
-
icon: '🚀',
|
|
86
|
-
gradient: ['#3B82F6', '#8B5CF6'],
|
|
87
|
-
features: [
|
|
88
|
-
'Feature 1: Amazing capability',
|
|
89
|
-
'Feature 2: Another great feature',
|
|
90
|
-
'Feature 3: One more awesome thing',
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
];
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Custom Components
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
<OnboardingScreen
|
|
100
|
-
slides={slides}
|
|
101
|
-
renderHeader={({ isFirstSlide, onBack, onSkip }) => (
|
|
102
|
-
<CustomHeader onBack={onBack} onSkip={onSkip} />
|
|
103
|
-
)}
|
|
104
|
-
renderFooter={({ currentIndex, totalSlides, isLastSlide, onNext }) => (
|
|
105
|
-
<CustomFooter onNext={onNext} />
|
|
106
|
-
)}
|
|
107
|
-
renderSlide={(slide) => <CustomSlide slide={slide} />}
|
|
108
|
-
/>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## API Reference
|
|
112
|
-
|
|
113
|
-
### `OnboardingSlide`
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
interface OnboardingSlide {
|
|
117
|
-
id: string;
|
|
118
|
-
title: string;
|
|
119
|
-
description: string;
|
|
120
|
-
icon: string; // Emoji or icon name
|
|
121
|
-
gradient: string[]; // [startColor, endColor] or [color1, color2, color3]
|
|
122
|
-
image?: string; // Optional image URL
|
|
123
|
-
features?: string[]; // Optional features list
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### `OnboardingOptions`
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
interface OnboardingOptions {
|
|
131
|
-
slides: OnboardingSlide[];
|
|
132
|
-
onComplete?: () => void | Promise<void>;
|
|
133
|
-
onSkip?: () => void | Promise<void>;
|
|
134
|
-
skipButtonText?: string;
|
|
135
|
-
nextButtonText?: string;
|
|
136
|
-
getStartedButtonText?: string;
|
|
137
|
-
showSkipButton?: boolean;
|
|
138
|
-
showBackButton?: boolean;
|
|
139
|
-
showProgressBar?: boolean;
|
|
140
|
-
showDots?: boolean;
|
|
141
|
-
showProgressText?: boolean;
|
|
142
|
-
storageKey?: string;
|
|
143
|
-
autoComplete?: boolean;
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### `useOnboardingStore`
|
|
148
|
-
|
|
149
|
-
Hook for managing onboarding completion state.
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
const { isOnboardingComplete, complete, skip, reset } = useOnboardingStore();
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### `useOnboardingNavigation`
|
|
156
|
-
|
|
157
|
-
Hook for managing navigation state.
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
const { currentIndex, goToNext, goToPrevious, isLastSlide, isFirstSlide } =
|
|
161
|
-
useOnboardingNavigation(totalSlides, onComplete, onSkip);
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
## Architecture
|
|
165
|
-
|
|
166
|
-
- **Domain Layer**: Entities and interfaces (business logic)
|
|
167
|
-
- **Infrastructure Layer**: Storage and hooks (state management)
|
|
168
|
-
- **Presentation Layer**: Components and screens (UI)
|
|
169
|
-
|
|
170
|
-
No app-specific code, fully generic and reusable.
|
|
171
|
-
|
|
172
|
-
## License
|
|
173
|
-
|
|
174
|
-
MIT
|
|
175
|
-
|