@velion-la/onboarding-sdk-react-native 1.1.0-beta.1 → 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.
- package/CHANGELOG.md +16 -1
- package/README.md +40 -0
- package/lib/commonjs/camera/DocumentCapture.js +11 -0
- package/lib/commonjs/camera/DocumentCapture.js.map +1 -1
- package/lib/commonjs/steps/AddressInfoStep.js +41 -13
- package/lib/commonjs/steps/AddressInfoStep.js.map +1 -1
- package/lib/commonjs/steps/DocumentsOcrStep.js +115 -90
- package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
- package/lib/commonjs/steps/EconomicActivityStep.js +53 -52
- package/lib/commonjs/steps/EconomicActivityStep.js.map +1 -1
- package/lib/commonjs/ui/ScreenScaffold.js +99 -0
- package/lib/commonjs/ui/ScreenScaffold.js.map +1 -0
- package/lib/commonjs/ui/StepShell.js +23 -42
- package/lib/commonjs/ui/StepShell.js.map +1 -1
- package/lib/commonjs/ui/VelionOnboardingScreen.js +13 -10
- package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
- package/lib/commonjs/ui/forms/index.js +7 -0
- package/lib/commonjs/ui/forms/index.js.map +1 -1
- package/lib/commonjs/ui/forms/useFieldChain.js +56 -0
- package/lib/commonjs/ui/forms/useFieldChain.js.map +1 -0
- package/lib/commonjs/ui/keyboard.js +147 -0
- package/lib/commonjs/ui/keyboard.js.map +1 -0
- package/lib/commonjs/ui/screenInsets.js +67 -0
- package/lib/commonjs/ui/screenInsets.js.map +1 -0
- package/lib/commonjs/utils/documentCrop.js +21 -0
- package/lib/commonjs/utils/documentCrop.js.map +1 -1
- package/lib/module/camera/DocumentCapture.js +11 -0
- package/lib/module/camera/DocumentCapture.js.map +1 -1
- package/lib/module/steps/AddressInfoStep.js +41 -13
- package/lib/module/steps/AddressInfoStep.js.map +1 -1
- package/lib/module/steps/DocumentsOcrStep.js +116 -90
- package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
- package/lib/module/steps/EconomicActivityStep.js +54 -53
- package/lib/module/steps/EconomicActivityStep.js.map +1 -1
- package/lib/module/ui/ScreenScaffold.js +94 -0
- package/lib/module/ui/ScreenScaffold.js.map +1 -0
- package/lib/module/ui/StepShell.js +24 -43
- package/lib/module/ui/StepShell.js.map +1 -1
- package/lib/module/ui/VelionOnboardingScreen.js +13 -10
- package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
- package/lib/module/ui/forms/index.js +1 -0
- package/lib/module/ui/forms/index.js.map +1 -1
- package/lib/module/ui/forms/useFieldChain.js +52 -0
- package/lib/module/ui/forms/useFieldChain.js.map +1 -0
- package/lib/module/ui/keyboard.js +143 -0
- package/lib/module/ui/keyboard.js.map +1 -0
- package/lib/module/ui/screenInsets.js +61 -0
- package/lib/module/ui/screenInsets.js.map +1 -0
- package/lib/module/utils/documentCrop.js +20 -0
- package/lib/module/utils/documentCrop.js.map +1 -1
- package/lib/typescript/camera/DocumentCapture.d.ts.map +1 -1
- package/lib/typescript/steps/AddressInfoStep.d.ts.map +1 -1
- package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
- package/lib/typescript/steps/EconomicActivityStep.d.ts.map +1 -1
- package/lib/typescript/ui/ScreenScaffold.d.ts +57 -0
- package/lib/typescript/ui/ScreenScaffold.d.ts.map +1 -0
- package/lib/typescript/ui/StepShell.d.ts +1 -3
- package/lib/typescript/ui/StepShell.d.ts.map +1 -1
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
- package/lib/typescript/ui/forms/index.d.ts +1 -0
- package/lib/typescript/ui/forms/index.d.ts.map +1 -1
- package/lib/typescript/ui/forms/useFieldChain.d.ts +30 -0
- package/lib/typescript/ui/forms/useFieldChain.d.ts.map +1 -0
- package/lib/typescript/ui/keyboard.d.ts +69 -0
- package/lib/typescript/ui/keyboard.d.ts.map +1 -0
- package/lib/typescript/ui/screenInsets.d.ts +68 -0
- package/lib/typescript/ui/screenInsets.d.ts.map +1 -0
- package/lib/typescript/utils/documentCrop.d.ts +16 -0
- package/lib/typescript/utils/documentCrop.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/camera/DocumentCapture.tsx +10 -0
- package/src/steps/AddressInfoStep.tsx +37 -0
- package/src/steps/DocumentsOcrStep.tsx +138 -97
- package/src/steps/EconomicActivityStep.tsx +54 -44
- package/src/ui/ScreenScaffold.tsx +130 -0
- package/src/ui/StepShell.tsx +27 -56
- package/src/ui/VelionOnboardingScreen.tsx +16 -13
- package/src/ui/forms/index.ts +1 -0
- package/src/ui/forms/useFieldChain.ts +63 -0
- package/src/ui/keyboard.tsx +196 -0
- package/src/ui/screenInsets.ts +89 -0
- package/src/utils/documentCrop.ts +21 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressInfoStep.d.ts","sourceRoot":"","sources":["../../../src/steps/AddressInfoStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"AddressInfoStep.d.ts","sourceRoot":"","sources":["../../../src/steps/AddressInfoStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA8BH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKpD,qBAAa,eAAgB,YAAW,UAAU;IAKpC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BpB,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentsOcrStep.d.ts","sourceRoot":"","sources":["../../../src/steps/DocumentsOcrStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"DocumentsOcrStep.d.ts","sourceRoot":"","sources":["../../../src/steps/DocumentsOcrStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAyCH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAsBpD,qBAAa,gBAAiB,YAAW,UAAU;IAKrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BpB,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EconomicActivityStep.d.ts","sourceRoot":"","sources":["../../../src/steps/EconomicActivityStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"EconomicActivityStep.d.ts","sourceRoot":"","sources":["../../../src/steps/EconomicActivityStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwBH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,oBAAqB,YAAW,UAAU;IAKzC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BpB,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The one place that owns safe-area chrome for a full-screen
|
|
3
|
+
* surface (OSDKR-14).
|
|
4
|
+
*
|
|
5
|
+
* Every screen in the flow is edge-to-edge: the content fills the window and
|
|
6
|
+
* the system bars are drawn over it. Getting that right means padding the
|
|
7
|
+
* chrome — never the content — by the device insets, and screens that rolled
|
|
8
|
+
* their own layout kept forgetting to (CTAs ended up under the Android
|
|
9
|
+
* navigation bar, "back" controls under the status bar and the ProgressBar).
|
|
10
|
+
*
|
|
11
|
+
* `ScreenScaffold` makes that structural instead of a thing to remember:
|
|
12
|
+
*
|
|
13
|
+
* ┌──────────────────────────┐
|
|
14
|
+
* │ header (padded by topChrome: status bar + ProgressBar)
|
|
15
|
+
* ├──────────────────────────┤
|
|
16
|
+
* │ children (flex, untouched — cameras/maps stay full-bleed)
|
|
17
|
+
* ├──────────────────────────┤
|
|
18
|
+
* │ footer (padded by the bottom inset, lifted over the keyboard)
|
|
19
|
+
* └──────────────────────────┘
|
|
20
|
+
*
|
|
21
|
+
* `StepShell` is the scrollable variant built on top of this — form steps go
|
|
22
|
+
* through it. Screens with a pinned CTA (a list plus "Continuar", a capture
|
|
23
|
+
* preview plus its actions) use the scaffold directly with a `footer`.
|
|
24
|
+
*/
|
|
25
|
+
import type { ReactNode } from 'react';
|
|
26
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
27
|
+
import { type ScreenInsets } from './screenInsets';
|
|
28
|
+
/** Horizontal gutter shared by the header, footer and (by default) content. */
|
|
29
|
+
export declare const SCREEN_GUTTER = 18;
|
|
30
|
+
/**
|
|
31
|
+
* Chrome insets for the current screen. Prefer `<ScreenScaffold>`; reach for
|
|
32
|
+
* the hook directly only when a screen positions chrome absolutely over a
|
|
33
|
+
* full-bleed surface (the camera overlays do).
|
|
34
|
+
*/
|
|
35
|
+
export declare function useScreenInsets(): ScreenInsets;
|
|
36
|
+
export interface ScreenScaffoldProps {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Chrome pinned to the top, below the ProgressBar — typically a back
|
|
40
|
+
* control. Padded so it can never overlap the status bar or the bar itself.
|
|
41
|
+
*/
|
|
42
|
+
header?: ReactNode | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Chrome pinned to the bottom — typically the step's CTA row. Padded clear
|
|
45
|
+
* of the navigation bar / home indicator, and lifted above the keyboard
|
|
46
|
+
* while it is open.
|
|
47
|
+
*/
|
|
48
|
+
footer?: ReactNode | undefined;
|
|
49
|
+
/** Horizontal padding for header, footer and content. Defaults to 18. */
|
|
50
|
+
gutter?: number | undefined;
|
|
51
|
+
/** Extra style for the content area (between header and footer). */
|
|
52
|
+
contentStyle?: StyleProp<ViewStyle> | undefined;
|
|
53
|
+
/** Paint the theme background behind the screen. Defaults to `true`. */
|
|
54
|
+
opaque?: boolean | undefined;
|
|
55
|
+
}
|
|
56
|
+
export declare function ScreenScaffold({ children, header, footer, gutter, contentStyle, opaque, }: ScreenScaffoldProps): import("react").JSX.Element;
|
|
57
|
+
//# sourceMappingURL=ScreenScaffold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenScaffold.d.ts","sourceRoot":"","sources":["../../../src/ui/ScreenScaffold.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIhF,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAGxB,+EAA+E;AAC/E,eAAO,MAAM,aAAa,KAAK,CAAC;AAIhC;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAG9C;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,oEAAoE;IACpE,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAChD,wEAAwE;IACxE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAsB,EACtB,YAAY,EACZ,MAAa,GACd,EAAE,mBAAmB,+BAqCrB"}
|
|
@@ -12,8 +12,6 @@ export interface StepShellProps {
|
|
|
12
12
|
/** Optional icon-bearing element (e.g. SVG). Falls back to a colored disc. */
|
|
13
13
|
iconNode?: ReactNode | undefined;
|
|
14
14
|
children: ReactNode;
|
|
15
|
-
/** When true, the body is wrapped in a `KeyboardAvoidingView` (form-friendly). */
|
|
16
|
-
avoidKeyboard?: boolean | undefined;
|
|
17
15
|
/**
|
|
18
16
|
* When provided, renders a top-left "back" (chevron) control. Only reversible
|
|
19
17
|
* steps wire this — the orchestrator decides based on the backend's
|
|
@@ -25,5 +23,5 @@ export interface StepShellProps {
|
|
|
25
23
|
/** Disables the back control (e.g. while a back request is already in flight). */
|
|
26
24
|
backDisabled?: boolean | undefined;
|
|
27
25
|
}
|
|
28
|
-
export declare function StepShell({ title, subtitle, iconNode, children,
|
|
26
|
+
export declare function StepShell({ title, subtitle, iconNode, children, onBack, backLabel, backDisabled, }: StepShellProps): import("react").JSX.Element;
|
|
29
27
|
//# sourceMappingURL=StepShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepShell.d.ts","sourceRoot":"","sources":["../../../src/ui/StepShell.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StepShell.d.ts","sourceRoot":"","sources":["../../../src/ui/StepShell.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAcvC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAmB,EACnB,YAAoB,GACrB,EAAE,cAAc,+BA8HhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VelionOnboardingScreen.d.ts","sourceRoot":"","sources":["../../../src/ui/VelionOnboardingScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACT,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"VelionOnboardingScreen.d.ts","sourceRoot":"","sources":["../../../src/ui/VelionOnboardingScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACT,MAAM,UAAU,CAAC;AAgClB,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9D,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC/C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD;AAmBD,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,GACP,EAAE,2BAA2B,qBAkB7B;AA8LD,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { useInlineValidation, type FieldRule, type InlineValidationHandle, } from './useInlineValidation';
|
|
2
2
|
export { required, minLength, pattern, compose, type FieldValidator, } from './validators';
|
|
3
|
+
export { useFieldChain, type FieldChainProps } from './useFieldChain';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,SAAS,EACd,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,SAAS,EACd,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview "Next field" chaining for multi-input forms (OSDKR-14).
|
|
3
|
+
*
|
|
4
|
+
* On a long form the keyboard's action key should walk the user down the form
|
|
5
|
+
* instead of just closing: tapping it on "Street" focuses "Number", and the
|
|
6
|
+
* scroll follows the focused input. Only the last field dismisses the keyboard,
|
|
7
|
+
* which is what puts the submit button back in reach — including on a
|
|
8
|
+
* `multiline` field, where the default Android behaviour is to insert a
|
|
9
|
+
* newline and leave the user stuck behind the keyboard.
|
|
10
|
+
*
|
|
11
|
+
* Usage — declare the visual order once, as a module constant so the returned
|
|
12
|
+
* callback stays stable across renders:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const FIELDS = ['street', 'number', 'zip'] as const;
|
|
16
|
+
* const { field } = useFieldChain(FIELDS);
|
|
17
|
+
* <Input {...field('street')} … />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { type TextInput, type TextInputProps } from 'react-native';
|
|
21
|
+
export interface FieldChainProps {
|
|
22
|
+
ref: (node: TextInput | null) => void;
|
|
23
|
+
returnKeyType: TextInputProps['returnKeyType'];
|
|
24
|
+
submitBehavior: TextInputProps['submitBehavior'];
|
|
25
|
+
onSubmitEditing: () => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function useFieldChain<K extends string>(order: readonly K[]): {
|
|
28
|
+
field: (key: K) => FieldChainProps;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=useFieldChain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFieldChain.d.ts","sourceRoot":"","sources":["../../../../src/ui/forms/useFieldChain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7E,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAC/C,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IACjD,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAC5C,KAAK,EAAE,SAAS,CAAC,EAAE,GAClB;IAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,eAAe,CAAA;CAAE,CA8BxC"}
|
|
@@ -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"}
|
|
@@ -51,6 +51,22 @@ export declare function computeCutout(screenW: number, screenH: number, orientat
|
|
|
51
51
|
* clamped to the image bounds, then rounded to integers (the manipulator
|
|
52
52
|
* rejects fractional crop rects).
|
|
53
53
|
*/
|
|
54
|
+
/**
|
|
55
|
+
* Whether the guide rectangle can be mapped onto the photo at all (OSDKR-13).
|
|
56
|
+
*
|
|
57
|
+
* `computeGuideCropRect` inverts a `cover` fit, which only makes sense when the
|
|
58
|
+
* screen and the photo are in the *same* orientation space — the photo is the
|
|
59
|
+
* preview the guide was drawn over. If the two disagree (a portrait screen and
|
|
60
|
+
* a landscape photo), something upstream rotated the capture and any rect we
|
|
61
|
+
* compute would address the wrong pixels. Callers should skip the crop and
|
|
62
|
+
* upload the full photo instead of shipping a garbage region.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isGuideSpaceConsistent(params: {
|
|
65
|
+
screenW: number;
|
|
66
|
+
screenH: number;
|
|
67
|
+
imageW: number;
|
|
68
|
+
imageH: number;
|
|
69
|
+
}): boolean;
|
|
54
70
|
export declare function computeGuideCropRect(params: {
|
|
55
71
|
screenW: number;
|
|
56
72
|
screenH: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentCrop.d.ts","sourceRoot":"","sources":["../../../src/utils/documentCrop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAYD;8EAC8E;AAC9E,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,mBAAmB,GAC/B,UAAU,CAiBZ;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CAwCZ"}
|
|
1
|
+
{"version":3,"file":"documentCrop.d.ts","sourceRoot":"","sources":["../../../src/utils/documentCrop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAYD;8EAC8E;AAC9E,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,mBAAmB,GAC/B,UAAU,CAiBZ;AAED;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAIV;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CAwCZ"}
|
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.
|
|
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
|
}
|
|
@@ -252,6 +252,16 @@ export function DocumentCapture({
|
|
|
252
252
|
device={device}
|
|
253
253
|
photo
|
|
254
254
|
photoQualityBalance="quality"
|
|
255
|
+
// Lock the captured photo to the *preview's* orientation (OSDKR-13).
|
|
256
|
+
// vision-camera defaults to `outputOrientation="device"`, which emits
|
|
257
|
+
// the photo in whatever orientation the phone is physically held —
|
|
258
|
+
// even though this screen is locked to portrait and both the preview
|
|
259
|
+
// and the ID-1 guide stay portrait. A user tilting the phone sideways
|
|
260
|
+
// to frame a landscape card therefore got a photo rotated 90° from
|
|
261
|
+
// what they framed, and the guide→photo crop mapping (which is in
|
|
262
|
+
// screen space) landed on the wrong region. With `preview` the photo
|
|
263
|
+
// always comes back in the orientation the user saw.
|
|
264
|
+
outputOrientation="preview"
|
|
255
265
|
// Explicit `cover`: the guide-crop math in `computeGuideCropRect`
|
|
256
266
|
// assumes the preview center-crops the sensor frame to the screen
|
|
257
267
|
// aspect ratio. `cover` is vision-camera's default, but we pin it so
|
|
@@ -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
|