flowboard-react 0.1.0 → 0.3.0

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 (39) hide show
  1. package/README.md +3 -2
  2. package/lib/module/Flowboard.js +3 -2
  3. package/lib/module/Flowboard.js.map +1 -1
  4. package/lib/module/FlowboardProvider.js +18 -14
  5. package/lib/module/FlowboardProvider.js.map +1 -1
  6. package/lib/module/components/FlowboardFlow.js +70 -37
  7. package/lib/module/components/FlowboardFlow.js.map +1 -1
  8. package/lib/module/components/FlowboardRenderer.js +622 -105
  9. package/lib/module/components/FlowboardRenderer.js.map +1 -1
  10. package/lib/module/core/assetPreloader.js +20 -18
  11. package/lib/module/core/assetPreloader.js.map +1 -1
  12. package/lib/module/index.js +1 -0
  13. package/lib/module/index.js.map +1 -1
  14. package/lib/module/types/react-native-peers.d.js +2 -0
  15. package/lib/module/types/react-native-peers.d.js.map +1 -0
  16. package/lib/module/utils/flowboardUtils.js +20 -14
  17. package/lib/module/utils/flowboardUtils.js.map +1 -1
  18. package/lib/typescript/src/Flowboard.d.ts.map +1 -1
  19. package/lib/typescript/src/FlowboardProvider.d.ts.map +1 -1
  20. package/lib/typescript/src/components/FlowboardFlow.d.ts +1 -2
  21. package/lib/typescript/src/components/FlowboardFlow.d.ts.map +1 -1
  22. package/lib/typescript/src/components/FlowboardRenderer.d.ts.map +1 -1
  23. package/lib/typescript/src/core/assetPreloader.d.ts.map +1 -1
  24. package/lib/typescript/src/index.d.ts +2 -0
  25. package/lib/typescript/src/index.d.ts.map +1 -1
  26. package/lib/typescript/src/types/flowboard.d.ts +1 -0
  27. package/lib/typescript/src/types/flowboard.d.ts.map +1 -1
  28. package/lib/typescript/src/utils/flowboardUtils.d.ts +6 -0
  29. package/lib/typescript/src/utils/flowboardUtils.d.ts.map +1 -1
  30. package/package.json +17 -16
  31. package/src/Flowboard.ts +5 -2
  32. package/src/FlowboardProvider.tsx +20 -16
  33. package/src/components/FlowboardFlow.tsx +89 -49
  34. package/src/components/FlowboardRenderer.tsx +771 -98
  35. package/src/core/assetPreloader.ts +21 -32
  36. package/src/index.tsx +2 -0
  37. package/src/types/flowboard.ts +1 -0
  38. package/src/types/react-native-peers.d.ts +106 -0
  39. package/src/utils/flowboardUtils.ts +28 -14
@@ -1 +1 @@
1
- {"version":3,"file":"FlowboardFlow.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowboardFlow.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EAEnB,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAO5B,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAkV9D"}
1
+ {"version":3,"file":"FlowboardFlow.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowboardFlow.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EAEnB,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,qBA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MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,SAAS,EAAE,CAWxD;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC5B,YAAY,EAAE,CAiDhB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,EAAE,EACjB,QAAQ,EAAE,YAAY,EAAE,GACvB,SAAS,EAAE,CASb"}
@@ -1 +1 @@
1
- {"version":3,"file":"assetPreloader.d.ts","sourceRoot":"","sources":["../../../../src/core/assetPreloader.ts"],"names":[],"mappings":"AAEA,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAqB;IAEpC,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCzE,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,UAAU;CAiDnB"}
1
+ {"version":3,"file":"assetPreloader.d.ts","sourceRoot":"","sources":["../../../../src/core/assetPreloader.ts"],"names":[],"mappings":"AASA,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAqB;IAEpC,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzE,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,UAAU;CA8CnB"}
@@ -1,4 +1,6 @@
1
1
  export { Flowboard } from './Flowboard';
2
2
  export { default as FlowboardProvider } from './FlowboardProvider';
3
+ export { default as FlowboardFlow } from './components/FlowboardFlow';
3
4
  export type { FlowboardContext, CustomScreenBuilder, CustomActionBuilder, OnboardingEndCallback, OnStepChangeCallback, FlowboardLaunchOptions, FlowboardData, } from './types/flowboard';
5
+ export type { FlowboardFlowProps } from './components/FlowboardFlow';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,GACd,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -30,5 +30,6 @@ export type FlowboardLaunchOptions = {
30
30
  onStepChange?: OnStepChangeCallback;
31
31
  enableAnalytics?: boolean;
32
32
  alwaysRestart?: boolean;
33
+ resumeProgress?: boolean;
33
34
  };
34
35
  //# sourceMappingURL=flowboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowboard.d.ts","sourceRoot":"","sources":["../../../../src/types/flowboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,gBAAgB,EACrB,IAAI,CAAC,EAAE,OAAO,KACX,IAAI,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E,MAAM,IAAI,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,gBAAgB,EACrB,IAAI,CAAC,EAAE,OAAO,KACX,IAAI,CAAC;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG,CACjC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,KACd,IAAI,CAAC;AAEV,MAAM,MAAM,sBAAsB,GAAG;IACnC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC"}
@@ -14,6 +14,12 @@ export declare function insetsToStyle(insets: Insets): {
14
14
  paddingBottom: number;
15
15
  paddingLeft: number;
16
16
  };
17
+ export declare function insetsToMarginStyle(insets: Insets): {
18
+ marginTop: number;
19
+ marginRight: number;
20
+ marginBottom: number;
21
+ marginLeft: number;
22
+ };
17
23
  export declare function formatDate(pattern: string, date?: Date): string;
18
24
  export declare function resolveText(text: string, formData: Record<string, any>): string;
19
25
  export declare function evaluateExpression(content: string, formData: Record<string, any>): any;
@@ -1 +1 @@
1
- {"version":3,"file":"flowboardUtils.d.ts","sourceRoot":"","s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": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Onboard your users with one click",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -32,20 +32,7 @@
32
32
  "!**/.*"
33
33
  ],
34
34
  "dependencies": {
35
- "@react-native-async-storage/async-storage": "^1.24.0",
36
- "@react-native-masked-view/masked-view": "^0.3.2",
37
35
  "expr-eval": "^2.0.2",
38
- "lottie-react-native": "^7.1.0",
39
- "react-native-device-info": "^13.2.0",
40
- "react-native-get-random-values": "^1.11.0",
41
- "react-native-in-app-review": "^4.3.0",
42
- "react-native-linear-gradient": "^2.8.3",
43
- "react-native-mask-input": "^1.2.3",
44
- "react-native-pager-view": "^6.2.4",
45
- "react-native-permissions": "^4.1.5",
46
- "react-native-safe-area-context": "^4.11.0",
47
- "react-native-svg": "^15.10.1",
48
- "react-native-vector-icons": "^10.2.0",
49
36
  "uuid": "^11.1.0"
50
37
  },
51
38
  "scripts": {
@@ -104,8 +91,22 @@
104
91
  "typescript": "^5.9.2"
105
92
  },
106
93
  "peerDependencies": {
94
+ "@react-native-async-storage/async-storage": "^1.24.0",
95
+ "@react-native-masked-view/masked-view": "^0.3.2",
96
+ "lottie-react-native": "^7.1.0",
107
97
  "react": "*",
108
- "react-native": "*"
98
+ "react-native": "*",
99
+ "react-native-device-info": "^13.2.0",
100
+ "react-native-gesture-handler": "^2.30.0",
101
+ "react-native-get-random-values": "^1.11.0",
102
+ "react-native-in-app-review": "^4.3.0",
103
+ "react-native-linear-gradient": "^2.8.3",
104
+ "react-native-mask-input": "^1.2.3",
105
+ "react-native-pager-view": "^6.2.4",
106
+ "react-native-permissions": "^4.1.5",
107
+ "react-native-safe-area-context": "^5.0.0",
108
+ "react-native-svg": "^15.10.1",
109
+ "react-native-vector-icons": "^10.2.0"
109
110
  },
110
111
  "workspaces": [
111
112
  "example"
@@ -189,4 +190,4 @@
189
190
  ],
190
191
  "version": "0.57.0"
191
192
  }
192
- }
193
+ }
package/src/Flowboard.ts CHANGED
@@ -117,14 +117,17 @@ export class Flowboard {
117
117
  return;
118
118
  }
119
119
 
120
- if (options.alwaysRestart) {
120
+ const shouldResumeProgress =
121
+ options.resumeProgress === true && options.alwaysRestart !== true;
122
+
123
+ if (options.alwaysRestart || !shouldResumeProgress) {
121
124
  await Flowboard.repository.clearProgress();
122
125
  }
123
126
 
124
127
  let initialStep = 0;
125
128
  let initialFormData: Record<string, any> = {};
126
129
 
127
- if (!options.alwaysRestart) {
130
+ if (shouldResumeProgress) {
128
131
  const flowId = data.flow_id as string | undefined;
129
132
  if (flowId) {
130
133
  const savedStep = await Flowboard.repository.getProgressStepForFlow(
@@ -1,12 +1,13 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { Modal, StyleSheet, View } from 'react-native';
3
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
3
4
  import { Flowboard, type LaunchPayload } from './Flowboard';
4
5
  import FlowboardFlow from './components/FlowboardFlow';
5
6
 
6
7
  const styles = StyleSheet.create({
7
8
  modalContainer: {
8
9
  flex: 1,
9
- backgroundColor: 'transparent',
10
+ backgroundColor: '#ffffff',
10
11
  },
11
12
  });
12
13
 
@@ -37,23 +38,26 @@ export default function FlowboardProvider({
37
38
  <Modal
38
39
  visible={visible}
39
40
  animationType="slide"
40
- transparent
41
+ transparent={false}
42
+ presentationStyle="fullScreen"
41
43
  onRequestClose={handleClose}
42
44
  >
43
- <View style={styles.modalContainer}>
44
- {payload ? (
45
- <FlowboardFlow
46
- data={payload.data}
47
- customScreenBuilder={payload.options.customScreenBuilder}
48
- customActionBuilder={payload.options.customActionBuilder}
49
- onOnboardEnd={payload.options.onOnboardEnd}
50
- onStepChange={payload.options.onStepChange}
51
- initialStep={payload.initialStep}
52
- initialFormData={payload.initialFormData}
53
- onClose={handleClose}
54
- />
55
- ) : null}
56
- </View>
45
+ <SafeAreaProvider>
46
+ <View style={styles.modalContainer}>
47
+ {payload ? (
48
+ <FlowboardFlow
49
+ data={payload.data}
50
+ customScreenBuilder={payload.options.customScreenBuilder}
51
+ customActionBuilder={payload.options.customActionBuilder}
52
+ onOnboardEnd={payload.options.onOnboardEnd}
53
+ onStepChange={payload.options.onStepChange}
54
+ initialStep={payload.initialStep}
55
+ initialFormData={payload.initialFormData}
56
+ onClose={handleClose}
57
+ />
58
+ ) : null}
59
+ </View>
60
+ </SafeAreaProvider>
57
61
  </Modal>
58
62
  </>
59
63
  );
@@ -1,8 +1,6 @@
1
1
  import { useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { Alert, Keyboard, Platform, StyleSheet, View } from 'react-native';
3
- import PagerView, {
4
- type PagerViewOnPageSelectedEvent,
5
- } from 'react-native-pager-view';
3
+ import PagerView from 'react-native-pager-view';
6
4
  import { Linking } from 'react-native';
7
5
  import InAppReview from 'react-native-in-app-review';
8
6
  import {
@@ -30,11 +28,11 @@ import type {
30
28
  } from '../types/flowboard';
31
29
 
32
30
  const styles = StyleSheet.create({
33
- container: { flex: 1, backgroundColor: 'transparent' },
31
+ container: { flex: 1, backgroundColor: '#ffffff' },
34
32
  fullFlex: { flex: 1 },
35
33
  });
36
34
 
37
- type FlowboardFlowProps = {
35
+ export type FlowboardFlowProps = {
38
36
  data: FlowboardData;
39
37
  customScreenBuilder?: CustomScreenBuilder;
40
38
  customActionBuilder?: CustomActionBuilder;
@@ -66,9 +64,16 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
66
64
  const [currentIndex, setCurrentIndex] = useState(() =>
67
65
  resolveInitialPage(initialStep, screens.length)
68
66
  );
67
+ const [activePages, setActivePages] = useState<Record<number, true>>(() => ({
68
+ [resolveInitialPage(initialStep, screens.length)]: true,
69
+ }));
69
70
  const [formData, setFormData] = useState<Record<string, any>>({
70
71
  ...initialFormData,
71
72
  });
73
+ const formDataRef = useRef<Record<string, any>>({
74
+ ...initialFormData,
75
+ });
76
+ const didSyncPagerRef = useRef(false);
72
77
  const completedRef = useRef(false);
73
78
  const flowStartTimeRef = useRef(Date.now());
74
79
 
@@ -77,7 +82,6 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
77
82
  AnalyticsManager.instance.trackOnboardStarted();
78
83
 
79
84
  requestAnimationFrame(() => {
80
- preloadAssets(currentIndex);
81
85
  notifyStepChange(currentIndex);
82
86
  });
83
87
 
@@ -93,11 +97,16 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
93
97
 
94
98
  useEffect(() => {
95
99
  if (pagerRef.current) {
96
- pagerRef.current.setPageWithoutAnimation(currentIndex);
100
+ if (!didSyncPagerRef.current) {
101
+ pagerRef.current.setPageWithoutAnimation(currentIndex);
102
+ didSyncPagerRef.current = true;
103
+ } else {
104
+ pagerRef.current.setPage(currentIndex);
105
+ }
97
106
  }
98
107
  }, [currentIndex]);
99
108
 
100
- const notifyStepChange = (index: number) => {
109
+ const notifyStepChange = (index: number, preloadNext = true) => {
101
110
  if (index < 0 || index >= screens.length) return;
102
111
  const screenData = screens[index] as Record<string, any>;
103
112
  const pageId = screenData.id ?? 'unknown';
@@ -109,17 +118,36 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
109
118
  });
110
119
 
111
120
  if (onStepChange) {
112
- onStepChange(pageId, index, { ...formData });
121
+ onStepChange(pageId, index, { ...formDataRef.current });
113
122
  }
114
123
 
115
124
  persistProgress(index);
116
- preloadAssets(index);
125
+ if (preloadNext) {
126
+ preloadAssets(index);
127
+ }
128
+ };
129
+
130
+ const markPageAsActive = (index: number) => {
131
+ setActivePages((prev) => {
132
+ if (prev[index]) return prev;
133
+ return { ...prev, [index]: true };
134
+ });
135
+ };
136
+
137
+ const moveToIndex = (nextIndex: number) => {
138
+ if (nextIndex < 0 || nextIndex >= screens.length) return;
139
+ markPageAsActive(nextIndex);
140
+ setCurrentIndex(nextIndex);
141
+ notifyStepChange(nextIndex);
117
142
  };
118
143
 
119
- const persistProgress = (index: number) => {
144
+ const persistProgress = (
145
+ index: number,
146
+ snapshot: Record<string, any> = formDataRef.current
147
+ ) => {
120
148
  if (!flowId) return;
121
149
  repository
122
- .saveProgress({ flowId, stepIndex: index, formData: { ...formData } })
150
+ .saveProgress({ flowId, stepIndex: index, formData: { ...snapshot } })
123
151
  .catch(() => null);
124
152
  };
125
153
 
@@ -128,10 +156,6 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
128
156
  };
129
157
 
130
158
  const preloadAssets = (index: number) => {
131
- const currentScreen = screens[index];
132
- if (currentScreen) {
133
- assetPreloader.preloadScreenAssets(currentScreen).catch(() => null);
134
- }
135
159
  const nextScreen = screens[index + 1];
136
160
  if (nextScreen) {
137
161
  assetPreloader.preloadScreenAssets(nextScreen).catch(() => null);
@@ -162,7 +186,7 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
162
186
  context: null,
163
187
  currentIndex: index,
164
188
  totalScreens: screens.length,
165
- formData: { ...formData },
189
+ formData: { ...formDataRef.current },
166
190
  screenData: screens[index] as Record<string, any>,
167
191
  onNext: () => handleAction('next', index, screens.length),
168
192
  onPrevious: () => handleAction('previous', index, screens.length),
@@ -175,11 +199,29 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
175
199
  totalScreens: number,
176
200
  dataPayload?: Record<string, any>
177
201
  ) => {
202
+ if (index !== currentIndex) return;
178
203
  Keyboard.dismiss();
204
+ let effectiveFormData = formDataRef.current;
205
+ const payloadFieldId =
206
+ typeof dataPayload?.fieldId === 'string' ? dataPayload.fieldId : null;
207
+ const hasPayloadValue = Object.prototype.hasOwnProperty.call(
208
+ dataPayload ?? {},
209
+ 'selectedValue'
210
+ );
211
+
212
+ if (payloadFieldId && hasPayloadValue) {
213
+ effectiveFormData = {
214
+ ...formDataRef.current,
215
+ [payloadFieldId]: dataPayload?.selectedValue,
216
+ };
217
+ formDataRef.current = effectiveFormData;
218
+ setFormData(effectiveFormData);
219
+ persistProgress(index, effectiveFormData);
220
+ }
179
221
 
180
222
  if (action === 'next') {
181
223
  const currentScreen = screens[index] as Record<string, any>;
182
- const invalidFields = validateScreen(currentScreen, formData);
224
+ const invalidFields = validateScreen(currentScreen, effectiveFormData);
183
225
  if (invalidFields.length > 0) {
184
226
  Alert.alert(
185
227
  'Validation',
@@ -189,10 +231,10 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
189
231
  }
190
232
 
191
233
  if (index < totalScreens - 1) {
192
- setCurrentIndex(index + 1);
234
+ moveToIndex(index + 1);
193
235
  } else {
194
236
  trackCompletion(OnboardingOutcome.completed, index);
195
- onOnboardEnd?.({ ...formData });
237
+ onOnboardEnd?.({ ...effectiveFormData });
196
238
  resetStoredProgress();
197
239
  onClose?.();
198
240
  }
@@ -201,14 +243,14 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
201
243
 
202
244
  if (action === 'previous') {
203
245
  if (index > 0) {
204
- setCurrentIndex(index - 1);
246
+ moveToIndex(index - 1);
205
247
  }
206
248
  return;
207
249
  }
208
250
 
209
251
  if (action === 'finish') {
210
252
  trackCompletion(OnboardingOutcome.completed, index);
211
- onOnboardEnd?.({ ...formData });
253
+ onOnboardEnd?.({ ...effectiveFormData });
212
254
  resetStoredProgress();
213
255
  onClose?.();
214
256
  return;
@@ -262,10 +304,10 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
262
304
  }
263
305
 
264
306
  if (index < totalScreens - 1) {
265
- setCurrentIndex(index + 1);
307
+ moveToIndex(index + 1);
266
308
  } else {
267
309
  trackCompletion(OnboardingOutcome.completed, index);
268
- onOnboardEnd?.({ ...formData });
310
+ onOnboardEnd?.({ ...formDataRef.current });
269
311
  resetStoredProgress();
270
312
  onClose?.();
271
313
  }
@@ -328,11 +370,11 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
328
370
  };
329
371
 
330
372
  const handleInputChange = (id: string, value: any, index: number) => {
331
- setFormData((prev) => {
332
- const next = { ...prev, [id]: value };
333
- return next;
334
- });
335
- persistProgress(index);
373
+ if (index !== currentIndex) return;
374
+ const next = { ...formDataRef.current, [id]: value };
375
+ formDataRef.current = next;
376
+ setFormData(next);
377
+ persistProgress(index, next);
336
378
  };
337
379
 
338
380
  return (
@@ -342,41 +384,39 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
342
384
  style={styles.fullFlex}
343
385
  scrollEnabled={false}
344
386
  initialPage={currentIndex}
345
- onPageSelected={(event: PagerViewOnPageSelectedEvent) => {
346
- const nextIndex = event.nativeEvent.position;
347
- setCurrentIndex(nextIndex);
348
- notifyStepChange(nextIndex);
349
- }}
350
387
  >
351
388
  {screens.map((screen, index) => {
352
389
  const screenData = screen as Record<string, any>;
353
390
  const screenType = screenData.type;
391
+ const isActivePage = activePages[index] === true;
354
392
 
355
393
  if (screenType === 'custom' && customScreenBuilder) {
356
394
  const ctx = createContext(index);
357
395
  return (
358
396
  <View key={`screen-${index}`} style={styles.fullFlex}>
359
- {customScreenBuilder(ctx)}
397
+ {isActivePage ? customScreenBuilder(ctx) : null}
360
398
  </View>
361
399
  );
362
400
  }
363
401
 
364
402
  return (
365
403
  <View key={`screen-${index}`} style={styles.fullFlex}>
366
- <SliderRegistryProvider registry={sliderRegistry}>
367
- <FlowboardRenderer
368
- screenData={screenData}
369
- formData={formData}
370
- onInputChange={(id, value) =>
371
- handleInputChange(id, value, index)
372
- }
373
- onAction={(action, payload) =>
374
- handleAction(action, index, screens.length, payload)
375
- }
376
- currentIndex={index}
377
- totalScreens={screens.length}
378
- />
379
- </SliderRegistryProvider>
404
+ {isActivePage ? (
405
+ <SliderRegistryProvider registry={sliderRegistry}>
406
+ <FlowboardRenderer
407
+ screenData={screenData}
408
+ formData={formData}
409
+ onInputChange={(id, value) =>
410
+ handleInputChange(id, value, index)
411
+ }
412
+ onAction={(action, payload) =>
413
+ handleAction(action, index, screens.length, payload)
414
+ }
415
+ currentIndex={currentIndex}
416
+ totalScreens={screens.length}
417
+ />
418
+ </SliderRegistryProvider>
419
+ ) : null}
380
420
  </View>
381
421
  );
382
422
  })}