@blazejkustra/react-native-onboarding 0.1.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/LICENSE +20 -0
- package/README.md +360 -0
- package/lib/module/index.js +23 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/spill-onboarding/adapters/expo-image.js +13 -0
- package/lib/module/spill-onboarding/adapters/expo-image.js.map +1 -0
- package/lib/module/spill-onboarding/adapters/react-native-svg.js +16 -0
- package/lib/module/spill-onboarding/adapters/react-native-svg.js.map +1 -0
- package/lib/module/spill-onboarding/buttons/PrimaryButton.js +50 -0
- package/lib/module/spill-onboarding/buttons/PrimaryButton.js.map +1 -0
- package/lib/module/spill-onboarding/buttons/SecondaryButton.js +51 -0
- package/lib/module/spill-onboarding/buttons/SecondaryButton.js.map +1 -0
- package/lib/module/spill-onboarding/buttons/SkipButton.js +35 -0
- package/lib/module/spill-onboarding/buttons/SkipButton.js.map +1 -0
- package/lib/module/spill-onboarding/components/OnboardingImageContainer.js +117 -0
- package/lib/module/spill-onboarding/components/OnboardingImageContainer.js.map +1 -0
- package/lib/module/spill-onboarding/components/OnboardingIntroPanel.js +97 -0
- package/lib/module/spill-onboarding/components/OnboardingIntroPanel.js.map +1 -0
- package/lib/module/spill-onboarding/components/OnboardingModal.js +69 -0
- package/lib/module/spill-onboarding/components/OnboardingModal.js.map +1 -0
- package/lib/module/spill-onboarding/components/OnboardingStepContainer.js +60 -0
- package/lib/module/spill-onboarding/components/OnboardingStepContainer.js.map +1 -0
- package/lib/module/spill-onboarding/components/OnboardingStepPanel.js +122 -0
- package/lib/module/spill-onboarding/components/OnboardingStepPanel.js.map +1 -0
- package/lib/module/spill-onboarding/hooks/useMeasureHeight.js +18 -0
- package/lib/module/spill-onboarding/hooks/useMeasureHeight.js.map +1 -0
- package/lib/module/spill-onboarding/icons/ArrowLeftIcon.js +57 -0
- package/lib/module/spill-onboarding/icons/ArrowLeftIcon.js.map +1 -0
- package/lib/module/spill-onboarding/icons/CloseIcon.js +49 -0
- package/lib/module/spill-onboarding/icons/CloseIcon.js.map +1 -0
- package/lib/module/spill-onboarding/index.js +181 -0
- package/lib/module/spill-onboarding/index.js.map +1 -0
- package/lib/module/spill-onboarding/types.js +4 -0
- package/lib/module/spill-onboarding/types.js.map +1 -0
- package/lib/module/utils/ThemeContext.js +78 -0
- package/lib/module/utils/ThemeContext.js.map +1 -0
- package/lib/module/utils/fontStyles.js +21 -0
- package/lib/module/utils/fontStyles.js.map +1 -0
- package/lib/module/utils/theme.js +27 -0
- package/lib/module/utils/theme.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/adapters/expo-image.d.ts +4 -0
- package/lib/typescript/src/spill-onboarding/adapters/expo-image.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/adapters/react-native-svg.d.ts +5 -0
- package/lib/typescript/src/spill-onboarding/adapters/react-native-svg.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/buttons/PrimaryButton.d.ts +13 -0
- package/lib/typescript/src/spill-onboarding/buttons/PrimaryButton.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/buttons/SecondaryButton.d.ts +13 -0
- package/lib/typescript/src/spill-onboarding/buttons/SecondaryButton.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/buttons/SkipButton.d.ts +6 -0
- package/lib/typescript/src/spill-onboarding/buttons/SkipButton.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingImageContainer.d.ts +18 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingImageContainer.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingIntroPanel.d.ts +4 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingIntroPanel.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingModal.d.ts +8 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingModal.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingStepContainer.d.ts +16 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingStepContainer.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingStepPanel.d.ts +4 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingStepPanel.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/hooks/useMeasureHeight.d.ts +9 -0
- package/lib/typescript/src/spill-onboarding/hooks/useMeasureHeight.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/icons/ArrowLeftIcon.d.ts +7 -0
- package/lib/typescript/src/spill-onboarding/icons/ArrowLeftIcon.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/icons/CloseIcon.d.ts +7 -0
- package/lib/typescript/src/spill-onboarding/icons/CloseIcon.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/index.d.ts +4 -0
- package/lib/typescript/src/spill-onboarding/index.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/types.d.ts +187 -0
- package/lib/typescript/src/spill-onboarding/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/ThemeContext.d.ts +14 -0
- package/lib/typescript/src/utils/ThemeContext.d.ts.map +1 -0
- package/lib/typescript/src/utils/fontStyles.d.ts +19 -0
- package/lib/typescript/src/utils/fontStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/theme.d.ts +30 -0
- package/lib/typescript/src/utils/theme.d.ts.map +1 -0
- package/package.json +171 -0
- package/src/index.tsx +29 -0
- package/src/spill-onboarding/adapters/expo-image.ts +12 -0
- package/src/spill-onboarding/adapters/react-native-svg.ts +17 -0
- package/src/spill-onboarding/buttons/PrimaryButton.tsx +70 -0
- package/src/spill-onboarding/buttons/SecondaryButton.tsx +71 -0
- package/src/spill-onboarding/buttons/SkipButton.tsx +34 -0
- package/src/spill-onboarding/components/OnboardingImageContainer.tsx +166 -0
- package/src/spill-onboarding/components/OnboardingIntroPanel.tsx +105 -0
- package/src/spill-onboarding/components/OnboardingModal.tsx +75 -0
- package/src/spill-onboarding/components/OnboardingStepContainer.tsx +85 -0
- package/src/spill-onboarding/components/OnboardingStepPanel.tsx +118 -0
- package/src/spill-onboarding/hooks/useMeasureHeight.ts +21 -0
- package/src/spill-onboarding/icons/ArrowLeftIcon.tsx +69 -0
- package/src/spill-onboarding/icons/CloseIcon.tsx +55 -0
- package/src/spill-onboarding/index.tsx +220 -0
- package/src/spill-onboarding/types.ts +237 -0
- package/src/utils/ThemeContext.tsx +87 -0
- package/src/utils/fontStyles.ts +19 -0
- package/src/utils/theme.ts +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Blazej Kustra
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
https://github.com/user-attachments/assets/bb51a0c3-15be-42b6-b20d-c33c29b84bc7
|
|
2
|
+
|
|
3
|
+
<!--  -->
|
|
4
|
+
|
|
5
|
+
# @blazejkustra/react-native-onboarding
|
|
6
|
+
|
|
7
|
+
✨ **Beautiful, customizable onboarding/tutorial flows** for React Native — with smooth animations, flexible theming, and highly customizable components.
|
|
8
|
+
|
|
9
|
+
## 🚀 Features
|
|
10
|
+
|
|
11
|
+
* **Cross-platform** – Works seamlessly on iOS, Android, and Web
|
|
12
|
+
* **Smooth animations** – React Native Reanimated for smooth transitions
|
|
13
|
+
* **Works out of the box** – Just install and use with default styles
|
|
14
|
+
* **Flexible theming and custom components** – Complete control over colors, fonts, and styling
|
|
15
|
+
|
|
16
|
+
## Inspired by [Private Mind App](https://github.com/software-mansion-labs/private-mind)
|
|
17
|
+
|
|
18
|
+
A private AI app that runs entirely offline on your device, with no data sent to the cloud and no internet connection required. Private Mind represents a new era of AI! Powerful, personal, and completely private.
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## 📦 Installation
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm install @blazejkustra/react-native-onboarding
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The library requires these dependencies for animations and safe area context:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm install react-native-reanimated react-native-safe-area-context
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Optionally for image support, install one of:
|
|
36
|
+
```sh
|
|
37
|
+
npm install expo-image
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm install react-native-svg
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 🛠 Basic usage
|
|
45
|
+
|
|
46
|
+
You can use Onboarding component with default styles just by passing required props to the component:
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import Onboarding from '@blazejkustra/react-native-onboarding';
|
|
50
|
+
|
|
51
|
+
function MyOnboarding() {
|
|
52
|
+
return (
|
|
53
|
+
<Onboarding
|
|
54
|
+
introPanel={{
|
|
55
|
+
title: 'Welcome to My App',
|
|
56
|
+
subtitle: 'Let\'s get you started',
|
|
57
|
+
button: 'Get Started',
|
|
58
|
+
image: require('./assets/logo.png'),
|
|
59
|
+
}}
|
|
60
|
+
steps={[
|
|
61
|
+
{
|
|
62
|
+
title: 'Step 1',
|
|
63
|
+
description: 'This is the first step of your journey',
|
|
64
|
+
buttonLabel: 'Next',
|
|
65
|
+
image: require('./assets/step1.png'),
|
|
66
|
+
position: 'top',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: 'Step 2',
|
|
70
|
+
description: 'Learn about our amazing features',
|
|
71
|
+
buttonLabel: 'Continue',
|
|
72
|
+
image: require('./assets/step2.png'),
|
|
73
|
+
position: 'bottom',
|
|
74
|
+
},
|
|
75
|
+
]}
|
|
76
|
+
onComplete={() => {
|
|
77
|
+
await AsyncStorage.setItem(ONBOARDING_COMPLETED_KEY, 'true');
|
|
78
|
+
console.log('Onboarding completed!')
|
|
79
|
+
}}
|
|
80
|
+
onSkip={() => console.log('Onboarding skipped')}
|
|
81
|
+
onStepChange={(step) => console.log('Current step:', step)}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Custom Components
|
|
88
|
+
|
|
89
|
+
Or you can create your own custom components for the intro panel, individual steps, background, close button, etc.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
function CustomIntro({ onPressStart }: { onPressStart: () => void }) {
|
|
93
|
+
return (
|
|
94
|
+
... your custom intro panel ...
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function CustomStep({ onNext, onBack, isLast }: { onNext: () => void, onBack: () => void, isLast: boolean }) {
|
|
99
|
+
return (
|
|
100
|
+
... your custom step component ...
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function CustomBackground() {
|
|
105
|
+
return (
|
|
106
|
+
... your custom background component ...
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function CustomCloseButton({ onPress }: { onPress: () => void }) {
|
|
111
|
+
return (
|
|
112
|
+
... your custom close button component ...
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
<Onboarding
|
|
117
|
+
introPanel={CustomIntro}
|
|
118
|
+
background={CustomBackground}
|
|
119
|
+
skipButton={CustomCloseButton}
|
|
120
|
+
steps={[
|
|
121
|
+
{
|
|
122
|
+
component: CustomStep,
|
|
123
|
+
image: require('./assets/step1.png'),
|
|
124
|
+
position: 'top',
|
|
125
|
+
},
|
|
126
|
+
// ... more steps
|
|
127
|
+
]}
|
|
128
|
+
// ... other props
|
|
129
|
+
/>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 📖 API
|
|
133
|
+
|
|
134
|
+
To see all the props and their types, check the [types](src/spill-onboarding/types.ts) file. Also example usages are available in the [example](example/src/screens) catalog.
|
|
135
|
+
|
|
136
|
+
### OnboardingProps
|
|
137
|
+
|
|
138
|
+
#### `introPanel`
|
|
139
|
+
**Type:** `OnboardingIntroPanel`
|
|
140
|
+
**Required** - The welcome screen that users see at the start of the onboarding
|
|
141
|
+
|
|
142
|
+
The intro panel can be either:
|
|
143
|
+
- **Default panel**: Pass an object with `title`, `subtitle`, `button`, `image`
|
|
144
|
+
- **Custom component**: Pass a render function that receives `onPressStart` callback
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
// Default intro panel
|
|
148
|
+
introPanel={{
|
|
149
|
+
title: "Welcome to MyApp",
|
|
150
|
+
subtitle: "Let's get you started",
|
|
151
|
+
button: "Get Started",
|
|
152
|
+
image: require('./assets/welcome.png')
|
|
153
|
+
}}
|
|
154
|
+
|
|
155
|
+
// Custom intro panel
|
|
156
|
+
introPanel={({ onPressStart }) => (
|
|
157
|
+
<CustomWelcomeScreen onStart={onPressStart} />
|
|
158
|
+
)}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+

|
|
162
|
+
|
|
163
|
+
#### `steps`
|
|
164
|
+
**Type:** `OnboardingStep[]`
|
|
165
|
+
**Required** - Array of onboarding steps to display
|
|
166
|
+
|
|
167
|
+

|
|
168
|
+
|
|
169
|
+
Each step can be either a default text-based step or a fully custom component:
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
// Default step
|
|
173
|
+
{
|
|
174
|
+
label: "Step 1",
|
|
175
|
+
title: "Connect Your Account",
|
|
176
|
+
description: "Link your account to get started",
|
|
177
|
+
buttonLabel: "Connect",
|
|
178
|
+
image: require('./assets/step1.png'),
|
|
179
|
+
position: 'top'
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Custom step component
|
|
183
|
+
{
|
|
184
|
+
component: ({ onNext, onBack, isLast }) => (
|
|
185
|
+
<CustomStepComponent
|
|
186
|
+
onNext={onNext}
|
|
187
|
+
onBack={onBack}
|
|
188
|
+
isLast={isLast}
|
|
189
|
+
... other props ...
|
|
190
|
+
/>
|
|
191
|
+
),
|
|
192
|
+
image: require('./assets/step2.png'),
|
|
193
|
+
position: 'bottom'
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
#### `onComplete`
|
|
199
|
+
**Type:** `() => void`
|
|
200
|
+
**Required** - Callback fired when user completes the final step, usually used to save the completion state to the local storage and navigate to the main app.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
onComplete={() => {
|
|
204
|
+
// Navigate to main app
|
|
205
|
+
navigation.navigate('Home');
|
|
206
|
+
// Or save completion state
|
|
207
|
+
AsyncStorage.setItem('onboarding_completed', 'true');
|
|
208
|
+
}}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### `onSkip`
|
|
212
|
+
**Type:** `() => void`
|
|
213
|
+
**Optional** - Callback fired when user skips onboarding, usually used to track the skip event and navigate away from the onboarding.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
onSkip={() => {
|
|
217
|
+
// Track skip event
|
|
218
|
+
analytics.track('onboarding_skipped');
|
|
219
|
+
// Navigate away
|
|
220
|
+
navigation.goBack();
|
|
221
|
+
}}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### `onStepChange`
|
|
225
|
+
**Type:** `(stepIndex: number) => void`
|
|
226
|
+
**Default:** `undefined` - Callback fired when the active step changes
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
onStepChange={(stepIndex) => {
|
|
230
|
+
// Track progress
|
|
231
|
+
analytics.track('onboarding_step', { step: stepIndex });
|
|
232
|
+
}}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### `showCloseButton`
|
|
236
|
+
**Type:** `boolean`
|
|
237
|
+
**Default:** `true` - Whether to show the close button in the header
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
showCloseButton={false} // Hide close button
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### `showBackButton`
|
|
244
|
+
**Type:** `boolean`
|
|
245
|
+
**Default:** `true` - Whether to show back button on steps (except first step)
|
|
246
|
+
|
|
247
|
+

|
|
248
|
+
|
|
249
|
+
```tsx
|
|
250
|
+
showBackButton={false} // Disable back navigation
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### `wrapInModalOnWeb`
|
|
254
|
+
**Type:** `boolean`
|
|
255
|
+
**Default:** `true` - Whether to wrap the onboarding in a modal on web
|
|
256
|
+
|
|
257
|
+

|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
wrapInModalOnWeb={false} // Disable modal wrapping
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### `animationDuration`
|
|
264
|
+
**Type:** `number`
|
|
265
|
+
**Default:** `500` - Animation duration in milliseconds for step transitions
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
animationDuration={300} // Faster animations
|
|
269
|
+
animationDuration={800} // Slower if app is for seniors 👴🏽👵🏼
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### `colors`
|
|
273
|
+
**Type:** `OnboardingColors`
|
|
274
|
+
**Default:**
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
colors={{
|
|
278
|
+
background: {
|
|
279
|
+
primary: '#FFFFFF',
|
|
280
|
+
secondary: '#F8F9FA',
|
|
281
|
+
label: '#E9ECEF',
|
|
282
|
+
accent: '#007AFF'
|
|
283
|
+
},
|
|
284
|
+
text: {
|
|
285
|
+
primary: '#1C1C1E',
|
|
286
|
+
secondary: '#8E8E93',
|
|
287
|
+
contrast: '#FFFFFF'
|
|
288
|
+
}
|
|
289
|
+
}}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### `fonts`
|
|
293
|
+
**Type:** `OnboardingFonts | string`
|
|
294
|
+
**Default:** `'System'` - Custom font configuration
|
|
295
|
+
|
|
296
|
+
```tsx
|
|
297
|
+
// Single font for all text
|
|
298
|
+
fonts="Inter"
|
|
299
|
+
|
|
300
|
+
// Detailed font configuration
|
|
301
|
+
fonts={{
|
|
302
|
+
introTitle: 'Inter-Bold',
|
|
303
|
+
introSubtitle: 'Inter-Medium',
|
|
304
|
+
stepTitle: 'Inter-SemiBold',
|
|
305
|
+
stepDescription: 'Inter-Regular',
|
|
306
|
+
primaryButton: 'Inter-Medium'
|
|
307
|
+
}}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
#### `background`
|
|
311
|
+
**Type:** `() => ReactNode`
|
|
312
|
+
**Default:** `undefined` - Custom background element rendered behind content
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
background={() => (
|
|
316
|
+
<Image
|
|
317
|
+
source={require('./assets/background.png')}
|
|
318
|
+
style={StyleSheet.absoluteFillObject}
|
|
319
|
+
/>
|
|
320
|
+
)}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### `skipButton`
|
|
324
|
+
**Type:** `({ onPress }: { onPress: () => void }) => ReactNode`
|
|
325
|
+
**Default:** X icon - Custom close button renderer
|
|
326
|
+
|
|
327
|
+

|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
skipButton={({ onPress }) => (
|
|
331
|
+
<TouchableOpacity onPress={onPress}>
|
|
332
|
+
<Text style={styles.customClose}>✕</Text>
|
|
333
|
+
</TouchableOpacity>
|
|
334
|
+
)}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
## 💡 Best Practices
|
|
339
|
+
|
|
340
|
+
### Image Consistency
|
|
341
|
+
Use images with the same dimensions for the best visual effect. This prevents layout shifts and creates smooth transitions between steps.
|
|
342
|
+
|
|
343
|
+
### Persistent Storage
|
|
344
|
+
Save onboarding completion state to persistent storage (MMKV, AsyncStorage) to prevent users from seeing the onboarding again after completion.
|
|
345
|
+
|
|
346
|
+
### Navigation
|
|
347
|
+
On completion, navigate users to the main app to provide a smooth transition from onboarding to the core experience.
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
## 🤝 Contributing
|
|
351
|
+
|
|
352
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for our code of conduct.
|
|
353
|
+
|
|
354
|
+
## 📄 License
|
|
355
|
+
|
|
356
|
+
MIT © [Blazej Kustra](https://github.com/blazejkustra)
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
Built with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) 🛠
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import ThemeProvider from "./utils/ThemeContext.js";
|
|
4
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
|
+
import SpillOnboarding from "./spill-onboarding/index.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function Onboarding({
|
|
8
|
+
colors,
|
|
9
|
+
fonts,
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /*#__PURE__*/_jsx(SafeAreaProvider, {
|
|
13
|
+
children: /*#__PURE__*/_jsx(ThemeProvider, {
|
|
14
|
+
colors: colors,
|
|
15
|
+
fonts: fonts,
|
|
16
|
+
children: /*#__PURE__*/_jsx(SpillOnboarding, {
|
|
17
|
+
...props
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export default Onboarding;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ThemeProvider","SafeAreaProvider","SpillOnboarding","jsx","_jsx","Onboarding","colors","fonts","props","children"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,yBAAsB;AAChD,SAASC,gBAAgB,QAAQ,gCAAgC;AAQjE,OAAOC,eAAe,MAAM,6BAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjD,SAASC,UAAUA,CAAC;EAAEC,MAAM;EAAEC,KAAK;EAAE,GAAGC;AAAuB,CAAC,EAAE;EAChE,oBACEJ,IAAA,CAACH,gBAAgB;IAAAQ,QAAA,eACfL,IAAA,CAACJ,aAAa;MAACM,MAAM,EAAEA,MAAO;MAACC,KAAK,EAAEA,KAAM;MAAAE,QAAA,eAC1CL,IAAA,CAACF,eAAe;QAAA,GAAKM;MAAK,CAAG;IAAC,CACjB;EAAC,CACA,CAAC;AAEvB;AAEA,eAAeH,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ExpoImage","Image","require"],"sourceRoot":"../../../../src","sources":["spill-onboarding/adapters/expo-image.ts"],"mappings":";;AAEA,IAAIA,SAAsC,GAAG,IAAI;AAEjD,IAAI;EACF,MAAM;IAAEC;EAAM,CAAC,GAAGC,OAAO,CAAC,YAAY,CAAC;EACvCF,SAAS,GAAGC,KAAK;AACnB,CAAC,CAAC,MAAM;EACN;AAAA;AAGF,SAASD,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
let ReactNativeSVG = null;
|
|
4
|
+
let ReactNativeSVGPath = null;
|
|
5
|
+
try {
|
|
6
|
+
const {
|
|
7
|
+
Svg,
|
|
8
|
+
Path
|
|
9
|
+
} = require('react-native-svg');
|
|
10
|
+
ReactNativeSVG = Svg;
|
|
11
|
+
ReactNativeSVGPath = Path;
|
|
12
|
+
} catch {
|
|
13
|
+
// react-native-svg not available
|
|
14
|
+
}
|
|
15
|
+
export { ReactNativeSVG, ReactNativeSVGPath };
|
|
16
|
+
//# sourceMappingURL=react-native-svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNativeSVG","ReactNativeSVGPath","Svg","Path","require"],"sourceRoot":"../../../../src","sources":["spill-onboarding/adapters/react-native-svg.ts"],"mappings":";;AAKA,IAAIA,cAAuC,GAAG,IAAI;AAClD,IAAIC,kBAA+C,GAAG,IAAI;AAE1D,IAAI;EACF,MAAM;IAAEC,GAAG;IAAEC;EAAK,CAAC,GAAGC,OAAO,CAAC,kBAAkB,CAAC;EACjDJ,cAAc,GAAGE,GAAG;EACpBD,kBAAkB,GAAGE,IAAI;AAC3B,CAAC,CAAC,MAAM;EACN;AAAA;AAGF,SAASH,cAAc,EAAEC,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { TouchableOpacity, Text, StyleSheet } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../utils/ThemeContext.js";
|
|
6
|
+
import { fontSizes } from "../../utils/fontStyles.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const PrimaryButton = ({
|
|
9
|
+
text,
|
|
10
|
+
onPress,
|
|
11
|
+
icon,
|
|
12
|
+
disabled = false,
|
|
13
|
+
style,
|
|
14
|
+
textStyle
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
theme
|
|
18
|
+
} = useTheme();
|
|
19
|
+
const styles = useMemo(() => createStyles(theme, disabled), [theme, disabled]);
|
|
20
|
+
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
21
|
+
onPress: onPress,
|
|
22
|
+
disabled: disabled,
|
|
23
|
+
style: [styles.button, style],
|
|
24
|
+
children: [icon, /*#__PURE__*/_jsx(Text, {
|
|
25
|
+
style: [styles.text, textStyle],
|
|
26
|
+
children: text
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export default PrimaryButton;
|
|
31
|
+
const createStyles = (theme, disabled) => StyleSheet.create({
|
|
32
|
+
button: {
|
|
33
|
+
height: 48,
|
|
34
|
+
width: '100%',
|
|
35
|
+
borderRadius: 12,
|
|
36
|
+
paddingHorizontal: 10,
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
backgroundColor: theme.bg.primary,
|
|
40
|
+
opacity: disabled ? 0.4 : 1,
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
gap: 2
|
|
43
|
+
},
|
|
44
|
+
text: {
|
|
45
|
+
fontFamily: theme.fonts.primaryButton,
|
|
46
|
+
fontSize: fontSizes.md,
|
|
47
|
+
color: theme.text.contrast
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=PrimaryButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","TouchableOpacity","Text","StyleSheet","useTheme","fontSizes","jsx","_jsx","jsxs","_jsxs","PrimaryButton","text","onPress","icon","disabled","style","textStyle","theme","styles","createStyles","button","children","create","height","width","borderRadius","paddingHorizontal","justifyContent","alignItems","backgroundColor","bg","primary","opacity","flexDirection","gap","fontFamily","fonts","primaryButton","fontSize","md","color","contrast"],"sourceRoot":"../../../../src","sources":["spill-onboarding/buttons/PrimaryButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SACEC,gBAAgB,EAChBC,IAAI,EACJC,UAAU,QAIL,cAAc;AACrB,SAASC,QAAQ,QAAQ,6BAA0B;AACnD,SAASC,SAAS,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAYnD,MAAMC,aAAa,GAAGA,CAAC;EACrBC,IAAI;EACJC,OAAO;EACPC,IAAI;EACJC,QAAQ,GAAG,KAAK;EAChBC,KAAK;EACLC;AACK,CAAC,KAAK;EACX,MAAM;IAAEC;EAAM,CAAC,GAAGb,QAAQ,CAAC,CAAC;EAC5B,MAAMc,MAAM,GAAGlB,OAAO,CACpB,MAAMmB,YAAY,CAACF,KAAK,EAAEH,QAAQ,CAAC,EACnC,CAACG,KAAK,EAAEH,QAAQ,CAClB,CAAC;EAED,oBACEL,KAAA,CAACR,gBAAgB;IACfW,OAAO,EAAEA,OAAQ;IACjBE,QAAQ,EAAEA,QAAS;IACnBC,KAAK,EAAE,CAACG,MAAM,CAACE,MAAM,EAAEL,KAAK,CAAE;IAAAM,QAAA,GAE7BR,IAAI,eACLN,IAAA,CAACL,IAAI;MAACa,KAAK,EAAE,CAACG,MAAM,CAACP,IAAI,EAAEK,SAAS,CAAE;MAAAK,QAAA,EAAEV;IAAI,CAAO,CAAC;EAAA,CACpC,CAAC;AAEvB,CAAC;AAED,eAAeD,aAAa;AAE5B,MAAMS,YAAY,GAAGA,CAACF,KAAY,EAAEH,QAAiB,KACnDX,UAAU,CAACmB,MAAM,CAAC;EAChBF,MAAM,EAAE;IACNG,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE,MAAM;IACbC,YAAY,EAAE,EAAE;IAChBC,iBAAiB,EAAE,EAAE;IACrBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,eAAe,EAAEZ,KAAK,CAACa,EAAE,CAACC,OAAO;IACjCC,OAAO,EAAElB,QAAQ,GAAG,GAAG,GAAG,CAAC;IAC3BmB,aAAa,EAAE,KAAK;IACpBC,GAAG,EAAE;EACP,CAAC;EACDvB,IAAI,EAAE;IACJwB,UAAU,EAAElB,KAAK,CAACmB,KAAK,CAACC,aAAa;IACrCC,QAAQ,EAAEjC,SAAS,CAACkC,EAAE;IACtBC,KAAK,EAAEvB,KAAK,CAACN,IAAI,CAAC8B;EACpB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { TouchableOpacity, Text, StyleSheet } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../utils/ThemeContext.js";
|
|
6
|
+
import { fontSizes } from "../../utils/fontStyles.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const SecondaryButton = ({
|
|
9
|
+
text,
|
|
10
|
+
onPress,
|
|
11
|
+
icon,
|
|
12
|
+
disabled = false,
|
|
13
|
+
style,
|
|
14
|
+
textStyle
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
theme
|
|
18
|
+
} = useTheme();
|
|
19
|
+
const styles = useMemo(() => createStyles(theme, disabled), [theme, disabled]);
|
|
20
|
+
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
21
|
+
onPress: onPress,
|
|
22
|
+
disabled: disabled,
|
|
23
|
+
style: [styles.button, style],
|
|
24
|
+
children: [icon, !!text && /*#__PURE__*/_jsx(Text, {
|
|
25
|
+
style: [styles.text, textStyle],
|
|
26
|
+
children: text
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export default SecondaryButton;
|
|
31
|
+
const createStyles = (theme, disabled) => StyleSheet.create({
|
|
32
|
+
button: {
|
|
33
|
+
height: 48,
|
|
34
|
+
paddingHorizontal: 10,
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
borderWidth: 1,
|
|
38
|
+
borderRadius: 12,
|
|
39
|
+
borderColor: theme.bg.accent,
|
|
40
|
+
opacity: disabled ? 0.4 : 1,
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
gap: 2
|
|
43
|
+
},
|
|
44
|
+
text: {
|
|
45
|
+
fontFamily: theme.fonts.secondaryButton,
|
|
46
|
+
fontSize: fontSizes.sm,
|
|
47
|
+
color: theme.text.primary,
|
|
48
|
+
lineHeight: 20
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=SecondaryButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","TouchableOpacity","Text","StyleSheet","useTheme","fontSizes","jsx","_jsx","jsxs","_jsxs","SecondaryButton","text","onPress","icon","disabled","style","textStyle","theme","styles","createStyles","button","children","create","height","paddingHorizontal","alignItems","justifyContent","borderWidth","borderRadius","borderColor","bg","accent","opacity","flexDirection","gap","fontFamily","fonts","secondaryButton","fontSize","sm","color","primary","lineHeight"],"sourceRoot":"../../../../src","sources":["spill-onboarding/buttons/SecondaryButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SACEC,gBAAgB,EAChBC,IAAI,EACJC,UAAU,QAIL,cAAc;AACrB,SAASC,QAAQ,QAAQ,6BAA0B;AACnD,SAASC,SAAS,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAYnD,MAAMC,eAAe,GAAGA,CAAC;EACvBC,IAAI;EACJC,OAAO;EACPC,IAAI;EACJC,QAAQ,GAAG,KAAK;EAChBC,KAAK;EACLC;AACK,CAAC,KAAK;EACX,MAAM;IAAEC;EAAM,CAAC,GAAGb,QAAQ,CAAC,CAAC;EAC5B,MAAMc,MAAM,GAAGlB,OAAO,CACpB,MAAMmB,YAAY,CAACF,KAAK,EAAEH,QAAQ,CAAC,EACnC,CAACG,KAAK,EAAEH,QAAQ,CAClB,CAAC;EAED,oBACEL,KAAA,CAACR,gBAAgB;IACfW,OAAO,EAAEA,OAAQ;IACjBE,QAAQ,EAAEA,QAAS;IACnBC,KAAK,EAAE,CAACG,MAAM,CAACE,MAAM,EAAEL,KAAK,CAAE;IAAAM,QAAA,GAE7BR,IAAI,EACJ,CAAC,CAACF,IAAI,iBAAIJ,IAAA,CAACL,IAAI;MAACa,KAAK,EAAE,CAACG,MAAM,CAACP,IAAI,EAAEK,SAAS,CAAE;MAAAK,QAAA,EAAEV;IAAI,CAAO,CAAC;EAAA,CAC/C,CAAC;AAEvB,CAAC;AAED,eAAeD,eAAe;AAE9B,MAAMS,YAAY,GAAGA,CAACF,KAAY,EAAEH,QAAiB,KACnDX,UAAU,CAACmB,MAAM,CAAC;EAChBF,MAAM,EAAE;IACNG,MAAM,EAAE,EAAE;IACVC,iBAAiB,EAAE,EAAE;IACrBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAEZ,KAAK,CAACa,EAAE,CAACC,MAAM;IAC5BC,OAAO,EAAElB,QAAQ,GAAG,GAAG,GAAG,CAAC;IAC3BmB,aAAa,EAAE,KAAK;IACpBC,GAAG,EAAE;EACP,CAAC;EACDvB,IAAI,EAAE;IACJwB,UAAU,EAAElB,KAAK,CAACmB,KAAK,CAACC,eAAe;IACvCC,QAAQ,EAAEjC,SAAS,CAACkC,EAAE;IACtBC,KAAK,EAAEvB,KAAK,CAACN,IAAI,CAAC8B,OAAO;IACzBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../utils/ThemeContext.js";
|
|
6
|
+
import CloseIcon from "../icons/CloseIcon.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
function SkipButton({
|
|
9
|
+
onPress
|
|
10
|
+
}) {
|
|
11
|
+
const {
|
|
12
|
+
theme
|
|
13
|
+
} = useTheme();
|
|
14
|
+
const styles = useMemo(() => createStyles(theme), [theme]);
|
|
15
|
+
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
16
|
+
style: styles.wrapper,
|
|
17
|
+
onPress: onPress,
|
|
18
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
19
|
+
color: theme.text.primary,
|
|
20
|
+
size: 24
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export default SkipButton;
|
|
25
|
+
const createStyles = theme => StyleSheet.create({
|
|
26
|
+
wrapper: {
|
|
27
|
+
backgroundColor: theme.bg.secondary,
|
|
28
|
+
width: 32,
|
|
29
|
+
height: 32,
|
|
30
|
+
borderRadius: 6,
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
alignItems: 'center'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=SkipButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","StyleSheet","TouchableOpacity","useTheme","CloseIcon","jsx","_jsx","SkipButton","onPress","theme","styles","createStyles","style","wrapper","children","color","text","primary","size","create","backgroundColor","bg","secondary","width","height","borderRadius","justifyContent","alignItems"],"sourceRoot":"../../../../src","sources":["spill-onboarding/buttons/SkipButton.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,cAAc;AAC3D,SAASC,QAAQ,QAAQ,6BAA0B;AAEnD,OAAOC,SAAS,MAAM,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAM3C,SAASC,UAAUA,CAAC;EAAEC;AAAe,CAAC,EAAE;EACtC,MAAM;IAAEC;EAAM,CAAC,GAAGN,QAAQ,CAAC,CAAC;EAC5B,MAAMO,MAAM,GAAGV,OAAO,CAAC,MAAMW,YAAY,CAACF,KAAK,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAE1D,oBACEH,IAAA,CAACJ,gBAAgB;IAACU,KAAK,EAAEF,MAAM,CAACG,OAAQ;IAACL,OAAO,EAAEA,OAAQ;IAAAM,QAAA,eACxDR,IAAA,CAACF,SAAS;MAACW,KAAK,EAAEN,KAAK,CAACO,IAAI,CAACC,OAAQ;MAACC,IAAI,EAAE;IAAG,CAAE;EAAC,CAClC,CAAC;AAEvB;AAEA,eAAeX,UAAU;AAEzB,MAAMI,YAAY,GAAIF,KAAY,IAChCR,UAAU,CAACkB,MAAM,CAAC;EAChBN,OAAO,EAAE;IACPO,eAAe,EAAEX,KAAK,CAACY,EAAE,CAACC,SAAS;IACnCC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVC,YAAY,EAAE,CAAC;IACfC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|