react-native-app-onboard 0.1.9 → 0.2.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.
Files changed (80) hide show
  1. package/README.md +89 -7
  2. package/lib/commonjs/components/CustomPages.js +31 -55
  3. package/lib/commonjs/components/CustomPages.js.map +1 -1
  4. package/lib/commonjs/components/OnboardingPages.js +63 -79
  5. package/lib/commonjs/components/OnboardingPages.js.map +1 -1
  6. package/lib/commonjs/components/Page.js +8 -3
  7. package/lib/commonjs/components/Page.js.map +1 -1
  8. package/lib/commonjs/components/Pagination.js +75 -13
  9. package/lib/commonjs/components/Pagination.js.map +1 -1
  10. package/lib/commonjs/components/Swiper.js +58 -85
  11. package/lib/commonjs/components/Swiper.js.map +1 -1
  12. package/lib/commonjs/components/button.js +3 -1
  13. package/lib/commonjs/components/button.js.map +1 -1
  14. package/lib/commonjs/context/OnboardingContext.js +101 -21
  15. package/lib/commonjs/context/OnboardingContext.js.map +1 -1
  16. package/lib/commonjs/hooks/useOnboarding.js +1 -1
  17. package/lib/commonjs/hooks/useOnboarding.js.map +1 -1
  18. package/lib/commonjs/index.js +33 -2
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/utils/color.js +308 -0
  21. package/lib/commonjs/utils/color.js.map +1 -0
  22. package/lib/commonjs/utils/persistence.js +51 -0
  23. package/lib/commonjs/utils/persistence.js.map +1 -0
  24. package/lib/module/components/CustomPages.js +31 -55
  25. package/lib/module/components/CustomPages.js.map +1 -1
  26. package/lib/module/components/OnboardingPages.js +64 -79
  27. package/lib/module/components/OnboardingPages.js.map +1 -1
  28. package/lib/module/components/Page.js +8 -3
  29. package/lib/module/components/Page.js.map +1 -1
  30. package/lib/module/components/Pagination.js +76 -14
  31. package/lib/module/components/Pagination.js.map +1 -1
  32. package/lib/module/components/Swiper.js +59 -86
  33. package/lib/module/components/Swiper.js.map +1 -1
  34. package/lib/module/components/button.js +3 -1
  35. package/lib/module/components/button.js.map +1 -1
  36. package/lib/module/context/OnboardingContext.js +102 -22
  37. package/lib/module/context/OnboardingContext.js.map +1 -1
  38. package/lib/module/hooks/useOnboarding.js +1 -1
  39. package/lib/module/hooks/useOnboarding.js.map +1 -1
  40. package/lib/module/index.js +8 -1
  41. package/lib/module/index.js.map +1 -1
  42. package/lib/module/utils/color.js +299 -0
  43. package/lib/module/utils/color.js.map +1 -0
  44. package/lib/module/utils/persistence.js +42 -0
  45. package/lib/module/utils/persistence.js.map +1 -0
  46. package/lib/typescript/src/components/CustomPages.d.ts +6 -2
  47. package/lib/typescript/src/components/CustomPages.d.ts.map +1 -1
  48. package/lib/typescript/src/components/OnboardingPages.d.ts +6 -2
  49. package/lib/typescript/src/components/OnboardingPages.d.ts.map +1 -1
  50. package/lib/typescript/src/components/Page.d.ts +2 -0
  51. package/lib/typescript/src/components/Page.d.ts.map +1 -1
  52. package/lib/typescript/src/components/Pagination.d.ts +9 -0
  53. package/lib/typescript/src/components/Pagination.d.ts.map +1 -1
  54. package/lib/typescript/src/components/Swiper.d.ts.map +1 -1
  55. package/lib/typescript/src/components/button.d.ts.map +1 -1
  56. package/lib/typescript/src/context/OnboardingContext.d.ts +9 -0
  57. package/lib/typescript/src/context/OnboardingContext.d.ts.map +1 -1
  58. package/lib/typescript/src/hooks/useOnboarding.d.ts +3 -0
  59. package/lib/typescript/src/hooks/useOnboarding.d.ts.map +1 -1
  60. package/lib/typescript/src/index.d.ts +4 -0
  61. package/lib/typescript/src/index.d.ts.map +1 -1
  62. package/lib/typescript/src/types/index.d.ts +13 -0
  63. package/lib/typescript/src/types/index.d.ts.map +1 -1
  64. package/lib/typescript/src/utils/color.d.ts +18 -0
  65. package/lib/typescript/src/utils/color.d.ts.map +1 -0
  66. package/lib/typescript/src/utils/persistence.d.ts +31 -0
  67. package/lib/typescript/src/utils/persistence.d.ts.map +1 -0
  68. package/package.json +12 -6
  69. package/src/components/CustomPages.tsx +62 -69
  70. package/src/components/OnboardingPages.tsx +86 -89
  71. package/src/components/Page.tsx +8 -2
  72. package/src/components/Pagination.tsx +117 -29
  73. package/src/components/Swiper.tsx +65 -87
  74. package/src/components/button.tsx +6 -1
  75. package/src/context/OnboardingContext.tsx +145 -26
  76. package/src/hooks/useOnboarding.tsx +1 -3
  77. package/src/index.tsx +16 -1
  78. package/src/types/index.ts +13 -0
  79. package/src/utils/color.ts +284 -0
  80. package/src/utils/persistence.ts +58 -0
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # react-native-app-onboard
2
- [![npm](https://img.shields.io/npm/v/react-native-app-onboard.svg)](https://www.npmjs.com/package/react-native-app-onboard) [![GitHub stars](https://img.shields.io/github/stars/julekgwa/react-native-app-onboard.svg?style=social&label=Stars)](https://github.com/julekgwa/react-native-app-onboard) [![gzip size](http://img.badgesize.io/https://unpkg.com/react-native-app-onboard/src/index.tsx?compression=gzip)](https://unpkg.com/react-native-app-onboard/dist/index.js) ![npm](https://img.shields.io/npm/dw/react-native-app-onboard)
2
+ [![npm](https://img.shields.io/npm/v/react-native-app-onboard.svg)](https://www.npmjs.com/package/react-native-app-onboard) [![GitHub stars](https://img.shields.io/github/stars/julekgwa/react-native-app-onboard.svg?style=social&label=Stars)](https://github.com/julekgwa/react-native-app-onboard) [![gzip size](http://img.badgesize.io/https://unpkg.com/react-native-app-onboard/src/index.tsx?compression=gzip)](https://unpkg.com/react-native-app-onboard/dist/index.js) ![npm](https://img.shields.io/npm/dm/react-native-app-onboard) [![install size](https://packagephobia.com/badge?p=react-native-app-onboard)](https://packagephobia.com/result?p=react-native-app-onboard) [![Socket Badge](https://badge.socket.dev/npm/package/react-native-app-onboard)](https://badge.socket.dev/npm/package/react-native-app-onboard)
3
3
 
4
4
  React Native App Onboard is a customizable, easy-to-use, and efficient library for creating compelling onboarding experiences for your React Native applications. It provides smooth, fluid transitions and animations, with a focus on simplicity and usability.
5
5
 
@@ -7,7 +7,24 @@ React Native App Onboard is a customizable, easy-to-use, and efficient library f
7
7
  | --------------------- | --------------------- | ------------------ |
8
8
 
9
9
 
10
- [Expo Snack example](https://snack.expo.dev/@lekgwaraj/react-native-app-onboard?platform=ios)
10
+ <a href="https://snack.expo.dev/@lekgwaraj/react-native-app-onboard?platform=ios">
11
+ <img src="https://img.shields.io/badge/Try%20it%20on-Expo%20Snack-4630EB.svg?style=for-the-badge&logo=expo&labelColor=FFF&logoColor=000" alt="Try it on Expo Snack"/>
12
+ </a>
13
+
14
+ ## Features
15
+
16
+ - Declarative `pages` array or custom child components.
17
+ - Animated background-color transitions between pages.
18
+ - Pagination as animated dots or a progress bar, with optional tap-to-navigate.
19
+ - Skip, Next, Previous, and Done controls with customizable labels and styles.
20
+ - Autoplay with optional looping.
21
+ - Right-to-left (RTL) support.
22
+ - Accessibility support, including screen-reader page announcements.
23
+ - `useOnboarding` hook for reading and controlling the flow.
24
+ - Custom footer via a render prop.
25
+ - Storage-agnostic persistence helpers.
26
+ - Optional native-driver animations.
27
+ - Written in TypeScript with zero runtime dependencies.
11
28
 
12
29
  ## Installation
13
30
 
@@ -64,12 +81,23 @@ export default App;
64
81
  | `showSkip` | `boolean` | `false` | Optional. Determines whether the "Skip" button is shown. |
65
82
  | `showNext` | `boolean` | `true` | Optional. Determines whether the "Next" button is shown. |
66
83
  | `showDone` | `boolean` | `true` | Optional. Determines whether the "Done" button is shown. |
67
- | `scrollAnimationDuration` | `number` | `500` | Optional. Duration of the scroll animation in milliseconds. Default is 500. |
68
- | `useNativeDriver` | `boolean` | | Optional. Determines whether animations should use the native driver. |
84
+ | `showPrevious` | `boolean` | `false` | Optional. Shows a "Back" button (on the left of the footer) once past the first page. |
85
+ | `previousLabel` | `string` \| `React.ReactNode` | `Back` | Optional. Custom label for the "Back" button. |
86
+ | `scrollAnimationDuration` | `number` | | Optional. Custom duration (ms) for programmatic page transitions (`nextPage`/`previousPage`/`scrollTo`/autoplay). When unset, the platform's default scroll animation is used. |
87
+ | `useNativeDriver` | `boolean` | `false` | Optional. Drives the pagination dot animation on the native thread for smoother performance. The background-color transition always stays JS-driven. |
88
+ | `rtl` | `boolean` | `I18nManager.isRTL` | Optional. Renders the slider right-to-left. Defaults to the device direction; set explicitly to force a direction (applies to the declarative `pages` API). |
69
89
  | `onDone` | `() => void` | | Optional. Callback function that is called when the "Done" button is pressed. |
70
90
  | `onSkip` | `() => void` | | Optional. Callback function that is called when the "Skip" button is pressed. |
91
+ | `onPageChange` | `(index: number) => void` | | Optional. Called with the new page index on every page change (swipe, button, or autoplay). Useful for analytics. |
71
92
  | `showPagination` | `boolean` | `true` | Optional. Determines whether pagination indicators are shown. |
93
+ | `paginationStyle` | `'dots'` \| `'progress'` | `'dots'`| Optional. Renders the pagination as animated dots or as a progress bar. |
94
+ | `progressBarStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the progress bar track (when `paginationStyle="progress"`). |
95
+ | `progressBarFillStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the progress bar fill (when `paginationStyle="progress"`). |
96
+ | `dotsAreTappable` | `boolean` | `false` | Optional. When `true`, tapping a pagination dot scrolls to that page. |
72
97
  | `scrollEnabled` | `boolean` | `true` | Optional. Determines whether the onboarding screens are scrollable. |
98
+ | `autoPlay` | `boolean` | `false` | Optional. Automatically advances through the pages. Pauses as soon as the user scrolls manually. |
99
+ | `autoPlayInterval` | `number` | `3000` | Optional. Delay (ms) between automatic page advances when `autoPlay` is enabled. |
100
+ | `loop` | `boolean` | `false` | Optional. Wraps navigation around at either end (used by autoplay and the Next/Back buttons). |
73
101
  | `customFooter` | `(props: { nextPage: () => void }) => React.ReactNode` | | Optional. Function that returns a custom footer component. Receives a `nextPage` function as a prop. |
74
102
  | `paginationContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the pagination container. |
75
103
  | `buttonRightContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the container of the button positioned on the right. |
@@ -78,6 +106,7 @@ export default App;
78
106
  | `doneLabelStyle` | `StyleProp<TextStyle>` | | Optional. Custom style for the "Done" label. |
79
107
  | `skipLabelStyle` | `StyleProp<TextStyle>` | | Optional. Custom style for the "Skip" label. |
80
108
  | `nextLabelStyle` | `StyleProp<TextStyle>` | | Optional. Custom style for the "Next" label. |
109
+ | `previousLabelStyle` | `StyleProp<TextStyle>` | | Optional. Custom style for the "Back" label. |
81
110
  | `containerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the main container of the onboarding component. |
82
111
  | `imageContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the image container. |
83
112
  | `titleContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the title container. |
@@ -90,6 +119,7 @@ export default App;
90
119
  | `skipButtonContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the container of the "Skip" button. |
91
120
  | `nextButtonContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the container of the "Next" button. |
92
121
  | `doneButtonContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the container of the "Done" button. |
122
+ | `previousButtonContainerStyle` | `StyleProp<ViewStyle>` | | Optional. Custom style for the container of the "Back" button. |
93
123
  | `skipButtonPosition` | `'top-left'` \| `'top-right'` | | Optional. Specifies the position of the "Skip" button. Can be either 'top-left' or 'top-right'. |
94
124
  | `swap` | `boolean` | false | Optional. If true, swaps the positions of the title/subtitle and image. |
95
125
 
@@ -142,9 +172,11 @@ To manage the state and navigation of the onboarding flow more effectively, you
142
172
  - **`flatListRef`**: A ref object for the underlying FlatList component, allowing for programmatic control of the scroll position.
143
173
  - **`numberOfScreens`**: The total number of screens in the onboarding sequence.
144
174
  - **`nextPage`**: A function to navigate to the next page in the onboarding sequence.
175
+ - **`previousPage`**: A function to navigate to the previous page in the onboarding sequence.
145
176
  - **`scrollTo`**: A function that scrolls to a specific page in the onboarding flow.
146
- - **`progress`**: A value representing the user's progress through the onboarding screens.
177
+ - **`progress`**: A value (0–100) representing the user's progress through the onboarding screens.
147
178
  - **`isDone`**: A boolean state that indicates whether the user has completed the onboarding process.
179
+ - **`pauseAutoPlay` / `resumeAutoPlay`**: Functions to pause and resume autoplay programmatically.
148
180
 
149
181
  ### Example Usage
150
182
 
@@ -172,6 +204,52 @@ const OnboardingScreen = () => {
172
204
  export default OnboardingScreen;
173
205
  ```
174
206
 
207
+ ## Persisting onboarding completion
208
+
209
+ The library ships small, storage-agnostic helpers so you can show onboarding only once. They accept any object that implements the `getItem`/`setItem`/`removeItem` interface (e.g. [`@react-native-async-storage/async-storage`](https://github.com/react-native-async-storage/async-storage)), so no extra peer dependency is forced on you.
210
+
211
+ ```jsx
212
+ import AsyncStorage from '@react-native-async-storage/async-storage';
213
+ import { createOnboardingStorage } from 'react-native-app-onboard';
214
+
215
+ const onboardingStorage = createOnboardingStorage(AsyncStorage);
216
+
217
+ // On app launch:
218
+ const seen = await onboardingStorage.hasCompleted();
219
+
220
+ // When the user finishes onboarding:
221
+ <Onboarding
222
+ pages={pages}
223
+ onDone={() => onboardingStorage.markComplete()}
224
+ />;
225
+
226
+ // To replay onboarding later:
227
+ await onboardingStorage.reset();
228
+ ```
229
+
230
+ The standalone functions are also exported if you prefer to pass the storage explicitly: `hasCompletedOnboarding(storage, key?)`, `markOnboardingComplete(storage, key?)`, and `resetOnboarding(storage, key?)`. All default to a namespaced key, which you can override with the optional second argument.
231
+
232
+ ## Accessibility
233
+
234
+ Buttons and pagination indicators ship with sensible `accessibilityRole` / `accessibilityLabel` values, the progress bar exposes `accessibilityValue`, and page changes are announced to screen readers automatically.
235
+
236
+ ## RTL support
237
+
238
+ | ![](example/assets/RTL1.png) | ![](example/assets/RTL2.png) | ![](example/assets/RTL3.png) |
239
+ | --------------------- | --------------------- | ------------------ |
240
+
241
+ By default the slider follows the device writing direction (`I18nManager.isRTL`), so apps localized for Arabic, Hebrew, etc. get a right-to-left onboarding flow automatically — the footer buttons and pagination use direction-aware layout.
242
+
243
+ You can also force a direction with the `rtl` prop, independent of the device:
244
+
245
+ ```jsx
246
+ <Onboarding pages={pages} rtl />
247
+ ```
248
+
249
+ When the requested direction differs from the device direction, the slider (pages, dots, and progress bar) is mirrored so swiping and the indicators stay consistent. Forced mirroring applies to the declarative `pages` API; when you provide custom children, RTL follows the device direction (lay out your own screens with logical `start`/`end` styles).
250
+
251
+ A complete Arabic example is available in the example app (`example/src/rtl/Rtl.tsx`, the "Show RTL (Arabic)" entry).
252
+
175
253
  ## Expo Snack Examples
176
254
 
177
255
  #### Using the custom footer component:
@@ -179,7 +257,9 @@ export default OnboardingScreen;
179
257
  | ![](example/assets/IMG_2187.PNG) | ![](example/assets/IMG_2188.PNG) | ![](example/assets/IMG_2189.PNG) |
180
258
  | --------------------- | --------------------- | ------------------ |
181
259
 
182
- [Expo Snack](https://snack.expo.dev/@lekgwaraj/react-native-app-onboard-custom-pagination?platform=ios)
260
+ <a href="https://snack.expo.dev/@lekgwaraj/react-native-app-onboard-custom-pagination?platform=ios">
261
+ <img src="https://img.shields.io/badge/Try%20it%20on-Expo%20Snack-4630EB.svg?style=for-the-badge&logo=expo&labelColor=FFF&logoColor=000" alt="Try it on Expo Snack"/>
262
+ </a>
183
263
 
184
264
  #### Using the custom page,
185
265
 
@@ -188,7 +268,9 @@ you can provide a custom component for each page by passing the components as ch
188
268
  | ![](example/assets/IMG_2192.PNG) | ![](example/assets/IMG_2193.PNG) | ![](example/assets/IMG_2194.PNG) |
189
269
  | --------------------- | --------------------- | ------------------ |
190
270
 
191
- [Expo Snack](https://snack.expo.dev/@lekgwaraj/react-native-app-onboard-custom?platform=ios)
271
+ <a href="https://snack.expo.dev/@lekgwaraj/react-native-app-onboard-custom?platform=ios">
272
+ <img src="https://img.shields.io/badge/Try%20it%20on-Expo%20Snack-4630EB.svg?style=for-the-badge&logo=expo&labelColor=FFF&logoColor=000" alt="Try it on Expo Snack"/>
273
+ </a>
192
274
 
193
275
  ## Acknowledgements
194
276
 
@@ -17,32 +17,29 @@ const CustomPages = ({
17
17
  showNext = true,
18
18
  ...props
19
19
  }) => {
20
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
21
- style: [styles.container]
22
- }, props.skipButtonPosition && props.showSkip && /*#__PURE__*/_react.default.createElement(_button.SkipButton, {
23
- buttonTextStyle: props.skipLabelStyle,
24
- buttonStyle: props.skipButtonContainerStyle,
25
- position: props.skipButtonPosition,
26
- onPress: props.onSkip,
27
- label: props.skipLabel
28
- }), showPagination && props.paginationPosition === 'top' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.customFooter && props.customFooter({
29
- nextPage: props.nextPage
30
- }), !props.customFooter && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, {
20
+ const pageWidth = props.width || width;
21
+ const paginationProps = {
31
22
  color: '#fff',
32
23
  backgroundColor: '#333',
33
- width: width,
24
+ width: pageWidth,
34
25
  onNext: props.nextPage,
35
26
  onSkip: props.onSkip,
36
27
  onDone: props.onDone,
37
28
  showDone: props.showDone,
38
- animatedValue: props.scrollX,
29
+ showPrevious: props.showPrevious,
30
+ animatedValue: props.dotsAnimatedValue,
39
31
  showSkip: props.showSkip,
40
32
  numberOfScreens: props.numberOfScreens,
41
33
  skipLabel: props.skipLabel,
42
- showNext: showNext,
34
+ showNext,
43
35
  nextLabel: props.nextLabel,
36
+ previousLabel: props.previousLabel,
44
37
  doneLabel: props.doneLabel,
45
38
  hasSkipPosition: !!props.skipButtonPosition,
39
+ paginationStyle: props.paginationStyle,
40
+ progressBarStyle: props.progressBarStyle,
41
+ progressBarFillStyle: props.progressBarFillStyle,
42
+ dotsAreTappable: props.dotsAreTappable,
46
43
  paginationContainerStyle: props.paginationContainerStyle,
47
44
  buttonRightContainerStyle: props.buttonRightContainerStyle,
48
45
  buttonLeftContainerStyle: props.buttonLeftContainerStyle,
@@ -51,28 +48,34 @@ const CustomPages = ({
51
48
  skipButtonContainerStyle: props.skipButtonContainerStyle,
52
49
  nextButtonContainerStyle: props.nextButtonContainerStyle,
53
50
  doneButtonContainerStyle: props.doneButtonContainerStyle,
51
+ previousButtonContainerStyle: props.previousButtonContainerStyle,
54
52
  skipLabelStyle: props.skipLabelStyle,
53
+ previousLabelStyle: props.previousLabelStyle,
55
54
  nextLabelStyle: props.nextLabelStyle,
56
55
  paginationPosition: props.paginationPosition
57
- })), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.FlatList, {
58
- ref: props.flatListRef,
56
+ };
57
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
58
+ style: [styles.container]
59
+ }, props.skipButtonPosition && props.showSkip && /*#__PURE__*/_react.default.createElement(_button.SkipButton, {
60
+ buttonTextStyle: props.skipLabelStyle,
61
+ buttonStyle: props.skipButtonContainerStyle,
62
+ position: props.skipButtonPosition,
63
+ onPress: props.onSkip,
64
+ label: props.skipLabel
65
+ }), showPagination && props.paginationPosition === 'top' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.customFooter && props.customFooter({
66
+ nextPage: props.nextPage
67
+ }), !props.customFooter && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, paginationProps)), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.FlatList, {
68
+ ref: node => props.setFlatListRef(node),
59
69
  data: _react.default.Children.toArray(props.children),
60
70
  horizontal: true,
61
71
  pagingEnabled: true,
62
72
  showsHorizontalScrollIndicator: false,
63
73
  scrollEnabled: props.scrollEnabled,
64
- onScroll: _reactNative.Animated.event([{
65
- nativeEvent: {
66
- contentOffset: {
67
- x: props.scrollX
68
- }
69
- }
70
- }], {
71
- useNativeDriver: false
72
- }),
73
- scrollEventThrottle: 1,
74
+ onScroll: props.onScroll,
75
+ onScrollBeginDrag: props.onScrollBeginDrag,
76
+ scrollEventThrottle: 16,
74
77
  onMomentumScrollEnd: event => {
75
- const pageIndex = Math.round(event.nativeEvent.contentOffset.x / width);
78
+ const pageIndex = Math.round(event.nativeEvent.contentOffset.x / pageWidth);
76
79
  props.setPage(pageIndex || 0);
77
80
  },
78
81
  keyExtractor: (_, index) => index.toString(),
@@ -89,34 +92,7 @@ const CustomPages = ({
89
92
  }
90
93
  }), showPagination && props.paginationPosition !== 'top' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.customFooter && props.customFooter({
91
94
  nextPage: props.nextPage
92
- }), !props.customFooter && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, {
93
- color: '#fff',
94
- backgroundColor: '#333',
95
- width: width,
96
- onNext: props.nextPage,
97
- onSkip: props.onSkip,
98
- onDone: props.onDone,
99
- showDone: props.showDone,
100
- animatedValue: props.scrollX,
101
- showSkip: props.showSkip,
102
- numberOfScreens: props.numberOfScreens,
103
- skipLabel: props.skipLabel,
104
- nextLabel: props.nextLabel,
105
- showNext: showNext,
106
- doneLabel: props.doneLabel,
107
- paginationContainerStyle: props.paginationContainerStyle,
108
- buttonRightContainerStyle: props.buttonRightContainerStyle,
109
- buttonLeftContainerStyle: props.buttonLeftContainerStyle,
110
- dotsContainerStyle: props.dotsContainerStyle,
111
- doneLabelStyle: props.doneLabelStyle,
112
- skipButtonContainerStyle: props.skipButtonContainerStyle,
113
- nextButtonContainerStyle: props.nextButtonContainerStyle,
114
- doneButtonContainerStyle: props.doneButtonContainerStyle,
115
- skipLabelStyle: props.skipLabelStyle,
116
- hasSkipPosition: !!props.skipButtonPosition,
117
- paginationPosition: props.paginationPosition,
118
- nextLabelStyle: props.nextLabelStyle
119
- })));
95
+ }), !props.customFooter && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, paginationProps)));
120
96
  };
121
97
  exports.CustomPages = CustomPages;
122
98
  const styles = _reactNative.StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_Pagination","_button","e","__esModule","default","width","Dimensions","get","CustomPages","showPagination","showNext","props","createElement","View","style","styles","container","skipButtonPosition","showSkip","SkipButton","buttonTextStyle","skipLabelStyle","buttonStyle","skipButtonContainerStyle","position","onPress","onSkip","label","skipLabel","paginationPosition","Fragment","customFooter","nextPage","Pagination","color","backgroundColor","onNext","onDone","showDone","animatedValue","scrollX","numberOfScreens","nextLabel","doneLabel","hasSkipPosition","paginationContainerStyle","buttonRightContainerStyle","buttonLeftContainerStyle","dotsContainerStyle","doneLabelStyle","nextButtonContainerStyle","doneButtonContainerStyle","nextLabelStyle","Animated","FlatList","ref","flatListRef","data","React","Children","toArray","children","horizontal","pagingEnabled","showsHorizontalScrollIndicator","scrollEnabled","onScroll","event","nativeEvent","contentOffset","x","useNativeDriver","scrollEventThrottle","onMomentumScrollEnd","pageIndex","Math","round","setPage","keyExtractor","_","index","toString","renderItem","item","cloneElement","currentPage","exports","StyleSheet","create","flex","justifyContent","alignItems","screen","pagination","flexDirection","paddingVertical","paddingHorizontal","dot","height","borderRadius","margin","dotsContainer"],"sourceRoot":"../../../src","sources":["components/CustomPages.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAAsC,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtC,MAAM;EAAEG;AAAM,CAAC,GAAGC,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC;AAmBnC,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,cAAc,GAAG,IAAI;EACrBC,QAAQ,GAAG,IAAI;EACf,GAAGC;AACa,CAAC,KAAK;EACtB,oBACEb,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAAChB,YAAA,CAAAiB,IAAI;IAACC,KAAK,EAAE,CAACC,MAAM,CAACC,SAAS;EAAE,GAC7BL,KAAK,CAACM,kBAAkB,IAAIN,KAAK,CAACO,QAAQ,iBACzCpB,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,OAAA,CAAAkB,UAAU;IACTC,eAAe,EAAET,KAAK,CAACU,cAAe;IACtCC,WAAW,EAAEX,KAAK,CAACY,wBAAyB;IAC5CC,QAAQ,EAAE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KAAK,CAACoC,wBAAyB;IACzDC,kBAAkB,EAAErC,KAAK,CAACqC,kBAAmB;IAC7CC,cAAc,EAAEtC,KAAK,CAACsC,cAAe;IACrC1B,wBAAwB,EAAEZ,KAAK,CAACY,wBAAyB;IACzD2B,wBAAwB,EAAEvC,KAAK,CAACuC,wBAAyB;IACzDC,wBAAwB,EAAExC,KAAK,CAACwC,wBAAyB;IACzD9B,cAAc,EAAEV,KAAK,CAACU,cAAe;IACrCuB,eAAe,EAAE,CAAC,CAACjC,KAAK,CAACM,kBAAmB;IAC5CY,kBAAkB,EAAElB,KAAK,CAACkB,kBAAmB;IAC7CuB,cAAc,EAAEzC,KAAK,CAACyC;EAAe,CACtC,CAEH,CAEA,CAAC;AAEX,CAAC;AAACkC,OAAA,CAAA9E,WAAA,GAAAA,WAAA;AAEF,MAAMO,MAAM,GAAGwE,uBAAU,CAACC,MAAM,CAAC;EAC/BxE,SAAS,EAAE;IACTyE,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDC,MAAM,EAAE;IACNvF,KAAK;IACLqF,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBxD,eAAe,EAAE;EACnB,CAAC;EACD0D,UAAU,EAAE;IACVC,aAAa,EAAE,KAAK;IACpBH,UAAU,EAAE,QAAQ;IACpBI,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrB3F;EACF,CAAC;EACD4F,GAAG,EAAE;IACHC,MAAM,EAAE,EAAE;IACV7F,KAAK,EAAE,EAAE;IACT8F,YAAY,EAAE,CAAC;IACfhE,eAAe,EAAE,MAAM;IACvBiE,MAAM,EAAE;EACV,CAAC;EACDC,aAAa,EAAE;IACbP,aAAa,EAAE,KAAK;IACpBL,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_Pagination","_button","e","__esModule","default","width","Dimensions","get","CustomPages","showPagination","showNext","props","pageWidth","paginationProps","color","backgroundColor","onNext","nextPage","onSkip","onDone","showDone","showPrevious","animatedValue","dotsAnimatedValue","showSkip","numberOfScreens","skipLabel","nextLabel","previousLabel","doneLabel","hasSkipPosition","skipButtonPosition","paginationStyle","progressBarStyle","progressBarFillStyle","dotsAreTappable","paginationContainerStyle","buttonRightContainerStyle","buttonLeftContainerStyle","dotsContainerStyle","doneLabelStyle","skipButtonContainerStyle","nextButtonContainerStyle","doneButtonContainerStyle","previousButtonContainerStyle","skipLabelStyle","previousLabelStyle","nextLabelStyle","paginationPosition","createElement","View","style","styles","container","SkipButton","buttonTextStyle","buttonStyle","position","onPress","label","Fragment","customFooter","Pagination","Animated","FlatList","ref","node","setFlatListRef","data","React","Children","toArray","children","horizontal","pagingEnabled","showsHorizontalScrollIndicator","scrollEnabled","onScroll","onScrollBeginDrag","scrollEventThrottle","onMomentumScrollEnd","event","pageIndex","Math","round","nativeEvent","contentOffset","x","setPage","keyExtractor","_","index","toString","renderItem","item","cloneElement","currentPage","exports","StyleSheet","create","flex","justifyContent","alignItems","screen","pagination","flexDirection","paddingVertical","paddingHorizontal","dot","height","borderRadius","margin","dotsContainer"],"sourceRoot":"../../../src","sources":["components/CustomPages.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAAsC,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtC,MAAM;EAAEG;AAAM,CAAC,GAAGC,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC;AAyBnC,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,cAAc,GAAG,IAAI;EACrBC,QAAQ,G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,YAAY,iBAAI/D,MAAA,CAAAM,OAAA,CAAA6C,aAAA,CAACjD,WAAA,CAAA8D,UAAU,EAAKjD,eAAkB,CAC1D,CAEA,CAAC;AAEX,CAAC;AAACoF,OAAA,CAAAzF,WAAA,GAAAA,WAAA;AAEF,MAAM4C,MAAM,GAAG8C,uBAAU,CAACC,MAAM,CAAC;EAC/B9C,SAAS,EAAE;IACT+C,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDC,MAAM,EAAE;IACNlG,KAAK;IACLgG,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBvF,eAAe,EAAE;EACnB,CAAC;EACDyF,UAAU,EAAE;IACVC,aAAa,EAAE,KAAK;IACpBH,UAAU,EAAE,QAAQ;IACpBI,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBtG;EACF,CAAC;EACDuG,GAAG,EAAE;IACHC,MAAM,EAAE,EAAE;IACVxG,KAAK,EAAE,EAAE;IACTyG,YAAY,EAAE,CAAC;IACf/F,eAAe,EAAE,MAAM;IACvBgG,MAAM,EAAE;EACV,CAAC;EACDC,aAAa,EAAE;IACbP,aAAa,EAAE,KAAK;IACpBL,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -5,12 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.OnboardingPages = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _tinycolor = _interopRequireDefault(require("tinycolor2"));
8
+ var _color = require("../utils/color");
9
9
  var _reactNative = require("react-native");
10
10
  var _Pagination = require("./Pagination");
11
11
  var _Page = require("./Page");
12
12
  var _button = require("./button");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
15
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
@@ -22,122 +21,102 @@ const OnboardingPages = ({
22
21
  showNext = true,
23
22
  ...props
24
23
  }) => {
25
- var _props$pages$previous;
26
- const backgroundColorAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
27
- const [previousPage, setPreviousPage] = _react.default.useState(0);
24
+ const pageWidth = props.width || width;
28
25
  const currentPage_ = props.pages[props.currentPage];
29
- const currentBackgroundColor = (currentPage_ === null || currentPage_ === void 0 ? void 0 : currentPage_.backgroundColor) || '';
30
- const isLight = (0, _tinycolor.default)(currentBackgroundColor).getBrightness() > 180;
31
- const footerBackgroundColor = isLight ? (0, _tinycolor.default)(currentBackgroundColor).darken(30).toString() : (0, _tinycolor.default)(currentBackgroundColor).lighten(30).toString();
32
- const color = (0, _tinycolor.default)(footerBackgroundColor).getBrightness() > 180 ? (0, _tinycolor.default)(footerBackgroundColor).darken(60).toString() : (0, _tinycolor.default)(footerBackgroundColor).lighten(60).toString();
33
- const previousBackgroundColor = ((_props$pages$previous = props.pages[previousPage]) === null || _props$pages$previous === void 0 ? void 0 : _props$pages$previous.backgroundColor) || 'white';
34
- // Interpolating background color based on backgroundColorAnim value
35
- const interpolatedBackgroundColor = backgroundColorAnim.interpolate({
36
- inputRange: [0, 1],
37
- outputRange: [currentBackgroundColor, previousBackgroundColor],
38
- extrapolate: 'clamp'
39
- });
40
- const setPage_ = newPageIndex => {
41
- setPreviousPage(props.currentPage);
42
- props.setPage(newPageIndex);
43
- };
44
- return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
45
- style: [styles.container, {
46
- backgroundColor: interpolatedBackgroundColor
47
- }]
48
- }, props.skipButtonPosition && props.showSkip && /*#__PURE__*/_react.default.createElement(_button.SkipButton, {
49
- buttonTextStyle: props.skipLabelStyle,
50
- buttonStyle: props.skipButtonContainerStyle,
51
- position: props.skipButtonPosition,
52
- label: props.skipLabel,
53
- onPress: props.onSkip
54
- }), props.paginationPosition === 'top' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showPagination && props.customFooter && props.customFooter({
55
- nextPage: props.nextPage
56
- }), !props.customFooter && showPagination && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, {
57
- width: props.width || width,
26
+ const currentBackgroundColor = (currentPage_ === null || currentPage_ === void 0 ? void 0 : currentPage_.backgroundColor) ?? 'white';
27
+ const isLight = (0, _color.getBrightness)(currentBackgroundColor) > 180;
28
+ const footerBackgroundColor = isLight ? (0, _color.darken)(currentBackgroundColor, 30) : (0, _color.lighten)(currentBackgroundColor, 30);
29
+ const color = (0, _color.getBrightness)(footerBackgroundColor) > 180 ? (0, _color.darken)(footerBackgroundColor, 60) : (0, _color.lighten)(footerBackgroundColor, 60);
30
+ const interpolatedBackgroundColor = (0, _react.useMemo)(() => {
31
+ const pages = props.pages;
32
+ // interpolate() requires at least 2 stops; for 0 or 1 pages there is
33
+ // nothing to animate between, so use the solid current color.
34
+ if (pages.length < 2) return currentBackgroundColor;
35
+ const inputRange = pages.map((_, i) => i * pageWidth);
36
+ const outputRange = pages.map(p => p.backgroundColor ?? 'white');
37
+ return props.scrollX.interpolate({
38
+ inputRange,
39
+ outputRange,
40
+ extrapolate: 'clamp'
41
+ });
42
+ }, [props.pages, props.scrollX, pageWidth, currentBackgroundColor]);
43
+ const paginationProps = {
44
+ width: pageWidth,
58
45
  onNext: props.nextPage,
59
46
  onSkip: props.onSkip,
60
- color: color,
61
- showNext: showNext,
47
+ color,
48
+ showNext,
62
49
  onDone: props.onDone,
63
50
  showDone: props.showDone,
51
+ showPrevious: props.showPrevious,
64
52
  backgroundColor: footerBackgroundColor,
65
- animatedValue: props.scrollX,
53
+ animatedValue: props.dotsAnimatedValue,
66
54
  showSkip: props.showSkip,
67
55
  numberOfScreens: props.pages.length,
68
56
  skipLabel: props.skipLabel,
69
57
  nextLabel: props.nextLabel,
58
+ previousLabel: props.previousLabel,
70
59
  hasSkipPosition: !!props.skipButtonPosition,
71
60
  doneLabel: props.doneLabel,
61
+ paginationStyle: props.paginationStyle,
62
+ progressBarStyle: props.progressBarStyle,
63
+ progressBarFillStyle: props.progressBarFillStyle,
64
+ dotsAreTappable: props.dotsAreTappable,
65
+ mirror: props.mirror,
72
66
  paginationContainerStyle: props.paginationContainerStyle,
73
67
  buttonRightContainerStyle: props.buttonRightContainerStyle,
74
68
  buttonLeftContainerStyle: props.buttonLeftContainerStyle,
75
69
  dotsContainerStyle: props.dotsContainerStyle,
76
70
  doneLabelStyle: props.doneLabelStyle,
77
71
  skipLabelStyle: props.skipLabelStyle,
72
+ previousLabelStyle: props.previousLabelStyle,
78
73
  nextLabelStyle: props.nextLabelStyle,
79
74
  skipButtonContainerStyle: props.skipButtonContainerStyle,
80
75
  nextButtonContainerStyle: props.nextButtonContainerStyle,
81
- doneButtonContainerStyle: props.doneButtonContainerStyle
82
- })), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.FlatList, {
83
- ref: props.flatListRef,
76
+ doneButtonContainerStyle: props.doneButtonContainerStyle,
77
+ previousButtonContainerStyle: props.previousButtonContainerStyle
78
+ };
79
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
80
+ style: [styles.container, {
81
+ backgroundColor: interpolatedBackgroundColor
82
+ }]
83
+ }, props.skipButtonPosition && props.showSkip && /*#__PURE__*/_react.default.createElement(_button.SkipButton, {
84
+ buttonTextStyle: props.skipLabelStyle,
85
+ buttonStyle: props.skipButtonContainerStyle,
86
+ position: props.skipButtonPosition,
87
+ label: props.skipLabel,
88
+ onPress: props.onSkip
89
+ }), props.paginationPosition === 'top' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showPagination && props.customFooter && props.customFooter({
90
+ nextPage: props.nextPage
91
+ }), !props.customFooter && showPagination && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, paginationProps)), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.FlatList, {
92
+ ref: node => props.setFlatListRef(node),
84
93
  data: props.pages,
85
94
  horizontal: true,
86
95
  pagingEnabled: true,
87
96
  showsHorizontalScrollIndicator: false,
97
+ scrollEnabled: props.scrollEnabled,
98
+ style: props.mirror ? styles.mirror : undefined,
88
99
  keyExtractor: (_, index) => index.toString(),
89
100
  renderItem: ({
90
101
  item,
91
102
  index
92
103
  }) => /*#__PURE__*/_react.default.createElement(_Page.OnboardingPage, _extends({
93
104
  color: color,
94
- width: props.width || width,
105
+ width: pageWidth,
95
106
  swap: props.swap,
107
+ mirror: props.mirror,
96
108
  key: index
97
109
  }, item)),
98
- onScroll: _reactNative.Animated.event([{
99
- nativeEvent: {
100
- contentOffset: {
101
- x: props.scrollX
102
- }
103
- }
104
- }], {
105
- useNativeDriver: false
106
- }),
110
+ onScroll: props.onScroll,
111
+ onScrollBeginDrag: props.onScrollBeginDrag,
107
112
  scrollEventThrottle: 16,
108
113
  onMomentumScrollEnd: event => {
109
- const pageIndex = Math.round(event.nativeEvent.contentOffset.x / (props.width || width));
110
- setPage_(pageIndex || 0);
114
+ const pageIndex = Math.round(event.nativeEvent.contentOffset.x / pageWidth);
115
+ props.setPage(pageIndex || 0);
111
116
  }
112
117
  }), props.paginationPosition !== 'top' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showPagination && props.customFooter && props.customFooter({
113
118
  nextPage: props.nextPage
114
- }), !props.customFooter && showPagination && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, {
115
- width: props.width || width,
116
- onNext: props.nextPage,
117
- onSkip: props.onSkip,
118
- color: color,
119
- hasSkipPosition: !!props.skipButtonPosition,
120
- onDone: props.onDone,
121
- showDone: props.showDone,
122
- backgroundColor: footerBackgroundColor,
123
- animatedValue: props.scrollX,
124
- showSkip: props.showSkip,
125
- numberOfScreens: props.pages.length,
126
- skipLabel: props.skipLabel,
127
- nextLabel: props.nextLabel,
128
- doneLabel: props.doneLabel,
129
- paginationContainerStyle: props.paginationContainerStyle,
130
- buttonRightContainerStyle: props.buttonRightContainerStyle,
131
- buttonLeftContainerStyle: props.buttonLeftContainerStyle,
132
- dotsContainerStyle: props.dotsContainerStyle,
133
- doneLabelStyle: props.doneLabelStyle,
134
- skipLabelStyle: props.skipLabelStyle,
135
- skipButtonContainerStyle: props.skipButtonContainerStyle,
136
- nextButtonContainerStyle: props.nextButtonContainerStyle,
137
- doneButtonContainerStyle: props.doneButtonContainerStyle,
138
- showNext: showNext,
139
- nextLabelStyle: props.nextLabelStyle
140
- })));
119
+ }), !props.customFooter && showPagination && /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, paginationProps)));
141
120
  };
142
121
  exports.OnboardingPages = OnboardingPages;
143
122
  const styles = _reactNative.StyleSheet.create({
@@ -170,6 +149,11 @@ const styles = _reactNative.StyleSheet.create({
170
149
  flexDirection: 'row',
171
150
  flex: 1,
172
151
  justifyContent: 'center'
152
+ },
153
+ mirror: {
154
+ transform: [{
155
+ scaleX: -1
156
+ }]
173
157
  }
174
158
  });
175
159
  //# sourceMappingURL=OnboardingPages.js.map