@rocapine/react-native-onboarding 1.62.0 → 1.64.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.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/hooks/index.d.ts +1 -0
- package/dist/infra/hooks/index.d.ts.map +1 -1
- package/dist/infra/hooks/index.js +3 -1
- package/dist/infra/hooks/index.js.map +1 -1
- package/dist/infra/hooks/useProgressHeaderConfig.d.ts +14 -0
- package/dist/infra/hooks/useProgressHeaderConfig.d.ts.map +1 -0
- package/dist/infra/hooks/useProgressHeaderConfig.js +24 -0
- package/dist/infra/hooks/useProgressHeaderConfig.js.map +1 -0
- package/dist/infra/preload/extractAssetUrls.d.ts.map +1 -1
- package/dist/infra/preload/extractAssetUrls.js +67 -0
- package/dist/infra/preload/extractAssetUrls.js.map +1 -1
- package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
- package/dist/infra/provider/OnboardingProvider.js +11 -0
- package/dist/infra/provider/OnboardingProvider.js.map +1 -1
- package/dist/onboarding-example.d.ts +1063 -60
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +140 -0
- package/dist/onboarding-example.js.map +1 -1
- package/dist/screens/elements/AnimatedTextElement.d.ts +7 -0
- package/dist/screens/elements/AnimatedTextElement.d.ts.map +1 -1
- package/dist/screens/elements/BaseBoxProps.d.ts +39 -0
- package/dist/screens/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/screens/elements/BaseBoxProps.js +9 -0
- package/dist/screens/elements/BaseBoxProps.js.map +1 -1
- package/dist/screens/elements/ButtonElement.d.ts +28 -0
- package/dist/screens/elements/ButtonElement.d.ts.map +1 -1
- package/dist/screens/elements/CarouselElement.d.ts +38 -0
- package/dist/screens/elements/CarouselElement.d.ts.map +1 -1
- package/dist/screens/elements/CarouselElement.js +1 -0
- package/dist/screens/elements/CarouselElement.js.map +1 -1
- package/dist/screens/elements/CheckboxGroupElement.d.ts +7 -0
- package/dist/screens/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/screens/elements/DatePickerElement.d.ts +7 -0
- package/dist/screens/elements/DatePickerElement.d.ts.map +1 -1
- package/dist/screens/elements/DrawingPadElement.d.ts +7 -0
- package/dist/screens/elements/DrawingPadElement.d.ts.map +1 -1
- package/dist/screens/elements/IconElement.d.ts +7 -0
- package/dist/screens/elements/IconElement.d.ts.map +1 -1
- package/dist/screens/elements/ImageElement.d.ts +26 -0
- package/dist/screens/elements/ImageElement.d.ts.map +1 -1
- package/dist/screens/elements/ImageElement.js +1 -0
- package/dist/screens/elements/ImageElement.js.map +1 -1
- package/dist/screens/elements/InputElement.d.ts +7 -0
- package/dist/screens/elements/InputElement.d.ts.map +1 -1
- package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts +7 -0
- package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts.map +1 -1
- package/dist/screens/elements/LottieElement.d.ts +7 -0
- package/dist/screens/elements/LottieElement.d.ts.map +1 -1
- package/dist/screens/elements/ProgressIndicatorElement.d.ts +7 -0
- package/dist/screens/elements/ProgressIndicatorElement.d.ts.map +1 -1
- package/dist/screens/elements/ProgressiveBlurImageElement.d.ts +7 -0
- package/dist/screens/elements/ProgressiveBlurImageElement.d.ts.map +1 -1
- package/dist/screens/elements/RadioGroupElement.d.ts +7 -0
- package/dist/screens/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/screens/elements/RepeatElement.d.ts +79 -0
- package/dist/screens/elements/RepeatElement.d.ts.map +1 -0
- package/dist/screens/elements/RepeatElement.js +10 -0
- package/dist/screens/elements/RepeatElement.js.map +1 -0
- package/dist/screens/elements/RichTextElement.d.ts +7 -0
- package/dist/screens/elements/RichTextElement.d.ts.map +1 -1
- package/dist/screens/elements/RiveElement.d.ts +7 -0
- package/dist/screens/elements/RiveElement.d.ts.map +1 -1
- package/dist/screens/elements/SafeAreaViewElement.d.ts +7 -0
- package/dist/screens/elements/SafeAreaViewElement.d.ts.map +1 -1
- package/dist/screens/elements/ScrollViewElement.d.ts +7 -0
- package/dist/screens/elements/ScrollViewElement.d.ts.map +1 -1
- package/dist/screens/elements/SliderElement.d.ts +7 -0
- package/dist/screens/elements/SliderElement.d.ts.map +1 -1
- package/dist/screens/elements/StackElement.d.ts +7 -0
- package/dist/screens/elements/StackElement.d.ts.map +1 -1
- package/dist/screens/elements/TextElement.d.ts +7 -0
- package/dist/screens/elements/TextElement.d.ts.map +1 -1
- package/dist/screens/elements/TypewriterTextElement.d.ts +26 -0
- package/dist/screens/elements/TypewriterTextElement.d.ts.map +1 -1
- package/dist/screens/elements/TypewriterTextElement.js +1 -0
- package/dist/screens/elements/TypewriterTextElement.js.map +1 -1
- package/dist/screens/elements/VideoElement.d.ts +7 -0
- package/dist/screens/elements/VideoElement.d.ts.map +1 -1
- package/dist/screens/elements/WheelPickerElement.d.ts +7 -0
- package/dist/screens/elements/WheelPickerElement.d.ts.map +1 -1
- package/dist/screens/elements/ZStackElement.d.ts +7 -0
- package/dist/screens/elements/ZStackElement.d.ts.map +1 -1
- package/dist/screens/types.d.ts +9 -0
- package/dist/screens/types.d.ts.map +1 -1
- package/dist/screens/types.js +9 -0
- package/dist/screens/types.js.map +1 -1
- package/dist/screens/unknownKeys.d.ts +67 -0
- package/dist/screens/unknownKeys.d.ts.map +1 -0
- package/dist/screens/unknownKeys.js +160 -0
- package/dist/screens/unknownKeys.js.map +1 -0
- package/dist/types.d.ts +88 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/extractAssetUrls.test.ts +104 -0
- package/src/__tests__/unknownKeys.test.ts +234 -0
- package/src/index.ts +8 -0
- package/src/infra/hooks/index.ts +1 -0
- package/src/infra/hooks/useProgressHeaderConfig.ts +21 -0
- package/src/infra/preload/extractAssetUrls.ts +72 -0
- package/src/infra/provider/OnboardingProvider.tsx +14 -0
- package/src/onboarding-example.ts +140 -0
- package/src/screens/elements/BaseBoxProps.ts +56 -0
- package/src/screens/elements/CarouselElement.ts +31 -0
- package/src/screens/elements/ImageElement.ts +16 -0
- package/src/screens/elements/RepeatElement.ts +80 -0
- package/src/screens/elements/TypewriterTextElement.ts +19 -0
- package/src/screens/types.ts +18 -0
- package/src/screens/unknownKeys.ts +211 -0
- package/src/types.ts +101 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { UIElementSchema } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Detection for keys placed at an element's TOP LEVEL that the schema doesn't
|
|
5
|
+
* know about.
|
|
6
|
+
*
|
|
7
|
+
* Zod strips unrecognized keys instead of rejecting them, which makes a
|
|
8
|
+
* misplaced prop completely silent: the element still parses, still renders, and
|
|
9
|
+
* the prop simply does nothing. The common case is a `BaseBoxProp` written one
|
|
10
|
+
* level too high — `animation` next to `type`/`props` rather than inside `props`
|
|
11
|
+
* — which reads as correct and is dead. One live onboarding had six such
|
|
12
|
+
* elements before anyone noticed.
|
|
13
|
+
*
|
|
14
|
+
* This is deliberately NON-FATAL and separate from parsing. Making the element
|
|
15
|
+
* schema `.strict()` would turn every already-published payload carrying a stray
|
|
16
|
+
* key into a hard parse failure, taking down whole screens to report a no-op —
|
|
17
|
+
* strictly worse than the bug. So this reports; it never rejects.
|
|
18
|
+
*
|
|
19
|
+
* The allowed key sets are derived from `UIElementSchema` itself at runtime
|
|
20
|
+
* rather than hardcoded, so they cannot drift as elements gain props.
|
|
21
|
+
*/
|
|
22
|
+
export type UnknownElementKey = {
|
|
23
|
+
/** Location in the tree, e.g. `elements[0].children[2]`. */
|
|
24
|
+
path: string;
|
|
25
|
+
elementId: string;
|
|
26
|
+
elementType: string;
|
|
27
|
+
/** The unrecognized top-level key. */
|
|
28
|
+
key: string;
|
|
29
|
+
/**
|
|
30
|
+
* Which of three quite different mistakes this is. They need different advice:
|
|
31
|
+
*
|
|
32
|
+
* • `unknown` — not a valid key anywhere on this element. Probably a typo or
|
|
33
|
+
* a prop from a different element type.
|
|
34
|
+
* • `misplaced` — a valid prop for this element, and `props` does NOT have it.
|
|
35
|
+
* Almost certainly meant to be inside `props`.
|
|
36
|
+
* • `shadowed` — a valid prop, and `props` ALREADY has it. The top-level copy
|
|
37
|
+
* is inert and the `props` one is what runs. This is the nastiest
|
|
38
|
+
* of the three: telling someone "did you mean props.animation?"
|
|
39
|
+
* is wrong here, because props.animation is right there. The real
|
|
40
|
+
* risk is editing the dead copy, seeing no change, and concluding
|
|
41
|
+
* the renderer is broken.
|
|
42
|
+
*/
|
|
43
|
+
kind: "unknown" | "misplaced" | "shadowed";
|
|
44
|
+
/** For `misplaced`/`shadowed`: where the value belongs, or already lives. */
|
|
45
|
+
suggestion?: string;
|
|
46
|
+
/**
|
|
47
|
+
* `shadowed` only — whether the live `props` value actually DIFFERS from the
|
|
48
|
+
* dead top-level copy. Two identical copies are harmless cruft; two that
|
|
49
|
+
* disagree are a trap, and only the disagreement is worth alarming about.
|
|
50
|
+
*/
|
|
51
|
+
conflicts?: boolean;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type ElementKeySets = { topLevel: Set<string>; props: Set<string> };
|
|
55
|
+
|
|
56
|
+
const zdef = (schema: any): any => schema?._zod?.def ?? schema?._def;
|
|
57
|
+
|
|
58
|
+
// Every string literal a `type` field can hold. Most variants use
|
|
59
|
+
// `z.literal("X")`, but the stack variant is `z.union([literal, literal])`.
|
|
60
|
+
const literalsOf = (schema: any): string[] => {
|
|
61
|
+
const def = zdef(schema);
|
|
62
|
+
if (!def) return [];
|
|
63
|
+
if (def.type === "literal") {
|
|
64
|
+
const values = def.values ?? (def.value !== undefined ? [def.value] : []);
|
|
65
|
+
return values.filter((v: unknown): v is string => typeof v === "string");
|
|
66
|
+
}
|
|
67
|
+
if (def.type === "union") return (def.options ?? []).flatMap(literalsOf);
|
|
68
|
+
return [];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
let registry: Map<string, ElementKeySets> | null = null;
|
|
72
|
+
|
|
73
|
+
// Built once, lazily. Any shape change in zod's internals degrades to "no
|
|
74
|
+
// registry", which makes the whole feature a no-op rather than a crash — this is
|
|
75
|
+
// a diagnostic, it must never be able to break rendering.
|
|
76
|
+
const getRegistry = (): Map<string, ElementKeySets> => {
|
|
77
|
+
if (registry) return registry;
|
|
78
|
+
const built = new Map<string, ElementKeySets>();
|
|
79
|
+
try {
|
|
80
|
+
const lazyDef = zdef(UIElementSchema);
|
|
81
|
+
const union = typeof lazyDef?.getter === "function" ? lazyDef.getter() : UIElementSchema;
|
|
82
|
+
const options = zdef(union)?.options ?? [];
|
|
83
|
+
for (const option of options) {
|
|
84
|
+
const shape = zdef(option)?.shape;
|
|
85
|
+
if (!shape) continue;
|
|
86
|
+
const propsShape = zdef(shape.props)?.shape ?? {};
|
|
87
|
+
const keySets: ElementKeySets = {
|
|
88
|
+
topLevel: new Set(Object.keys(shape)),
|
|
89
|
+
props: new Set(Object.keys(propsShape)),
|
|
90
|
+
};
|
|
91
|
+
for (const typeName of literalsOf(shape.type)) built.set(typeName, keySets);
|
|
92
|
+
}
|
|
93
|
+
} catch {
|
|
94
|
+
// fall through to whatever was built before the failure
|
|
95
|
+
}
|
|
96
|
+
registry = built;
|
|
97
|
+
return registry;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const isRecord = (v: unknown): v is Record<string, unknown> =>
|
|
101
|
+
typeof v === "object" && v !== null && !Array.isArray(v);
|
|
102
|
+
|
|
103
|
+
// Structural comparison good enough to tell "same value duplicated" from "two
|
|
104
|
+
// values that disagree". Falls back to "assume they differ" if the value can't be
|
|
105
|
+
// serialized (circular / exotic), since a false alarm is cheaper here than
|
|
106
|
+
// staying silent about a real conflict.
|
|
107
|
+
const valuesDiffer = (a: unknown, b: unknown): boolean => {
|
|
108
|
+
if (a === b) return false;
|
|
109
|
+
try {
|
|
110
|
+
return JSON.stringify(a) !== JSON.stringify(b);
|
|
111
|
+
} catch {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Walk an element tree and report unrecognized top-level keys.
|
|
118
|
+
*
|
|
119
|
+
* Elements whose `type` isn't in the schema are skipped rather than reported —
|
|
120
|
+
* an unknown element type is a parse error the union already surfaces properly,
|
|
121
|
+
* and guessing its key set would produce noise.
|
|
122
|
+
*/
|
|
123
|
+
export const collectUnknownElementKeys = (
|
|
124
|
+
elements: unknown,
|
|
125
|
+
basePath = "elements"
|
|
126
|
+
): UnknownElementKey[] => {
|
|
127
|
+
const known = getRegistry();
|
|
128
|
+
if (known.size === 0 || !Array.isArray(elements)) return [];
|
|
129
|
+
|
|
130
|
+
const found: UnknownElementKey[] = [];
|
|
131
|
+
|
|
132
|
+
const visit = (node: unknown, path: string): void => {
|
|
133
|
+
if (!isRecord(node)) return;
|
|
134
|
+
const elementType = typeof node.type === "string" ? node.type : undefined;
|
|
135
|
+
const keySets = elementType ? known.get(elementType) : undefined;
|
|
136
|
+
|
|
137
|
+
if (keySets) {
|
|
138
|
+
const props = isRecord(node.props) ? node.props : undefined;
|
|
139
|
+
for (const key of Object.keys(node)) {
|
|
140
|
+
if (keySets.topLevel.has(key)) continue;
|
|
141
|
+
|
|
142
|
+
const isValidProp = keySets.props.has(key);
|
|
143
|
+
const alreadyInProps = isValidProp && props !== undefined && key in props;
|
|
144
|
+
|
|
145
|
+
found.push({
|
|
146
|
+
path,
|
|
147
|
+
elementId: typeof node.id === "string" ? node.id : "(no id)",
|
|
148
|
+
elementType: elementType!,
|
|
149
|
+
key,
|
|
150
|
+
kind: !isValidProp ? "unknown" : alreadyInProps ? "shadowed" : "misplaced",
|
|
151
|
+
suggestion: isValidProp ? `props.${key}` : undefined,
|
|
152
|
+
conflicts: alreadyInProps ? valuesDiffer(node[key], props![key]) : undefined,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Recurse regardless of whether this node was recognized, so a stray key
|
|
158
|
+
// nested under an unknown-typed parent is still found.
|
|
159
|
+
if (Array.isArray(node.children)) {
|
|
160
|
+
node.children.forEach((child, i) => visit(child, `${path}.children[${i}]`));
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
elements.forEach((element, i) => visit(element, `${basePath}[${i}]`));
|
|
165
|
+
return found;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Same check across a whole steps array, for callers holding a fetched
|
|
170
|
+
* onboarding rather than one screen's elements. Only steps carrying
|
|
171
|
+
* `payload.elements` are inspected; other step types have no element tree.
|
|
172
|
+
*/
|
|
173
|
+
export const collectUnknownKeysInSteps = (steps: unknown): UnknownElementKey[] => {
|
|
174
|
+
if (!Array.isArray(steps)) return [];
|
|
175
|
+
return steps.flatMap((step, i) => {
|
|
176
|
+
if (!isRecord(step)) return [];
|
|
177
|
+
const payload = step.payload;
|
|
178
|
+
if (!isRecord(payload) || !Array.isArray(payload.elements)) return [];
|
|
179
|
+
const stepId = typeof step.id === "string" ? step.id : String(i);
|
|
180
|
+
return collectUnknownElementKeys(payload.elements, `step[${stepId}].elements`);
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/** Human-readable report; returns "" when there is nothing to say. */
|
|
185
|
+
export const formatUnknownElementKeys = (found: UnknownElementKey[]): string => {
|
|
186
|
+
if (found.length === 0) return "";
|
|
187
|
+
const lines = found.map((f) => {
|
|
188
|
+
const where = `${f.path} (${f.elementType} "${f.elementId}")`;
|
|
189
|
+
if (f.kind === "shadowed") {
|
|
190
|
+
// Do NOT say "did you mean props.X?" here — props.X is already there. The
|
|
191
|
+
// useful warning is which copy wins, because the trap is editing the dead
|
|
192
|
+
// one and concluding the renderer is broken.
|
|
193
|
+
return f.conflicts
|
|
194
|
+
? ` • ${where}: "${f.key}" is ignored — ${f.suggestion} is ALSO set, to a ` +
|
|
195
|
+
`different value, and that is the one taking effect. Editing this ` +
|
|
196
|
+
`top-level copy will do nothing; delete it.`
|
|
197
|
+
: ` • ${where}: "${f.key}" is ignored — ${f.suggestion} is already set to the ` +
|
|
198
|
+
`same value and is the one taking effect. Delete this top-level copy.`;
|
|
199
|
+
}
|
|
200
|
+
if (f.kind === "misplaced") {
|
|
201
|
+
return ` • ${where}: "${f.key}" is not a top-level key — did you mean ${f.suggestion}?`;
|
|
202
|
+
}
|
|
203
|
+
return ` • ${where}: unrecognized top-level key "${f.key}"`;
|
|
204
|
+
});
|
|
205
|
+
return (
|
|
206
|
+
`[onboarding] ${found.length} unrecognized top-level ` +
|
|
207
|
+
`${found.length === 1 ? "key" : "keys"} on elements. These are silently ` +
|
|
208
|
+
`dropped when the payload is parsed, so they have no effect:\n` +
|
|
209
|
+
lines.join("\n")
|
|
210
|
+
);
|
|
211
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -59,7 +59,108 @@ export interface OnboardingMetadata {
|
|
|
59
59
|
* (e.g. theme, fonts, entry point). Kept permissive — only the fields the SDK
|
|
60
60
|
* reads are typed; everything else the studio ships passes through untouched.
|
|
61
61
|
*/
|
|
62
|
+
/**
|
|
63
|
+
* Studio-authored styling for the onboarding progress header.
|
|
64
|
+
*
|
|
65
|
+
* Exists so "change the progress bar colour" is a Studio publish rather than an
|
|
66
|
+
* app release. Before this, `ProgressBar` exposed only `backgroundColor` /
|
|
67
|
+
* `progressColor` as props and hardcoded everything else (height 12, radius 10,
|
|
68
|
+
* the 1/5/1 three-column layout, paddings, back-chevron size), so a project
|
|
69
|
+
* needing a different bar forked its own component.
|
|
70
|
+
*
|
|
71
|
+
* Every field is optional; an omitted field falls back to the previous
|
|
72
|
+
* behaviour. Resolution order in `ProgressBar` is:
|
|
73
|
+
* explicit prop > this block > theme > hardcoded default
|
|
74
|
+
* This block deliberately outranks the theme because a theme-only knob could not
|
|
75
|
+
* reach the screen at all today: `ThemeProvider` is fed solely by the host's
|
|
76
|
+
* `customTheme`/`customLightTheme`/`customDarkTheme` props, and nothing in the SDK
|
|
77
|
+
* reads `configuration.theme` — the edge function delivers the field and no
|
|
78
|
+
* consumer exists, so the host theme is the only theme at runtime. Wiring
|
|
79
|
+
* `configuration.theme` into `ThemeProvider` (config below host props, mirroring
|
|
80
|
+
* the order here) is a known open item; until then this block is the only way
|
|
81
|
+
* Studio can restyle the header.
|
|
82
|
+
*/
|
|
83
|
+
export interface ProgressHeaderConfiguration {
|
|
84
|
+
/** Track (unfilled) colour. Defaults to `theme.colors.neutral.lower`. */
|
|
85
|
+
backgroundColor?: string;
|
|
86
|
+
/** Filled colour. Defaults to `theme.colors.primary`. */
|
|
87
|
+
progressColor?: string;
|
|
88
|
+
/** Track thickness in px. Defaults to 12. */
|
|
89
|
+
height?: number;
|
|
90
|
+
/** Track corner radius in px. Defaults to half the height (fully rounded). */
|
|
91
|
+
borderRadius?: number;
|
|
92
|
+
/** Horizontal padding around the whole header row in px. Defaults to 16. */
|
|
93
|
+
paddingHorizontal?: number;
|
|
94
|
+
/** Space below the bar in px. Defaults to 24. */
|
|
95
|
+
paddingBottom?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Space above the bar in px, **added on top of the top safe-area inset**.
|
|
98
|
+
* Defaults to 0.
|
|
99
|
+
*
|
|
100
|
+
* Additive rather than absolute on purpose: the inset is not optional, so a
|
|
101
|
+
* field that replaced it would let a payload push the header under the notch.
|
|
102
|
+
* `paddingBottom` has no inset to compose with, which is why only this one
|
|
103
|
+
* behaves that way.
|
|
104
|
+
*/
|
|
105
|
+
paddingTop?: number;
|
|
106
|
+
/** Gap between the back button, track and right spacer in px. Defaults to 16. */
|
|
107
|
+
gap?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Width of the track relative to the side columns, as flex units. The header is
|
|
110
|
+
* a three-column row (back button / track / spacer) that defaults to 1 / 5 / 1;
|
|
111
|
+
* this sets the middle number. Larger = wider track.
|
|
112
|
+
*/
|
|
113
|
+
trackFlex?: number;
|
|
114
|
+
/** Back-chevron colour. Defaults to `theme.colors.text.primary`. */
|
|
115
|
+
backButtonColor?: string;
|
|
116
|
+
/** Back-chevron **glyph** size in px. Defaults to 24. See `backButtonContainerSize`. */
|
|
117
|
+
backButtonSize?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Back-chevron stroke weight. Defaults to 2. Worth reaching for at small glyph
|
|
120
|
+
* sizes, where the difference between 2 and 2.5 reads as "the icon changed".
|
|
121
|
+
*/
|
|
122
|
+
backButtonStrokeWidth?: number;
|
|
123
|
+
/** Hide the back chevron even when the router can go back. Defaults to false. */
|
|
124
|
+
hideBackButton?: boolean;
|
|
125
|
+
|
|
126
|
+
// --- Back-button CONTAINER chrome -----------------------------------------
|
|
127
|
+
// The fields above style the chevron itself; these style the tappable box
|
|
128
|
+
// around it. They exist because the glyph fields alone are not enough to stop
|
|
129
|
+
// a host forking the bar, which is what this whole block is for: the one host
|
|
130
|
+
// we know forked it wraps the chevron in a 32x32 white circle with a 1px
|
|
131
|
+
// border, and with only glyph fields that had no reachable expression, so the
|
|
132
|
+
// fork survived a feature built to retire it.
|
|
133
|
+
//
|
|
134
|
+
// All unset reproduces the previous rendering exactly: a bare chevron in a
|
|
135
|
+
// `padding: 4` touchable, no fill and no border.
|
|
136
|
+
|
|
137
|
+
/** Container fill. Unset = transparent (previous behaviour). */
|
|
138
|
+
backButtonBackgroundColor?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Container border colour. Setting this alone implies `backButtonBorderWidth: 1`
|
|
141
|
+
* — RN defaults border width to 0, so a lone colour would otherwise draw
|
|
142
|
+
* nothing. Same convenience `buildShadowStyle` applies to `shadowColor`.
|
|
143
|
+
*/
|
|
144
|
+
backButtonBorderColor?: string;
|
|
145
|
+
/** Container border width in px. Defaults to 1 when `backButtonBorderColor` is set, else 0. */
|
|
146
|
+
backButtonBorderWidth?: number;
|
|
147
|
+
/**
|
|
148
|
+
* Container width AND height in px — the button is square. Setting it also
|
|
149
|
+
* centres the glyph inside the box and drops the default padding, so the
|
|
150
|
+
* rendered size is exactly this value (e.g. 32 for a 32x32 chip).
|
|
151
|
+
*/
|
|
152
|
+
backButtonContainerSize?: number;
|
|
153
|
+
/** Container corner radius in px. Half of `backButtonContainerSize` makes a circle. */
|
|
154
|
+
backButtonBorderRadius?: number;
|
|
155
|
+
}
|
|
156
|
+
|
|
62
157
|
export interface OnboardingConfiguration {
|
|
158
|
+
/**
|
|
159
|
+
* Studio-authored progress-header styling. Read directly off `configuration`
|
|
160
|
+
* (the edge function returns the whole configuration blob top-level), so it
|
|
161
|
+
* needs no backend change to start arriving.
|
|
162
|
+
*/
|
|
163
|
+
progressHeader?: ProgressHeaderConfiguration;
|
|
63
164
|
/**
|
|
64
165
|
* Id of the unique step the onboarding starts on. Read first to resolve the
|
|
65
166
|
* entry point (see `resolveStartStepNumber`). Optional; when absent or when it
|