@velion-la/onboarding-sdk-react-native 1.1.0-beta.2 → 1.1.0-beta.3

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 (68) hide show
  1. package/README.md +40 -0
  2. package/lib/commonjs/steps/AddressInfoStep.js +41 -13
  3. package/lib/commonjs/steps/AddressInfoStep.js.map +1 -1
  4. package/lib/commonjs/steps/DocumentsOcrStep.js +37 -31
  5. package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
  6. package/lib/commonjs/steps/EconomicActivityStep.js +53 -52
  7. package/lib/commonjs/steps/EconomicActivityStep.js.map +1 -1
  8. package/lib/commonjs/ui/ScreenScaffold.js +99 -0
  9. package/lib/commonjs/ui/ScreenScaffold.js.map +1 -0
  10. package/lib/commonjs/ui/StepShell.js +23 -42
  11. package/lib/commonjs/ui/StepShell.js.map +1 -1
  12. package/lib/commonjs/ui/VelionOnboardingScreen.js +13 -10
  13. package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
  14. package/lib/commonjs/ui/forms/index.js +7 -0
  15. package/lib/commonjs/ui/forms/index.js.map +1 -1
  16. package/lib/commonjs/ui/forms/useFieldChain.js +56 -0
  17. package/lib/commonjs/ui/forms/useFieldChain.js.map +1 -0
  18. package/lib/commonjs/ui/keyboard.js +147 -0
  19. package/lib/commonjs/ui/keyboard.js.map +1 -0
  20. package/lib/commonjs/ui/screenInsets.js +67 -0
  21. package/lib/commonjs/ui/screenInsets.js.map +1 -0
  22. package/lib/module/steps/AddressInfoStep.js +41 -13
  23. package/lib/module/steps/AddressInfoStep.js.map +1 -1
  24. package/lib/module/steps/DocumentsOcrStep.js +37 -31
  25. package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
  26. package/lib/module/steps/EconomicActivityStep.js +54 -53
  27. package/lib/module/steps/EconomicActivityStep.js.map +1 -1
  28. package/lib/module/ui/ScreenScaffold.js +94 -0
  29. package/lib/module/ui/ScreenScaffold.js.map +1 -0
  30. package/lib/module/ui/StepShell.js +24 -43
  31. package/lib/module/ui/StepShell.js.map +1 -1
  32. package/lib/module/ui/VelionOnboardingScreen.js +13 -10
  33. package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
  34. package/lib/module/ui/forms/index.js +1 -0
  35. package/lib/module/ui/forms/index.js.map +1 -1
  36. package/lib/module/ui/forms/useFieldChain.js +52 -0
  37. package/lib/module/ui/forms/useFieldChain.js.map +1 -0
  38. package/lib/module/ui/keyboard.js +143 -0
  39. package/lib/module/ui/keyboard.js.map +1 -0
  40. package/lib/module/ui/screenInsets.js +61 -0
  41. package/lib/module/ui/screenInsets.js.map +1 -0
  42. package/lib/typescript/steps/AddressInfoStep.d.ts.map +1 -1
  43. package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
  44. package/lib/typescript/steps/EconomicActivityStep.d.ts.map +1 -1
  45. package/lib/typescript/ui/ScreenScaffold.d.ts +57 -0
  46. package/lib/typescript/ui/ScreenScaffold.d.ts.map +1 -0
  47. package/lib/typescript/ui/StepShell.d.ts +1 -3
  48. package/lib/typescript/ui/StepShell.d.ts.map +1 -1
  49. package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
  50. package/lib/typescript/ui/forms/index.d.ts +1 -0
  51. package/lib/typescript/ui/forms/index.d.ts.map +1 -1
  52. package/lib/typescript/ui/forms/useFieldChain.d.ts +30 -0
  53. package/lib/typescript/ui/forms/useFieldChain.d.ts.map +1 -0
  54. package/lib/typescript/ui/keyboard.d.ts +69 -0
  55. package/lib/typescript/ui/keyboard.d.ts.map +1 -0
  56. package/lib/typescript/ui/screenInsets.d.ts +68 -0
  57. package/lib/typescript/ui/screenInsets.d.ts.map +1 -0
  58. package/package.json +5 -1
  59. package/src/steps/AddressInfoStep.tsx +37 -0
  60. package/src/steps/DocumentsOcrStep.tsx +50 -36
  61. package/src/steps/EconomicActivityStep.tsx +54 -44
  62. package/src/ui/ScreenScaffold.tsx +130 -0
  63. package/src/ui/StepShell.tsx +27 -56
  64. package/src/ui/VelionOnboardingScreen.tsx +16 -13
  65. package/src/ui/forms/index.ts +1 -0
  66. package/src/ui/forms/useFieldChain.ts +63 -0
  67. package/src/ui/keyboard.tsx +196 -0
  68. package/src/ui/screenInsets.ts +89 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @fileoverview Keyboard handling, with `react-native-keyboard-controller` as
3
+ * an *optional* accelerator (OSDKR-14).
4
+ *
5
+ * Why this file exists: under Android edge-to-edge — the default since Expo
6
+ * SDK 54, and forced on Android 15 — the window no longer shrinks when the
7
+ * keyboard opens. `<KeyboardAvoidingView behavior={undefined}>` (React
8
+ * Native's Android default) is a no-op, so the keyboard simply covers the
9
+ * lower half of a form and the fields underneath become unreachable.
10
+ *
11
+ * Two paths, same contract:
12
+ *
13
+ * - **`react-native-keyboard-controller` present** — its `KeyboardProvider`
14
+ * is mounted at the root and `KeyboardAwareScrollView` drives the scroll,
15
+ * which keeps the focused input visible and animates in sync with the
16
+ * keyboard on both platforms.
17
+ * - **Absent** — we fall back to a plain scroll view whose content gains the
18
+ * measured keyboard height as bottom padding, so every field can still be
19
+ * scrolled into view.
20
+ *
21
+ * The library is a peer dependency the host may not have installed (it also
22
+ * pulls in `react-native-reanimated`, and both require a native rebuild), so
23
+ * it is loaded through a `require` in a try/catch — exactly like
24
+ * `react-native-safe-area-context` in `utils/useSafeAreaInsets.ts`. A host that
25
+ * skips it keeps a usable, if less polished, keyboard experience.
26
+ */
27
+ import { type ComponentProps, type ReactNode } from 'react';
28
+ import { Animated } from 'react-native';
29
+ /**
30
+ * Mounts `KeyboardProvider` when the library is installed. Required for any of
31
+ * its hooks/components to work, and a no-op wrapper otherwise. Nesting a second
32
+ * provider (a host that already mounts one) is harmless.
33
+ */
34
+ export declare function KeyboardBoundary({ children }: {
35
+ children: ReactNode;
36
+ }): import("react").JSX.Element;
37
+ /**
38
+ * Height of the on-screen keyboard, in dp, or 0 when it is closed.
39
+ *
40
+ * Prefers `react-native-keyboard-controller`'s events when the library is
41
+ * installed. This is not a nicety: on Android, React Native's own
42
+ * `keyboardDidShow` is tied to the window being resized by `adjustResize`,
43
+ * which edge-to-edge no longer does — the event can simply never fire, leaving
44
+ * a pinned footer stranded behind the keyboard. The library reads the IME
45
+ * insets directly and reports reliably on both platforms.
46
+ *
47
+ * The `Will` variants are used where available so chrome moves *with* the
48
+ * keyboard animation instead of snapping after it.
49
+ */
50
+ export declare function useKeyboardHeight(): number;
51
+ export interface FormScrollViewProps extends ComponentProps<typeof Animated.ScrollView> {
52
+ /**
53
+ * Bottom padding for the scroll content — normally the screen's safe-area
54
+ * inset. Passed as a number instead of inside `contentContainerStyle` so the
55
+ * fallback path can add the keyboard height *on top of* it.
56
+ */
57
+ contentPaddingBottom?: number | undefined;
58
+ }
59
+ /**
60
+ * Scroll container for form bodies: keeps the focused input clear of the
61
+ * keyboard through `KeyboardAwareScrollView` when it is available, and pads
62
+ * the content by the keyboard height when it is not.
63
+ *
64
+ * Kept as an `Animated.ScrollView` in both paths (passed to the library as its
65
+ * `ScrollViewComponent`) so callers can drive native-driver scroll animations —
66
+ * `StepShell`'s top fade depends on it.
67
+ */
68
+ export declare function FormScrollView({ contentContainerStyle, contentPaddingBottom, ...props }: FormScrollViewProps): import("react").JSX.Element;
69
+ //# sourceMappingURL=keyboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../src/ui/keyboard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAuB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAsB,MAAM,cAAc,CAAC;AA0C5D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAKrE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAuC1C;AAED,MAAM,WAAW,mBACf,SAAQ,cAAc,CAAC,OAAO,QAAQ,CAAC,UAAU,CAAC;IAClD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAC7B,qBAAqB,EACrB,oBAAwB,EACxB,GAAG,KAAK,EACT,EAAE,mBAAmB,+BAoCrB"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @fileoverview Chrome inset math for every full-screen surface (OSDKR-14).
3
+ *
4
+ * Pure functions, deliberately free of React and react-native imports so the
5
+ * geometry can be unit-tested. `ScreenScaffold` is the only component that
6
+ * should consume them directly — screens read the result off the scaffold.
7
+ *
8
+ * Two rules encoded here, both learned from real bugs:
9
+ *
10
+ * - **Floors.** `useSafeAreaInsets` degrades to zeros when the host strips
11
+ * `react-native-safe-area-context` or renders us outside a provider, and a
12
+ * device with no notch legitimately reports 0. A CTA flush against the
13
+ * screen edge is wrong in both cases, so every inset carries a minimum gap.
14
+ * - **The ProgressBar is chrome too.** It floats above the step content at the
15
+ * very top of the screen, so anything pinned to the top (a "back" control)
16
+ * must clear the status bar *and* the bar's own height, or the two overlap.
17
+ */
18
+ import type { EdgeInsets } from '../utils/useSafeAreaInsets';
19
+ /**
20
+ * Minimum breathing room between interactive chrome and the screen edge, used
21
+ * when the device (or a missing provider) reports a zero inset.
22
+ */
23
+ export declare const MIN_EDGE_GAP = 12;
24
+ export interface ScreenInsets {
25
+ /**
26
+ * Raw safe top inset — the status bar / notch / punch-hole. Deliberately
27
+ * *not* floored: the ProgressBar is painted flush under the status bar, and
28
+ * a floor would push it down on devices that legitimately report 0.
29
+ */
30
+ top: number;
31
+ /**
32
+ * Top inset for chrome pinned above the step content: the safe top (floored,
33
+ * because this chrome is interactive) plus the floating ProgressBar's
34
+ * height, so a "back" control never tucks under it.
35
+ */
36
+ topChrome: number;
37
+ /**
38
+ * Safe bottom inset, floored — clears the Android navigation bar (including
39
+ * the 3-button bar on edge-to-edge) and the iOS home indicator.
40
+ */
41
+ bottom: number;
42
+ left: number;
43
+ right: number;
44
+ }
45
+ /**
46
+ * Resolve the chrome insets for a full-screen surface.
47
+ *
48
+ * @param raw Device insets as reported by `react-native-safe-area-context`.
49
+ * @param progressBarHeight Height of the floating ProgressBar, or 0 when the
50
+ * flow hides it — `topChrome` collapses to `top` in that case.
51
+ */
52
+ export declare function computeScreenInsets(raw: EdgeInsets, progressBarHeight?: number): ScreenInsets;
53
+ /**
54
+ * Breathing room between a pinned CTA and whatever sits below it — the
55
+ * navigation bar, or the keyboard. Clearing the bar is not enough on its own:
56
+ * a button whose edge touches the system bar reads as clipped.
57
+ */
58
+ export declare const FOOTER_EDGE_GAP = 14;
59
+ /**
60
+ * Bottom padding for a strip pinned to the bottom of the screen (a CTA row).
61
+ *
62
+ * While the keyboard is up it must sit above the keyboard rather than the
63
+ * navigation bar — under Android edge-to-edge the window no longer shrinks, so
64
+ * the keyboard overlaps our layout and a plain safe-area inset would leave the
65
+ * CTA buried underneath it.
66
+ */
67
+ export declare function bottomChromeInset(insets: ScreenInsets, keyboardHeight: number): number;
68
+ //# sourceMappingURL=screenInsets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screenInsets.d.ts","sourceRoot":"","sources":["../../../src/ui/screenInsets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,UAAU,EACf,iBAAiB,SAAI,GACpB,YAAY,CAQd;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,MAAM,GACrB,MAAM,CAER"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velion-la/onboarding-sdk-react-native",
3
- "version": "1.1.0-beta.2",
3
+ "version": "1.1.0-beta.3",
4
4
  "description": "Native React Native SDK for the Velion Onboarding (KYC) flow: ID document OCR, passive + active liveness, device fingerprint, OTP verification, address picker, and personal / legal information forms.",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -73,6 +73,7 @@
73
73
  "expo": ">=54.0.0",
74
74
  "react": ">=19.0.0",
75
75
  "react-native": ">=0.81.0",
76
+ "react-native-keyboard-controller": ">=1.18.0",
76
77
  "react-native-maps": ">=1.20.0",
77
78
  "react-native-safe-area-context": ">=4.0.0",
78
79
  "react-native-svg": ">=15.0.0",
@@ -82,6 +83,9 @@
82
83
  "@fingerprintjs/fingerprintjs-pro-react-native": {
83
84
  "optional": true
84
85
  },
86
+ "react-native-keyboard-controller": {
87
+ "optional": true
88
+ },
85
89
  "react-native-maps": {
86
90
  "optional": true
87
91
  }
@@ -29,6 +29,7 @@ import { Input } from '../ui/primitives/Input';
29
29
  import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
30
30
  import { RetryDialog } from '../ui/overlays/RetryDialog';
31
31
  import { StepShell } from '../ui/StepShell';
32
+ import { useFieldChain } from '../ui/forms';
32
33
  import { HomeHeartIcon } from '../ui/icons/HomeHeartIcon';
33
34
  import { MapFallbackBoundary } from '../ui/MapFallbackBoundary';
34
35
  import { useTheme } from '../ui/theme';
@@ -288,6 +289,9 @@ interface DetailsFormProps {
288
289
  onBack: () => void;
289
290
  }
290
291
 
292
+ /** Visual order of the assisted flow's detail inputs, for "next" chaining. */
293
+ const DETAILS_FIELD_ORDER = ['floor', 'apartment', 'details'] as const;
294
+
291
295
  function AddressDetailsForm({
292
296
  api,
293
297
  sessionId,
@@ -301,6 +305,7 @@ function AddressDetailsForm({
301
305
  }: DetailsFormProps) {
302
306
  const t = getStrings(locale);
303
307
  const theme = useTheme();
308
+ const { field } = useFieldChain(DETAILS_FIELD_ORDER);
304
309
  const [floor, setFloor] = useState(() => prefillString(prefill, 'floor'));
305
310
  const [apartment, setApartment] = useState(() =>
306
311
  prefillString(prefill, 'apartment'),
@@ -385,6 +390,7 @@ function AddressDetailsForm({
385
390
  autoCorrect={false}
386
391
  value={floor}
387
392
  onChangeText={setFloor}
393
+ {...field('floor')}
388
394
  />
389
395
  </View>
390
396
  <View style={styles.col}>
@@ -393,6 +399,7 @@ function AddressDetailsForm({
393
399
  autoCorrect={false}
394
400
  value={apartment}
395
401
  onChangeText={setApartment}
402
+ {...field('apartment')}
396
403
  />
397
404
  </View>
398
405
  </View>
@@ -403,6 +410,7 @@ function AddressDetailsForm({
403
410
  numberOfLines={3}
404
411
  value={details}
405
412
  onChangeText={setDetails}
413
+ {...field('details')}
406
414
  />
407
415
  {bannerError ? <Banner message={bannerError} /> : null}
408
416
  <View style={styles.row}>
@@ -448,6 +456,21 @@ type FieldKey =
448
456
 
449
457
  type ManualForm = Record<FieldKey, string>;
450
458
 
459
+ /** Visual order of the manual form's text inputs, for keyboard "next" chaining.
460
+ * Module-level so the chain callback stays stable across renders. */
461
+ const MANUAL_FIELD_ORDER = [
462
+ 'state',
463
+ 'city',
464
+ 'district',
465
+ 'neighborhood',
466
+ 'street',
467
+ 'number',
468
+ 'zip_code',
469
+ 'floor',
470
+ 'apartment',
471
+ 'details',
472
+ ] as const;
473
+
451
474
  function ManualAddressForm({
452
475
  api,
453
476
  sessionId,
@@ -460,6 +483,10 @@ function ManualAddressForm({
460
483
  }: ViewProps) {
461
484
  const t = getStrings(locale);
462
485
  const f = stepConfig?.fields;
486
+ // "Next" on the keyboard walks down the form (and the scroll follows the
487
+ // focused input); only the last field closes it, which is what brings the
488
+ // submit button back into reach (OSDKR-14).
489
+ const { field } = useFieldChain(MANUAL_FIELD_ORDER);
463
490
 
464
491
  const allowedCodes = useMemo(() => {
465
492
  const allow = stepConfig?.country_allow;
@@ -622,6 +649,7 @@ function ManualAddressForm({
622
649
  value={form.state}
623
650
  onChangeText={(v) => setField('state', v)}
624
651
  errorMessage={errors.state ?? null}
652
+ {...field('state')}
625
653
  />
626
654
  <Input
627
655
  label={t.address_info.city}
@@ -631,6 +659,7 @@ function ManualAddressForm({
631
659
  value={form.city}
632
660
  onChangeText={(v) => setField('city', v)}
633
661
  errorMessage={errors.city ?? null}
662
+ {...field('city')}
634
663
  />
635
664
  <Input
636
665
  label={t.address_info.district}
@@ -640,6 +669,7 @@ function ManualAddressForm({
640
669
  value={form.district}
641
670
  onChangeText={(v) => setField('district', v)}
642
671
  errorMessage={errors.district ?? null}
672
+ {...field('district')}
643
673
  />
644
674
  <Input
645
675
  label={t.address_info.neighborhood}
@@ -649,6 +679,7 @@ function ManualAddressForm({
649
679
  value={form.neighborhood}
650
680
  onChangeText={(v) => setField('neighborhood', v)}
651
681
  errorMessage={errors.neighborhood ?? null}
682
+ {...field('neighborhood')}
652
683
  />
653
684
  <Input
654
685
  label={t.address_info.street}
@@ -658,6 +689,7 @@ function ManualAddressForm({
658
689
  value={form.street}
659
690
  onChangeText={(v) => setField('street', v)}
660
691
  errorMessage={errors.street ?? null}
692
+ {...field('street')}
661
693
  />
662
694
  <View style={styles.row}>
663
695
  <View style={styles.col}>
@@ -669,6 +701,7 @@ function ManualAddressForm({
669
701
  value={form.number}
670
702
  onChangeText={(v) => setField('number', v)}
671
703
  errorMessage={errors.number ?? null}
704
+ {...field('number')}
672
705
  />
673
706
  </View>
674
707
  <View style={styles.col}>
@@ -680,6 +713,7 @@ function ManualAddressForm({
680
713
  value={form.zip_code}
681
714
  onChangeText={(v) => setField('zip_code', v)}
682
715
  errorMessage={errors.zip_code ?? null}
716
+ {...field('zip_code')}
683
717
  />
684
718
  </View>
685
719
  </View>
@@ -690,6 +724,7 @@ function ManualAddressForm({
690
724
  autoCorrect={false}
691
725
  value={form.floor}
692
726
  onChangeText={(v) => setField('floor', v)}
727
+ {...field('floor')}
693
728
  />
694
729
  </View>
695
730
  <View style={styles.col}>
@@ -698,6 +733,7 @@ function ManualAddressForm({
698
733
  autoCorrect={false}
699
734
  value={form.apartment}
700
735
  onChangeText={(v) => setField('apartment', v)}
736
+ {...field('apartment')}
701
737
  />
702
738
  </View>
703
739
  </View>
@@ -708,6 +744,7 @@ function ManualAddressForm({
708
744
  numberOfLines={3}
709
745
  value={form.details}
710
746
  onChangeText={(v) => setField('details', v)}
747
+ {...field('details')}
711
748
  />
712
749
  {bannerError ? <Banner message={bannerError} /> : null}
713
750
  <Button
@@ -42,6 +42,7 @@ import { Banner } from '../ui/primitives/Banner';
42
42
  import { Button } from '../ui/primitives/Button';
43
43
  import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
44
44
  import { RetryDialog } from '../ui/overlays/RetryDialog';
45
+ import { ScreenScaffold } from '../ui/ScreenScaffold';
45
46
  import { StepShell } from '../ui/StepShell';
46
47
  import { StepIcon } from '../ui/icons/StepIcon';
47
48
  import { useTheme, mixHex } from '../ui/theme';
@@ -280,11 +281,51 @@ function DocumentsOcrView({
280
281
  setPhase(side === 'FRONT' ? 'captureFront' : 'captureBack');
281
282
  return <View />;
282
283
  }
284
+ // The actions live in the scaffold's footer so they always clear the
285
+ // Android navigation bar / iOS home indicator, and the title clears the
286
+ // status bar + ProgressBar (OSDKR-14).
283
287
  return (
284
- <View style={[styles.reviewRoot, { backgroundColor: theme.backgroundColor }]}>
285
- <Text style={[styles.reviewTitle, { color: theme.textColor }]}>
286
- {side === 'FRONT' ? t.documents_ocr.frontTitle : t.documents_ocr.backTitle}
287
- </Text>
288
+ <ScreenScaffold
289
+ contentStyle={styles.reviewRoot}
290
+ header={
291
+ <Text style={[styles.reviewTitle, { color: theme.textColor }]}>
292
+ {side === 'FRONT'
293
+ ? t.documents_ocr.frontTitle
294
+ : t.documents_ocr.backTitle}
295
+ </Text>
296
+ }
297
+ footer={
298
+ <View style={styles.reviewActions}>
299
+ <Button
300
+ variant="ghost"
301
+ label={t.documents_ocr.retakeBtn}
302
+ onPress={() =>
303
+ setPhase(side === 'FRONT' ? 'captureFront' : 'captureBack')
304
+ }
305
+ fullWidth={false}
306
+ style={styles.reviewBtn}
307
+ />
308
+ <Button
309
+ label={
310
+ side === 'FRONT'
311
+ ? t.documents_ocr.confirmFront
312
+ : t.documents_ocr.confirmBack
313
+ }
314
+ onPress={() => {
315
+ if (side === 'FRONT') {
316
+ setPhase('captureBack');
317
+ } else {
318
+ void submit();
319
+ }
320
+ }}
321
+ loading={Boolean(busyLabel)}
322
+ disabled={Boolean(busyLabel)}
323
+ fullWidth={false}
324
+ style={styles.reviewBtn}
325
+ />
326
+ </View>
327
+ }
328
+ >
288
329
  <View
289
330
  style={styles.previewWrap}
290
331
  onLayout={(e) =>
@@ -320,37 +361,8 @@ function DocumentsOcrView({
320
361
  ) : null}
321
362
  </View>
322
363
  {bannerError ? <Banner message={bannerError} /> : null}
323
- <View style={styles.reviewActions}>
324
- <Button
325
- variant="ghost"
326
- label={t.documents_ocr.retakeBtn}
327
- onPress={() =>
328
- setPhase(side === 'FRONT' ? 'captureFront' : 'captureBack')
329
- }
330
- fullWidth={false}
331
- style={styles.reviewBtn}
332
- />
333
- <Button
334
- label={
335
- side === 'FRONT'
336
- ? t.documents_ocr.confirmFront
337
- : t.documents_ocr.confirmBack
338
- }
339
- onPress={() => {
340
- if (side === 'FRONT') {
341
- setPhase('captureBack');
342
- } else {
343
- void submit();
344
- }
345
- }}
346
- loading={Boolean(busyLabel)}
347
- disabled={Boolean(busyLabel)}
348
- fullWidth={false}
349
- style={styles.reviewBtn}
350
- />
351
- </View>
352
364
  {busyLabel ? <LoadingOverlay message={busyLabel} /> : null}
353
- </View>
365
+ </ScreenScaffold>
354
366
  );
355
367
  }
356
368
 
@@ -590,9 +602,11 @@ const styles = StyleSheet.create({
590
602
  fontSize: 14,
591
603
  lineHeight: 20,
592
604
  },
605
+ // Vertical rhythm only — the scaffold owns the safe-area padding, and its
606
+ // gutter aligns the title and the action row with this column.
593
607
  reviewRoot: {
594
- flex: 1,
595
- padding: 18,
608
+ paddingHorizontal: 18,
609
+ paddingTop: 14,
596
610
  gap: 14,
597
611
  },
598
612
  reviewTitle: {
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import { useCallback, useMemo, useState } from 'react';
21
- import { KeyboardAvoidingView, Platform, StyleSheet, Text, View } from 'react-native';
21
+ import { Keyboard, StyleSheet, Text, View } from 'react-native';
22
22
  import {
23
23
  SdkErrorCode,
24
24
  type EconomicActivitySelectionPayload,
@@ -34,6 +34,7 @@ import {
34
34
  } from '../ui/primitives/SearchableSingleSelectList';
35
35
  import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
36
36
  import { RetryDialog } from '../ui/overlays/RetryDialog';
37
+ import { ScreenScaffold } from '../ui/ScreenScaffold';
37
38
  import { useTheme } from '../ui/theme';
38
39
  import { getStrings } from '../i18n';
39
40
  import type { ApiCaller } from '../transport/api';
@@ -123,6 +124,14 @@ function EconomicActivityView({
123
124
  const [submitting, setSubmitting] = useState(false);
124
125
  const [retry, setRetry] = useState<{ message: string } | null>(null);
125
126
 
127
+ // Picking an activity ends the search, so drop the keyboard with it: the
128
+ // list collapses to the selection and "Continue" — the only thing left to do
129
+ // — comes back into reach without an extra tap to dismiss (OSDKR-14).
130
+ const handleSelect = useCallback((code: string) => {
131
+ setSelected(code);
132
+ Keyboard.dismiss();
133
+ }, []);
134
+
126
135
  const handleSubmit = useCallback(async () => {
127
136
  if (!selected) return;
128
137
  setBannerError(null);
@@ -156,56 +165,60 @@ function EconomicActivityView({
156
165
  );
157
166
  }
158
167
 
168
+ // `ScreenScaffold` owns the safe-area chrome: the back control clears the
169
+ // status bar and the ProgressBar, and the "Continue" footer clears the
170
+ // Android navigation bar / iOS home indicator — and rides above the keyboard
171
+ // while the search field has focus (OSDKR-14).
159
172
  return (
160
- <KeyboardAvoidingView
161
- style={[styles.flex, { backgroundColor: theme.backgroundColor }]}
162
- behavior={Platform.OS === 'ios' ? 'padding' : undefined}
163
- >
164
- <View style={styles.body}>
165
- {onBack ? (
166
- <BackButton label={t.common.back} onPress={onBack} disabled={submitting} />
167
- ) : null}
168
- <View style={styles.header}>
169
- <Text style={[styles.title, { color: theme.textColor }]}>
170
- {t.economic_activity.title}
171
- </Text>
172
- <Text style={[styles.subtitle, { color: theme.textSecondaryColor }]}>
173
- {t.economic_activity.subtitle}
174
- </Text>
175
- </View>
176
- <SearchableSingleSelectList
177
- items={options}
178
- value={selected}
179
- onChange={setSelected}
180
- searchPlaceholder={t.economic_activity.searchPlaceholder}
181
- emptyText={t.economic_activity.empty}
182
- disabled={submitting}
183
- style={styles.list}
184
- />
185
- {bannerError ? <Banner message={bannerError} /> : null}
186
- <View style={styles.footer}>
187
- <Button
188
- label={t.common.continue}
189
- onPress={handleSubmit}
190
- loading={submitting}
191
- disabled={submitting || !selected}
173
+ <ScreenScaffold
174
+ header={
175
+ onBack ? (
176
+ <BackButton
177
+ label={t.common.back}
178
+ onPress={onBack}
179
+ disabled={submitting}
192
180
  />
193
- </View>
181
+ ) : undefined
182
+ }
183
+ contentStyle={styles.content}
184
+ footer={
185
+ <Button
186
+ label={t.common.continue}
187
+ onPress={handleSubmit}
188
+ loading={submitting}
189
+ disabled={submitting || !selected}
190
+ />
191
+ }
192
+ >
193
+ <View style={styles.header}>
194
+ <Text style={[styles.title, { color: theme.textColor }]}>
195
+ {t.economic_activity.title}
196
+ </Text>
197
+ <Text style={[styles.subtitle, { color: theme.textSecondaryColor }]}>
198
+ {t.economic_activity.subtitle}
199
+ </Text>
194
200
  </View>
201
+ <SearchableSingleSelectList
202
+ items={options}
203
+ value={selected}
204
+ onChange={handleSelect}
205
+ searchPlaceholder={t.economic_activity.searchPlaceholder}
206
+ emptyText={t.economic_activity.empty}
207
+ disabled={submitting}
208
+ style={styles.list}
209
+ />
210
+ {bannerError ? <Banner message={bannerError} /> : null}
195
211
  {submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
196
- </KeyboardAvoidingView>
212
+ </ScreenScaffold>
197
213
  );
198
214
  }
199
215
 
200
216
  const styles = StyleSheet.create({
201
- flex: {
202
- flex: 1,
203
- },
204
- body: {
205
- flex: 1,
217
+ // Vertical padding only: the scaffold owns the safe-area chrome, and the
218
+ // horizontal gutter matches its header/footer so the three read as one column.
219
+ content: {
206
220
  paddingHorizontal: 18,
207
221
  paddingTop: 12,
208
- paddingBottom: 16,
209
222
  },
210
223
  header: {
211
224
  marginBottom: 12,
@@ -224,7 +237,4 @@ const styles = StyleSheet.create({
224
237
  list: {
225
238
  flex: 1,
226
239
  },
227
- footer: {
228
- marginTop: 12,
229
- },
230
240
  });