react-native-app-onboard 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.
Files changed (80) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +187 -0
  3. package/lib/commonjs/components/CustomPages.js +134 -0
  4. package/lib/commonjs/components/CustomPages.js.map +1 -0
  5. package/lib/commonjs/components/OnboardingPages.js +157 -0
  6. package/lib/commonjs/components/OnboardingPages.js.map +1 -0
  7. package/lib/commonjs/components/Page.js +60 -0
  8. package/lib/commonjs/components/Page.js.map +1 -0
  9. package/lib/commonjs/components/Pagination.js +94 -0
  10. package/lib/commonjs/components/Pagination.js.map +1 -0
  11. package/lib/commonjs/components/Swiper.js +56 -0
  12. package/lib/commonjs/components/Swiper.js.map +1 -0
  13. package/lib/commonjs/components/button.js +57 -0
  14. package/lib/commonjs/components/button.js.map +1 -0
  15. package/lib/commonjs/components/index.js +17 -0
  16. package/lib/commonjs/components/index.js.map +1 -0
  17. package/lib/commonjs/context/OnboardingContext.js +65 -0
  18. package/lib/commonjs/context/OnboardingContext.js.map +1 -0
  19. package/lib/commonjs/hooks/useOnboarding.js +18 -0
  20. package/lib/commonjs/hooks/useOnboarding.js.map +1 -0
  21. package/lib/commonjs/index.js +26 -0
  22. package/lib/commonjs/index.js.map +1 -0
  23. package/lib/commonjs/types/index.js +6 -0
  24. package/lib/commonjs/types/index.js.map +1 -0
  25. package/lib/module/components/CustomPages.js +126 -0
  26. package/lib/module/components/CustomPages.js.map +1 -0
  27. package/lib/module/components/OnboardingPages.js +147 -0
  28. package/lib/module/components/OnboardingPages.js.map +1 -0
  29. package/lib/module/components/Page.js +53 -0
  30. package/lib/module/components/Page.js.map +1 -0
  31. package/lib/module/components/Pagination.js +87 -0
  32. package/lib/module/components/Pagination.js.map +1 -0
  33. package/lib/module/components/Swiper.js +48 -0
  34. package/lib/module/components/Swiper.js.map +1 -0
  35. package/lib/module/components/button.js +49 -0
  36. package/lib/module/components/button.js.map +1 -0
  37. package/lib/module/components/index.js +2 -0
  38. package/lib/module/components/index.js.map +1 -0
  39. package/lib/module/context/OnboardingContext.js +57 -0
  40. package/lib/module/context/OnboardingContext.js.map +1 -0
  41. package/lib/module/hooks/useOnboarding.js +10 -0
  42. package/lib/module/hooks/useOnboarding.js.map +1 -0
  43. package/lib/module/index.js +13 -0
  44. package/lib/module/index.js.map +1 -0
  45. package/lib/module/types/index.js +2 -0
  46. package/lib/module/types/index.js.map +1 -0
  47. package/lib/typescript/src/components/CustomPages.d.ts +21 -0
  48. package/lib/typescript/src/components/CustomPages.d.ts.map +1 -0
  49. package/lib/typescript/src/components/OnboardingPages.d.ts +15 -0
  50. package/lib/typescript/src/components/OnboardingPages.d.ts.map +1 -0
  51. package/lib/typescript/src/components/Page.d.ts +17 -0
  52. package/lib/typescript/src/components/Page.d.ts.map +1 -0
  53. package/lib/typescript/src/components/Pagination.d.ts +29 -0
  54. package/lib/typescript/src/components/Pagination.d.ts.map +1 -0
  55. package/lib/typescript/src/components/Swiper.d.ts +4 -0
  56. package/lib/typescript/src/components/Swiper.d.ts.map +1 -0
  57. package/lib/typescript/src/components/button.d.ts +12 -0
  58. package/lib/typescript/src/components/button.d.ts.map +1 -0
  59. package/lib/typescript/src/components/index.d.ts +2 -0
  60. package/lib/typescript/src/components/index.d.ts.map +1 -0
  61. package/lib/typescript/src/context/OnboardingContext.d.ts +28 -0
  62. package/lib/typescript/src/context/OnboardingContext.d.ts.map +1 -0
  63. package/lib/typescript/src/hooks/useOnboarding.d.ts +12 -0
  64. package/lib/typescript/src/hooks/useOnboarding.d.ts.map +1 -0
  65. package/lib/typescript/src/index.d.ts +5 -0
  66. package/lib/typescript/src/index.d.ts.map +1 -0
  67. package/lib/typescript/src/types/index.d.ts +42 -0
  68. package/lib/typescript/src/types/index.d.ts.map +1 -0
  69. package/package.json +160 -0
  70. package/src/components/CustomPages.tsx +160 -0
  71. package/src/components/OnboardingPages.tsx +173 -0
  72. package/src/components/Page.tsx +90 -0
  73. package/src/components/Pagination.tsx +151 -0
  74. package/src/components/Swiper.tsx +56 -0
  75. package/src/components/button.tsx +74 -0
  76. package/src/components/index.ts +1 -0
  77. package/src/context/OnboardingContext.tsx +95 -0
  78. package/src/hooks/useOnboarding.tsx +12 -0
  79. package/src/index.tsx +18 -0
  80. package/src/types/index.ts +40 -0
@@ -0,0 +1,147 @@
1
+ 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); }
2
+ import React, { useRef } from 'react';
3
+ import tinycolor from 'tinycolor2';
4
+ import { Animated, StyleSheet, Dimensions } from 'react-native';
5
+ import { Pagination } from './Pagination';
6
+ import { OnboardingPage } from './Page';
7
+ const {
8
+ width
9
+ } = Dimensions.get('window');
10
+ export const OnboardingPages = ({
11
+ showPagination = true,
12
+ ...props
13
+ }) => {
14
+ var _props$pages$previous;
15
+ const backgroundColorAnim = useRef(new Animated.Value(0)).current;
16
+ const [previousPage, setPreviousPage] = React.useState(0);
17
+ const currentPage_ = props.pages[props.currentPage];
18
+ const currentBackgroundColor = (currentPage_ === null || currentPage_ === void 0 ? void 0 : currentPage_.backgroundColor) || '';
19
+ const isLight = tinycolor(currentBackgroundColor).getBrightness() > 180;
20
+ const footerBackgroundColor = isLight ? tinycolor(currentBackgroundColor).darken(30).toString() : tinycolor(currentBackgroundColor).lighten(30).toString();
21
+ const color = tinycolor(footerBackgroundColor).getBrightness() > 180 ? tinycolor(footerBackgroundColor).darken(60).toString() : tinycolor(footerBackgroundColor).lighten(60).toString();
22
+ const previousBackgroundColor = ((_props$pages$previous = props.pages[previousPage]) === null || _props$pages$previous === void 0 ? void 0 : _props$pages$previous.backgroundColor) || 'white';
23
+ // Interpolating background color based on backgroundColorAnim value
24
+ const interpolatedBackgroundColor = backgroundColorAnim.interpolate({
25
+ inputRange: [0, 1],
26
+ outputRange: [currentBackgroundColor, previousBackgroundColor],
27
+ extrapolate: 'clamp'
28
+ });
29
+ const setPage_ = newPageIndex => {
30
+ setPreviousPage(props.currentPage);
31
+ props.setPage(newPageIndex);
32
+ };
33
+ return /*#__PURE__*/React.createElement(Animated.View, {
34
+ style: [styles.container, {
35
+ backgroundColor: interpolatedBackgroundColor
36
+ }]
37
+ }, props.paginationPosition === 'top' && /*#__PURE__*/React.createElement(React.Fragment, null, showPagination && props.customFooter && props.customFooter({
38
+ nextPage: props.nextPage
39
+ }), !props.customFooter && /*#__PURE__*/React.createElement(Pagination, {
40
+ width: width,
41
+ onNext: props.nextPage,
42
+ onSkip: props.onSkip,
43
+ color: color,
44
+ onDone: props.onDone,
45
+ showDone: props.showDone,
46
+ backgroundColor: footerBackgroundColor,
47
+ animatedValue: props.scrollX,
48
+ showSkip: props.showSkip,
49
+ numberOfScreens: props.pages.length,
50
+ skipLabel: props.skipLabel,
51
+ nextLabel: props.nextLabel,
52
+ doneLabel: props.doneLabel,
53
+ paginationContainerStyle: props.paginationContainerStyle,
54
+ buttonRightContainerStyle: props.buttonRightContainerStyle,
55
+ buttonLeftContainerStyle: props.buttonLeftContainerStyle,
56
+ dotsContainerStyle: props.dotsContainerStyle,
57
+ doneLabelStyle: props.doneLabelStyle,
58
+ skipLabelStyle: props.skipLabelStyle,
59
+ nextLabelStyle: props.nextLabelStyle
60
+ })), /*#__PURE__*/React.createElement(Animated.FlatList, {
61
+ ref: props.flatListRef,
62
+ data: props.pages,
63
+ horizontal: true,
64
+ pagingEnabled: true,
65
+ showsHorizontalScrollIndicator: false,
66
+ keyExtractor: (_, index) => index.toString(),
67
+ renderItem: ({
68
+ item,
69
+ index
70
+ }) => /*#__PURE__*/React.createElement(OnboardingPage, _extends({
71
+ color: color,
72
+ width: width,
73
+ key: index
74
+ }, item)),
75
+ onScroll: Animated.event([{
76
+ nativeEvent: {
77
+ contentOffset: {
78
+ x: props.scrollX
79
+ }
80
+ }
81
+ }], {
82
+ useNativeDriver: false
83
+ }),
84
+ scrollEventThrottle: 16 // Adjusted for better performance
85
+ ,
86
+ onMomentumScrollEnd: event => {
87
+ const pageIndex = Math.round(event.nativeEvent.contentOffset.x / width);
88
+ setPage_(pageIndex || 0);
89
+ }
90
+ }), props.paginationPosition !== 'top' && /*#__PURE__*/React.createElement(React.Fragment, null, showPagination && props.customFooter && props.customFooter({
91
+ nextPage: props.nextPage
92
+ }), /*#__PURE__*/React.createElement(Pagination, {
93
+ width: width,
94
+ onNext: props.nextPage,
95
+ onSkip: props.onSkip,
96
+ color: color,
97
+ onDone: props.onDone,
98
+ showDone: props.showDone,
99
+ backgroundColor: footerBackgroundColor,
100
+ animatedValue: props.scrollX,
101
+ showSkip: props.showSkip,
102
+ numberOfScreens: props.pages.length,
103
+ skipLabel: props.skipLabel,
104
+ nextLabel: props.nextLabel,
105
+ doneLabel: props.doneLabel,
106
+ paginationContainerStyle: props.paginationContainerStyle,
107
+ buttonRightContainerStyle: props.buttonRightContainerStyle,
108
+ buttonLeftContainerStyle: props.buttonLeftContainerStyle,
109
+ dotsContainerStyle: props.dotsContainerStyle,
110
+ doneLabelStyle: props.doneLabelStyle,
111
+ skipLabelStyle: props.skipLabelStyle,
112
+ nextLabelStyle: props.nextLabelStyle
113
+ })));
114
+ };
115
+ const styles = StyleSheet.create({
116
+ container: {
117
+ flex: 1,
118
+ justifyContent: 'center',
119
+ alignItems: 'center'
120
+ },
121
+ screen: {
122
+ width,
123
+ justifyContent: 'center',
124
+ alignItems: 'center',
125
+ backgroundColor: 'blue'
126
+ },
127
+ pagination: {
128
+ flexDirection: 'row',
129
+ alignItems: 'center',
130
+ paddingVertical: 10,
131
+ paddingHorizontal: 20,
132
+ width
133
+ },
134
+ dot: {
135
+ height: 10,
136
+ width: 10,
137
+ borderRadius: 5,
138
+ backgroundColor: '#333',
139
+ margin: 5
140
+ },
141
+ dotsContainer: {
142
+ flexDirection: 'row',
143
+ flex: 1,
144
+ justifyContent: 'center'
145
+ }
146
+ });
147
+ //# sourceMappingURL=OnboardingPages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useRef","tinycolor","Animated","StyleSheet","Dimensions","Pagination","OnboardingPage","width","get","OnboardingPages","showPagination","props","_props$pages$previous","backgroundColorAnim","Value","current","previousPage","setPreviousPage","useState","currentPage_","pages","currentPage","currentBackgroundColor","backgroundColor","isLight","getBrightness","footerBackgroundColor","darken","toString","lighten","color","previousBackgroundColor","interpolatedBackgroundColor","interpolate","inputRange","outputRange","extrapolate","setPage_","newPageIndex","setPage","createElement","View","style","styles","container","paginationPosition","Fragment","customFooter","nextPage","onNext","onSkip","onDone","showDone","animatedValue","scrollX","showSkip","numberOfScreens","length","skipLabel","nextLabel","doneLabel","paginationContainerStyle","buttonRightContainerStyle","buttonLeftContainerStyle","dotsContainerStyle","doneLabelStyle","skipLabelStyle","nextLabelStyle","FlatList","ref","flatListRef","data","horizontal","pagingEnabled","showsHorizontalScrollIndicator","keyExtractor","_","index","renderItem","item","_extends","key","onScroll","event","nativeEvent","contentOffset","x","useNativeDriver","scrollEventThrottle","onMomentumScrollEnd","pageIndex","Math","round","create","flex","justifyContent","alignItems","screen","pagination","flexDirection","paddingVertical","paddingHorizontal","dot","height","borderRadius","margin","dotsContainer"],"sourceRoot":"../../../src","sources":["components/OnboardingPages.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,UAAU,QAAkB,cAAc;AACzE,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,cAAc,QAAmB,QAAQ;AAGlD,MAAM;EAAEC;AAAM,CAAC,GAAGH,UAAU,CAACI,GAAG,CAAC,QAAQ,CAAC;AAW1C,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAAEC,cAAc,GAAG,IAAI;EAAE,GAAGC;AAAa,CAAC,KAAK;EAAA,IAAAC,qBAAA;EAC7E,MAAMC,mB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;IACxBC,UAAU,EAAE;EACd,CAAC;EACDC,MAAM,EAAE;IACN1F,KAAK;IACLwF,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBzE,eAAe,EAAE;EACnB,CAAC;EACD2E,UAAU,EAAE;IACVC,aAAa,EAAE,KAAK;IACpBH,UAAU,EAAE,QAAQ;IACpBI,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrB9F;EACF,CAAC;EACD+F,GAAG,EAAE;IACHC,MAAM,EAAE,EAAE;IACVhG,KAAK,EAAE,EAAE;IACTiG,YAAY,EAAE,CAAC;IACfjF,eAAe,EAAE,MAAM;IACvBkF,MAAM,EAAE;EACV,CAAC;EACDC,aAAa,EAAE;IACbP,aAAa,EAAE,KAAK;IACpBL,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ import { View, Text, StyleSheet, Dimensions } from 'react-native';
2
+ import React from 'react';
3
+ const {
4
+ width,
5
+ height
6
+ } = Dimensions.get('window');
7
+ const potrait = height > width;
8
+ export function OnboardingPage(props) {
9
+ return /*#__PURE__*/React.createElement(View, {
10
+ style: [styles.container, {
11
+ width: props.width
12
+ }, props.containerStyle]
13
+ }, /*#__PURE__*/React.createElement(View, {
14
+ style: [styles.imageContainer, props.imageContainerStyle]
15
+ }, props.image), /*#__PURE__*/React.createElement(View, {
16
+ style: [styles.titleContainer, props.titleContainerStyle]
17
+ }, /*#__PURE__*/React.createElement(Text, {
18
+ style: [styles.title, {
19
+ color: props.color
20
+ }, props.titleStyle]
21
+ }, props.title), /*#__PURE__*/React.createElement(Text, {
22
+ style: [styles.subtitle, {
23
+ color: props.color
24
+ }, props.subtitleStyle]
25
+ }, props.subtitle)));
26
+ }
27
+ const styles = StyleSheet.create({
28
+ container: {
29
+ flex: 1,
30
+ justifyContent: 'center',
31
+ alignItems: 'center'
32
+ },
33
+ title: {
34
+ fontSize: 24,
35
+ fontWeight: 'bold',
36
+ paddingBottom: 15,
37
+ textAlign: 'center'
38
+ },
39
+ subtitle: {
40
+ fontSize: 18,
41
+ textAlign: 'center'
42
+ },
43
+ imageContainer: {
44
+ flex: 0,
45
+ paddingBottom: potrait ? 60 : 10,
46
+ alignItems: 'center',
47
+ width: '100%'
48
+ },
49
+ titleContainer: {
50
+ marginHorizontal: 30
51
+ }
52
+ });
53
+ //# sourceMappingURL=Page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","Text","StyleSheet","Dimensions","React","width","height","get","potrait","OnboardingPage","props","createElement","style","styles","container","containerStyle","imageContainer","imageContainerStyle","image","titleContainer","titleContainerStyle","title","color","titleStyle","subtitle","subtitleStyle","create","flex","justifyContent","alignItems","fontSize","fontWeight","paddingBottom","textAlign","marginHorizontal"],"sourceRoot":"../../../src","sources":["components/Page.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,UAAU,QAIL,cAAc;AACrB,OAAOC,KAAK,MAAM,OAAO;AAgBzB,MAAM;EAAEC,KAAK;EAAEC;AAAO,CAAC,GAAGH,UAAU,CAACI,GAAG,CAAC,QAAQ,CAAC;AAClD,MAAMC,OAAO,GAAGF,MAAM,GAAGD,KAAK;AAE9B,OAAO,SAASI,cAAcA,CAACC,KAAW,EAAE;EAC1C,oBACEN,KAAA,CAAAO,aAAA,CAACX,IAAI;IACHY,KAAK,EAAE,CAACC,MAAM,CAACC,SAAS,EAAE;MAAET,KAAK,EAAEK,KAAK,CAACL;IAAM,CAAC,EAAEK,KAAK,CAACK,cAAc;EAAE,gBAExEX,KAAA,CAAAO,aAAA,CAACX,IAAI;IAACY,KAAK,EAAE,CAACC,MAAM,CAACG,cAAc,EAAEN,KAAK,CAACO,mBAAmB;EAAE,GAC7DP,KAAK,CAACQ,KACH,CAAC,eACPd,KAAA,CAAAO,aAAA,CAACX,IAAI;IAACY,KAAK,EAAE,CAACC,MAAM,CAACM,cAAc,EAAET,KAAK,CAACU,mBAAmB;EAAE,gBAC9DhB,KAAA,CAAAO,aAAA,CAACV,IAAI;IACHW,KAAK,EAAE,CACLC,MAAM,CAACQ,KAAK,EACZ;MACEC,KAAK,EAAEZ,KAAK,CAACY;IACf,CAAC,EACDZ,KAAK,CAACa,UAAU;EAChB,GAEDb,KAAK,CAACW,KACH,CAAC,eACPjB,KAAA,CAAAO,aAAA,CAACV,IAAI;IACHW,KAAK,EAAE,CACLC,MAAM,CAACW,QAAQ,EACf;MACEF,KAAK,EAAEZ,KAAK,CAACY;IACf,CAAC,EACDZ,KAAK,CAACe,aAAa;EACnB,GAEDf,KAAK,CAACc,QACH,CACF,CACF,CAAC;AAEX;AAEA,MAAMX,MAAM,GAAGX,UAAU,CAACwB,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTa,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDR,KAAK,EAAE;IACLS,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,MAAM;IAClBC,aAAa,EAAE,EAAE;IACjBC,SAAS,EAAE;EACb,CAAC;EACDT,QAAQ,EAAE;IACRM,QAAQ,EAAE,EAAE;IACZG,SAAS,EAAE;EACb,CAAC;EACDjB,cAAc,EAAE;IACdW,IAAI,EAAE,CAAC;IACPK,aAAa,EAAExB,OAAO,GAAG,EAAE,GAAG,EAAE;IAChCqB,UAAU,EAAE,QAAQ;IACpBxB,KAAK,EAAE;EACT,CAAC;EACDc,cAAc,EAAE;IACde,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,87 @@
1
+ import { View, Animated, StyleSheet } from 'react-native';
2
+ import React from 'react';
3
+ import { useOnboarding } from '../hooks/useOnboarding';
4
+ import { Button } from './button';
5
+ export function Pagination(props) {
6
+ const {
7
+ isDone
8
+ } = useOnboarding();
9
+ const dots = Array.from({
10
+ length: props.numberOfScreens
11
+ }, (_, i) => i);
12
+ const width = props.width;
13
+ return /*#__PURE__*/React.createElement(View, {
14
+ style: [styles.pagination, {
15
+ backgroundColor: props.backgroundColor
16
+ }, props.paginationContainerStyle]
17
+ }, /*#__PURE__*/React.createElement(View, {
18
+ style: [styles.buttons, styles.leftButton, props.buttonLeftContainerStyle]
19
+ }, props.showSkip && /*#__PURE__*/React.createElement(Button, {
20
+ onPress: props.onSkip,
21
+ buttonTextStyle: props.skipLabelStyle,
22
+ label: props.skipLabel || 'Skip'
23
+ })), /*#__PURE__*/React.createElement(View, {
24
+ style: styles.dotsContainer
25
+ }, dots.map((_, i) => {
26
+ const inputRange = [(i - 1) * width, i * width, (i + 1) * width];
27
+ const dotOpacity = props.animatedValue.interpolate({
28
+ inputRange,
29
+ outputRange: [0.3, 1, 0.3],
30
+ extrapolate: 'clamp'
31
+ });
32
+ return /*#__PURE__*/React.createElement(Animated.View, {
33
+ key: i,
34
+ style: [styles.dot, {
35
+ backgroundColor: props.color,
36
+ opacity: dotOpacity
37
+ }, props.dotsContainerStyle]
38
+ });
39
+ })), /*#__PURE__*/React.createElement(View, {
40
+ style: [styles.buttons, styles.rightButton, props.buttonRightContainerStyle]
41
+ }, !isDone && props.showNext && /*#__PURE__*/React.createElement(Button, {
42
+ onPress: props.onNext,
43
+ label: props.nextLabel || 'Next',
44
+ buttonTextStyle: props.nextLabelStyle
45
+ }), isDone && props.showDone && /*#__PURE__*/React.createElement(Button, {
46
+ onPress: props.onDone,
47
+ label: props.doneLabel || 'Done',
48
+ buttonTextStyle: props.doneLabelStyle
49
+ })));
50
+ }
51
+ const styles = StyleSheet.create({
52
+ pagination: {
53
+ flexDirection: 'row',
54
+ justifyContent: 'space-between',
55
+ alignItems: 'center',
56
+ height: 60,
57
+ paddingVertical: 10,
58
+ paddingHorizontal: 20
59
+ },
60
+ dot: {
61
+ height: 10,
62
+ width: 10,
63
+ borderRadius: 5,
64
+ backgroundColor: 'blue',
65
+ marginHorizontal: 8
66
+ },
67
+ dotsContainer: {
68
+ flexDirection: 'row',
69
+ flex: 1,
70
+ justifyContent: 'center'
71
+ },
72
+ text: {
73
+ fontSize: 16
74
+ },
75
+ buttons: {
76
+ minWidth: 200
77
+ },
78
+ rightButton: {
79
+ alignItems: 'flex-end',
80
+ paddingRight: 30
81
+ },
82
+ leftButton: {
83
+ alignItems: 'flex-start',
84
+ paddingLeft: 30
85
+ }
86
+ });
87
+ //# sourceMappingURL=Pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","Animated","StyleSheet","React","useOnboarding","Button","Pagination","props","isDone","dots","Array","from","length","numberOfScreens","_","i","width","createElement","style","styles","pagination","backgroundColor","paginationContainerStyle","buttons","leftButton","buttonLeftContainerStyle","showSkip","onPress","onSkip","buttonTextStyle","skipLabelStyle","label","skipLabel","dotsContainer","map","inputRange","dotOpacity","animatedValue","interpolate","outputRange","extrapolate","key","dot","color","opacity","dotsContainerStyle","rightButton","buttonRightContainerStyle","showNext","onNext","nextLabel","nextLabelStyle","showDone","onDone","doneLabel","doneLabelStyle","create","flexDirection","justifyContent","alignItems","height","paddingVertical","paddingHorizontal","borderRadius","marginHorizontal","flex","text","fontSize","minWidth","paddingRight","paddingLeft"],"sourceRoot":"../../../src","sources":["components/Pagination.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,QAAQ,EACRC,UAAU,QAIL,cAAc;AACrB,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,MAAM,QAAQ,UAAU;AA2BjC,OAAO,SAASC,UAAUA,CAACC,KAAkB,EAAE;EAC7C,MAAM;IAAEC;EAAO,CAAC,GAAGJ,aAAa,CAAC,CAAC;EAClC,MAAMK,IAAI,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEL,KAAK,CAACM;EAAgB,CAAC,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAAC;EACvE,MAAMC,KAAK,GAAGT,KAAK,CAACS,KAAK;EACzB,oBACEb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AAE;IACP6C,QAAQ,EAAE;EACZ,CAAC;EACDtB,WAAW,EAAE;IACXa,UAAU,EAAE,UAAU;IACtBU,YAAY,EAAE;EAChB,CAAC;EACD7C,UAAU,EAAE;IACVmC,UAAU,EAAE,YAAY;IACxBW,WAAW,EAAE;EACf;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { OnboardingPages } from './OnboardingPages';
3
+ import { CustomPages } from './CustomPages';
4
+ import { Animated } from 'react-native';
5
+ import { useOnboarding } from '../hooks/useOnboarding';
6
+ export const Swiper = props => {
7
+ const scrollX = React.useRef(new Animated.Value(0)).current;
8
+ const {
9
+ flatListRef,
10
+ setCurrentPage,
11
+ currentPage,
12
+ numberOfScreens,
13
+ nextPage,
14
+ scrollEnabled
15
+ } = useOnboarding();
16
+ if (props.children) {
17
+ return /*#__PURE__*/React.createElement(CustomPages, {
18
+ customFooter: props.customFooter,
19
+ showPagination: props.showPagination,
20
+ flatListRef: flatListRef,
21
+ scrollX: scrollX,
22
+ setPage: setCurrentPage,
23
+ scrollEnabled: scrollEnabled,
24
+ currentPage: currentPage,
25
+ numberOfScreens: numberOfScreens,
26
+ nextPage: nextPage,
27
+ showDone: props.showDone,
28
+ onDone: props.onDone
29
+ }, props.children);
30
+ }
31
+ return /*#__PURE__*/React.createElement(OnboardingPages, {
32
+ showDone: props.showDone,
33
+ customFooter: props.customFooter,
34
+ flatListRef: flatListRef,
35
+ scrollX: scrollX,
36
+ setPage: setCurrentPage,
37
+ currentPage: currentPage,
38
+ paginationPosition: props.paginationPosition,
39
+ nextPage: nextPage,
40
+ showSkip: props.showSkip,
41
+ onDone: props.onDone,
42
+ pages: props.pages || [],
43
+ width: props.width,
44
+ color: props.color,
45
+ onSkip: props.onSkip
46
+ });
47
+ };
48
+ //# sourceMappingURL=Swiper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","OnboardingPages","CustomPages","Animated","useOnboarding","Swiper","props","scrollX","useRef","Value","current","flatListRef","setCurrentPage","currentPage","numberOfScreens","nextPage","scrollEnabled","children","createElement","customFooter","showPagination","setPage","showDone","onDone","paginationPosition","showSkip","pages","width","color","onSkip"],"sourceRoot":"../../../src","sources":["components/Swiper.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,aAAa,QAAQ,wBAAwB;AAGtD,OAAO,MAAMC,MAAiC,GAAIC,KAAK,IAAK;EAC1D,MAAMC,OAAO,GAAGP,KAAK,CAACQ,MAAM,CAAC,IAAIL,QAAQ,CAACM,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EAC3D,MAAM;IACJC,WAAW;IACXC,cAAc;IACdC,WAAW;IACXC,eAAe;IACfC,QAAQ;IACRC;EACF,CAAC,GAAGZ,aAAa,CAAC,CAAC;EACnB,IAAIE,KAAK,CAACW,QAAQ,EAAE;IAClB,oBACEjB,KAAA,CAAAkB,aAAA,CAAChB,WAAW;MACViB,YAAY,EAAEb,KAAK,CAACa,YAAa;MACjCC,cAAc,EAAEd,KAAK,CAACc,cAAe;MACrCT,WAAW,EAAEA,WAAY;MACzBJ,OAAO,EAAEA,OAAQ;MACjBc,OAAO,EAAET,cAAe;MACxBI,aAAa,EAAEA,aAAc;MAC7BH,WAAW,EAAEA,WAAY;MACzBC,eAAe,EAAEA,eAAgB;MACjCC,QAAQ,EAAEA,QAAS;MACnBO,QAAQ,EAAEhB,KAAK,CAACgB,QAAS;MACzBC,MAAM,EAAEjB,KAAK,CAACiB;IAAO,GAEpBjB,KAAK,CAACW,QACI,CAAC;EAElB;EAEA,oBACEjB,KAAA,CAAAkB,aAAA,CAACjB,eAAe;IACdqB,QAAQ,EAAEhB,KAAK,CAACgB,QAAS;IACzBH,YAAY,EAAEb,KAAK,CAACa,YAAa;IACjCR,WAAW,EAAEA,WAAY;IACzBJ,OAAO,EAAEA,OAAQ;IACjBc,OAAO,EAAET,cAAe;IACxBC,WAAW,EAAEA,WAAY;IACzBW,kBAAkB,EAAElB,KAAK,CAACkB,kBAAmB;IAC7CT,QAAQ,EAAEA,QAAS;IACnBU,QAAQ,EAAEnB,KAAK,CAACmB,QAAS;IACzBF,MAAM,EAAEjB,KAAK,CAACiB,MAAO;IACrBG,KAAK,EAAEpB,KAAK,CAACoB,KAAK,IAAI,EAAG;IACzBC,KAAK,EAAErB,KAAK,CAACqB,KAAM;IACnBC,KAAK,EAAEtB,KAAK,CAACsB,KAAM;IACnBC,MAAM,EAAEvB,KAAK,CAACuB;EAAO,CACtB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ import { StyleSheet, Text, TouchableOpacity } from 'react-native';
2
+ import React from 'react';
3
+ export const Button = props => {
4
+ return typeof props.label === 'string' ? /*#__PURE__*/React.createElement(TouchableOpacity, {
5
+ onPress: props.onPress,
6
+ style: props.buttonStyle
7
+ }, /*#__PURE__*/React.createElement(Text, {
8
+ style: [styles.text, {
9
+ color: props.color || 'white'
10
+ }, props.buttonTextStyle]
11
+ }, props.label)) : props.label;
12
+ };
13
+ const styles = StyleSheet.create({
14
+ pagination: {
15
+ flexDirection: 'row',
16
+ justifyContent: 'space-between',
17
+ alignItems: 'center',
18
+ height: 60,
19
+ paddingVertical: 10,
20
+ paddingHorizontal: 20
21
+ },
22
+ dot: {
23
+ height: 10,
24
+ width: 10,
25
+ borderRadius: 5,
26
+ backgroundColor: 'blue',
27
+ marginHorizontal: 8
28
+ },
29
+ dotsContainer: {
30
+ flexDirection: 'row',
31
+ flex: 1,
32
+ justifyContent: 'center'
33
+ },
34
+ text: {
35
+ fontSize: 16
36
+ },
37
+ buttons: {
38
+ minWidth: 200
39
+ },
40
+ rightButton: {
41
+ alignItems: 'flex-end',
42
+ paddingRight: 30
43
+ },
44
+ leftButton: {
45
+ alignItems: 'flex-start',
46
+ paddingLeft: 30
47
+ }
48
+ });
49
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","Text","TouchableOpacity","React","Button","props","label","createElement","onPress","style","buttonStyle","styles","text","color","buttonTextStyle","create","pagination","flexDirection","justifyContent","alignItems","height","paddingVertical","paddingHorizontal","dot","width","borderRadius","backgroundColor","marginHorizontal","dotsContainer","flex","fontSize","buttons","minWidth","rightButton","paddingRight","leftButton","paddingLeft"],"sourceRoot":"../../../src","sources":["components/button.tsx"],"mappings":"AAAA,SACEA,UAAU,EACVC,IAAI,EACJC,gBAAgB,QAIX,cAAc;AACrB,OAAOC,KAAK,MAAM,OAAO;AAUzB,OAAO,MAAMC,MAAM,GAAIC,KAAkB,IAAK;EAC5C,OAAO,OAAOA,KAAK,CAACC,KAAK,KAAK,QAAQ,gBACpCH,KAAA,CAAAI,aAAA,CAACL,gBAAgB;IAACM,OAAO,EAAEH,KAAK,CAACG,OAAQ;IAACC,KAAK,EAAEJ,KAAK,CAACK;EAAY,gBACjEP,KAAA,CAAAI,aAAA,CAACN,IAAI;IACHQ,KAAK,EAAE,CACLE,MAAM,CAACC,IAAI,EACX;MACEC,KAAK,EAAER,KAAK,CAACQ,KAAK,IAAI;IACxB,CAAC,EACDR,KAAK,CAACS,eAAe;EACrB,GAEDT,KAAK,CAACC,KACH,CACU,CAAC,GAEnBD,KAAK,CAACC,KACP;AACH,CAAC;AAED,MAAMK,MAAM,GAAGX,UAAU,CAACe,MAAM,CAAC;EAC/BC,UAAU,EAAE;IACVC,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE,eAAe;IAC/BC,UAAU,EAAE,QAAQ;IACpBC,MAAM,EAAE,EAAE;IACVC,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE;EACrB,CAAC;EACDC,GAAG,EAAE;IACHH,MAAM,EAAE,EAAE;IACVI,KAAK,EAAE,EAAE;IACTC,YAAY,EAAE,CAAC;IACfC,eAAe,EAAE,MAAM;IACvBC,gBAAgB,EAAE;EACpB,CAAC;EACDC,aAAa,EAAE;IACbX,aAAa,EAAE,KAAK;IACpBY,IAAI,EAAE,CAAC;IACPX,cAAc,EAAE;EAClB,CAAC;EACDN,IAAI,EAAE;IACJkB,QAAQ,EAAE;EACZ,CAAC;EACDC,OAAO,EAAE;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDC,WAAW,EAAE;IACXd,UAAU,EAAE,UAAU;IACtBe,YAAY,EAAE;EAChB,CAAC;EACDC,UAAU,EAAE;IACVhB,UAAU,EAAE,YAAY;IACxBiB,WAAW,EAAE;EACf;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from './Swiper';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":"AAAA,cAAc,UAAU","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { Dimensions } from 'react-native';
3
+ export const OnboardingContext = /*#__PURE__*/React.createContext(undefined);
4
+ export const OnboardingProvider = ({
5
+ children,
6
+ width = Dimensions.get('window').width,
7
+ numberOfScreens,
8
+ scrollEnabled
9
+ }) => {
10
+ const getProgress = page => {
11
+ return Math.round((page + 1) / numberOfScreens * 100);
12
+ };
13
+ const [currentPage, setPage] = React.useState(0);
14
+ const [progress, setProgress] = React.useState(getProgress(0));
15
+ const [isDone, setIsDone] = React.useState(false);
16
+ const [enableScroll, setEnableScroll] = React.useState(scrollEnabled);
17
+ const flatListRef = React.useRef(null);
18
+ const setCurrentPage = index => {
19
+ setPage(index);
20
+ setProgress(getProgress(index));
21
+ setIsDone(index === numberOfScreens - 1);
22
+ };
23
+ const nextPage = (animated = true) => {
24
+ if (flatListRef.current) {
25
+ flatListRef.current.scrollToOffset({
26
+ offset: width * (currentPage + 1),
27
+ animated: animated
28
+ });
29
+ }
30
+ setCurrentPage(currentPage + 1);
31
+ };
32
+ const scrollTo = (index, animated = true) => {
33
+ if (flatListRef.current && index >= 0) {
34
+ flatListRef.current.scrollToOffset({
35
+ offset: index * width,
36
+ animated: animated
37
+ });
38
+ setCurrentPage(index);
39
+ }
40
+ };
41
+ const contextValue = {
42
+ scrollEnabled: enableScroll,
43
+ enableScroll: setEnableScroll,
44
+ currentPage,
45
+ numberOfScreens,
46
+ nextPage,
47
+ setCurrentPage,
48
+ flatListRef,
49
+ scrollTo,
50
+ progress,
51
+ isDone
52
+ };
53
+ return /*#__PURE__*/React.createElement(OnboardingContext.Provider, {
54
+ value: contextValue
55
+ }, children);
56
+ };
57
+ //# sourceMappingURL=OnboardingContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Dimensions","OnboardingContext","createContext","undefined","OnboardingProvider","children","width","get","numberOfScreens","scrollEnabled","getProgress","page","Math","round","currentPage","setPage","useState","progress","setProgress","isDone","setIsDone","enableScroll","setEnableScroll","flatListRef","useRef","setCurrentPage","index","nextPage","animated","current","scrollToOffset","offset","scrollTo","contextValue","createElement","Provider","value"],"sourceRoot":"../../../src","sources":["context/OnboardingContext.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAuB,cAAc;AA2BxD,OAAO,MAAMC,iBAAiB,gBAAGF,KAAK,CAACG,aAAa,CAElDC,SAAS,CAAC;AAEZ,OAAO,MAAMC,kBAAqD,GAAGA,CAAC;EACpEC,QAAQ;EACRC,KAAK,GAAGN,UAAU,CAACO,GAAG,CAAC,QAAQ,CAAC,CAACD,KAAK;EACtCE,eAAe;EACfC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAIC,IAAY,IAAK;IACpC,OAAOC,IAAI,CAACC,KAAK,CAAE,CAACF,IAAI,GAAG,CAAC,IAAIH,eAAe,GAAI,GAAG,CAAC;EACzD,CAAC;EAED,MAAM,CAACM,WAAW,EAAEC,OAAO,CAAC,GAAGhB,KAAK,CAACiB,QAAQ,CAAC,CAAC,CAAC;EAChD,MAAM,CAACC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AW;IACXN,eAAe;IACfmB,QAAQ;IACRF,cAAc;IACdF,WAAW;IACXS,QAAQ;IACRf,QAAQ;IACRE;EACF,CAAC;EAED,oBACEpB,KAAA,CAAAmC,aAAA,CAACjC,iBAAiB,CAACkC,QAAQ;IAACC,KAAK,EAAEH;EAAa,GAC7C5B,QACyB,CAAC;AAEjC,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { OnboardingContext } from '../context/OnboardingContext';
3
+ export const useOnboarding = () => {
4
+ const context = React.useContext(OnboardingContext);
5
+ if (!context) {
6
+ throw new Error('useOnboardingContext must be used within an OnboardingProvider');
7
+ }
8
+ return context;
9
+ };
10
+ //# sourceMappingURL=useOnboarding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","OnboardingContext","useOnboarding","context","useContext","Error"],"sourceRoot":"../../../src","sources":["hooks/useOnboarding.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,8BAA8B;AAEhE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,OAAO,GAAGH,KAAK,CAACI,UAAU,CAACH,iBAAiB,CAAC;EACnD,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,gEACF,CAAC;EACH;EACA,OAAOF,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { Swiper } from './components/Swiper';
3
+ import { OnboardingProvider } from './context/OnboardingContext';
4
+ export { useOnboarding } from './hooks/useOnboarding';
5
+ export function Onboarding(props) {
6
+ var _props$pages;
7
+ const numberOfScreens = React.Children.count(props.children);
8
+ return /*#__PURE__*/React.createElement(OnboardingProvider, {
9
+ scrollEnabled: props.scrollEnabled,
10
+ numberOfScreens: numberOfScreens || ((_props$pages = props.pages) === null || _props$pages === void 0 ? void 0 : _props$pages.length) || 0
11
+ }, /*#__PURE__*/React.createElement(Swiper, props, props.children));
12
+ }
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Swiper","OnboardingProvider","useOnboarding","Onboarding","props","_props$pages","numberOfScreens","Children","count","children","createElement","scrollEnabled","pages","length"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,kBAAkB,QAAQ,6BAA6B;AAGhE,SAASC,aAAa,QAAQ,uBAAuB;AAErD,OAAO,SAASC,UAAUA,CAACC,KAAsB,EAAE;EAAA,IAAAC,YAAA;EACjD,MAAMC,eAAe,GAAGP,KAAK,CAACQ,QAAQ,CAACC,KAAK,CAACJ,KAAK,CAACK,QAAQ,CAAC;EAC5D,oBACEV,KAAA,CAAAW,aAAA,CAACT,kBAAkB;IACjBU,aAAa,EAAEP,KAAK,CAACO,aAAc;IACnCL,eAAe,EAAEA,eAAe,MAAAD,YAAA,GAAID,KAAK,CAACQ,KAAK,cAAAP,YAAA,uBAAXA,YAAA,CAAaQ,MAAM,KAAI;EAAE,gBAE7Dd,KAAA,CAAAW,aAAA,CAACV,MAAM,EAAKI,KAAK,EAAGA,KAAK,CAACK,QAAiB,CACzB,CAAC;AAEzB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ import { Animated, FlatList } from 'react-native';
2
+ import React from 'react';
3
+ import type { OnboardingProps } from '../types';
4
+ type CustomPagesProps = OnboardingProps & {
5
+ children?: React.ReactNode[];
6
+ currentPage: number;
7
+ setPage: (newPageIndex: number) => void;
8
+ flatListRef: React.RefObject<FlatList>;
9
+ scrollX: Animated.Value;
10
+ nextPage: () => void;
11
+ numberOfScreens: number;
12
+ };
13
+ export type SliderProps = {
14
+ index?: number;
15
+ currentPage: number;
16
+ numberOfScreens: number;
17
+ nextPage: () => void;
18
+ };
19
+ export declare const CustomPages: ({ showPagination, ...props }: CustomPagesProps) => React.JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=CustomPages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomPages.d.ts","sourceRoot":"","sources":["../../../../src/components/CustomPages.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAc,QAAQ,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,KAAK,gBAAgB,GAAG,eAAe,GAAG;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACxB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,iCAGrB,gBAAgB,sBAmGlB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Animated, FlatList } from 'react-native';
3
+ import { type Page } from './Page';
4
+ import type { OnboardingProps } from '../types';
5
+ type Props = OnboardingProps & {
6
+ pages: Page[];
7
+ currentPage: number;
8
+ setPage: (newPageIndex: number) => void;
9
+ flatListRef: React.RefObject<FlatList>;
10
+ scrollX: Animated.Value;
11
+ nextPage: () => void;
12
+ };
13
+ export declare const OnboardingPages: ({ showPagination, ...props }: Props) => React.JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=OnboardingPages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnboardingPages.d.ts","sourceRoot":"","sources":["../../../../src/components/OnboardingPages.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAA0B,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,KAAK,KAAK,GAAG,eAAe,GAAG;IAC7B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACxB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,iCAAyC,KAAK,sBAyHzE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type StyleProp, type ViewStyle, type TextStyle } from 'react-native';
2
+ import React from 'react';
3
+ export type Page = {
4
+ title: string;
5
+ subtitle: string;
6
+ image: React.ReactNode;
7
+ backgroundColor: string;
8
+ color?: string;
9
+ width?: number;
10
+ containerStyle?: StyleProp<ViewStyle>;
11
+ imageContainerStyle?: StyleProp<ViewStyle>;
12
+ titleContainerStyle?: StyleProp<ViewStyle>;
13
+ titleStyle?: StyleProp<TextStyle>;
14
+ subtitleStyle?: StyleProp<TextStyle>;
15
+ };
16
+ export declare function OnboardingPage(props: Page): React.JSX.Element;
17
+ //# sourceMappingURL=Page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../../src/components/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAKF,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,qBAkCzC"}
@@ -0,0 +1,29 @@
1
+ import { Animated, type StyleProp, type ViewStyle, type TextStyle } from 'react-native';
2
+ import React from 'react';
3
+ type FooterProps = {
4
+ animatedValue: Animated.Value;
5
+ numberOfScreens: number;
6
+ backgroundColor: string;
7
+ color: string;
8
+ width: number;
9
+ showDone?: boolean;
10
+ showSkip?: boolean;
11
+ showNext?: boolean;
12
+ nextLabel?: string | React.ReactNode;
13
+ skipLabel?: string | React.ReactNode;
14
+ doneLabel?: string | React.ReactNode;
15
+ paginationContainerStyle?: StyleProp<ViewStyle>;
16
+ buttonRightContainerStyle?: StyleProp<ViewStyle>;
17
+ buttonLeftContainerStyle?: StyleProp<ViewStyle>;
18
+ dotsContainerStyle?: StyleProp<ViewStyle>;
19
+ doneLabelStyle?: StyleProp<TextStyle>;
20
+ skipLabelStyle?: StyleProp<TextStyle>;
21
+ nextLabelStyle?: StyleProp<TextStyle>;
22
+ paginationPosition?: 'top' | 'bottom';
23
+ onDone?: () => void;
24
+ onSkip?: () => void;
25
+ onNext?: () => void;
26
+ };
27
+ export declare function Pagination(props: FooterProps): React.JSX.Element;
28
+ export {};
29
+ //# sourceMappingURL=Pagination.d.ts.map