@marktiderman/genesis-ui-native 2.0.3 → 2.1.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 (38) hide show
  1. package/dist/{chunk-HNIEFTEL.js → chunk-F2TGDKOO.js} +2 -2
  2. package/dist/{chunk-HNIEFTEL.js.map → chunk-F2TGDKOO.js.map} +1 -1
  3. package/dist/{chunk-OMTXD7ND.js → chunk-U2SPACTV.js} +191 -76
  4. package/dist/chunk-U2SPACTV.js.map +1 -0
  5. package/dist/chunk-Z3AQYVUA.js +36 -0
  6. package/dist/chunk-Z3AQYVUA.js.map +1 -0
  7. package/dist/hooks/index.d.ts +12 -2
  8. package/dist/hooks/index.js +2 -2
  9. package/dist/index.d.ts +3 -2
  10. package/dist/index.js +3 -3
  11. package/dist/layouts/index.d.ts +110 -13
  12. package/dist/layouts/index.js +2 -2
  13. package/package.json +6 -6
  14. package/src/components/__tests__/badge.test.tsx +1 -0
  15. package/src/hooks/__tests__/use-theme-roles.test.tsx +30 -0
  16. package/src/hooks/index.ts +1 -0
  17. package/src/hooks/use-theme-roles.ts +45 -0
  18. package/src/layouts/__tests__/auth-screen.test.tsx +72 -0
  19. package/src/layouts/__tests__/auth.test.tsx +1 -0
  20. package/src/layouts/__tests__/keyboard-scroll.test.tsx +34 -0
  21. package/src/layouts/__tests__/nav-bar.test.tsx +1 -0
  22. package/src/layouts/__tests__/notifications-page-slots.test.tsx +23 -0
  23. package/src/layouts/__tests__/notifications-page.test.tsx +1 -0
  24. package/src/layouts/__tests__/screen-container.test.tsx +1 -0
  25. package/src/layouts/__tests__/settings-page-slots.test.tsx +41 -0
  26. package/src/layouts/__tests__/settings-page.test.tsx +1 -0
  27. package/src/layouts/__tests__/settings-sub-page.test.tsx +1 -0
  28. package/src/layouts/auth-screen.tsx +138 -0
  29. package/src/layouts/auth.tsx +13 -6
  30. package/src/layouts/index.ts +7 -1
  31. package/src/layouts/keyboard.tsx +39 -0
  32. package/src/layouts/notifications-page.tsx +63 -35
  33. package/src/layouts/screen-container.tsx +5 -1
  34. package/src/layouts/settings-page.tsx +122 -55
  35. package/src/layouts/settings-sub-page.tsx +21 -0
  36. package/dist/chunk-N4WHTQIO.js +0 -20
  37. package/dist/chunk-N4WHTQIO.js.map +0 -1
  38. package/dist/chunk-OMTXD7ND.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { renderHook } from "@testing-library/react";
3
+ import { Platform } from "react-native";
4
+ import { useThemeRoles } from "../use-theme-roles";
5
+
6
+ describe("useThemeRoles", () => {
7
+ it("resolves neutral roles to iOS system colors and keeps the brand tint", () => {
8
+ const { result } = renderHook(() => useThemeRoles({ tint: "#123456" }));
9
+ expect(result.current.background).toEqual({ semantic: ["systemBackground"] });
10
+ expect(result.current.secondaryLabel).toEqual({ semantic: ["secondaryLabel"] });
11
+ expect(result.current.tint).toBe("#123456");
12
+ });
13
+
14
+ it("uses Material You only on Android 12+ when asked", () => {
15
+ const os = Platform.OS;
16
+ const version = Platform.Version;
17
+ try {
18
+ Platform.OS = "android";
19
+ Platform.Version = 34;
20
+ const { result } = renderHook(() => useThemeRoles({ materialYou: true }));
21
+ expect(result.current.background).toEqual({ semantic: ["@android:color/system_neutral1_10"] });
22
+ Platform.Version = 30;
23
+ const { result: old } = renderHook(() => useThemeRoles({ materialYou: true }));
24
+ expect(typeof old.current.background).toBe("string");
25
+ } finally {
26
+ Platform.OS = os;
27
+ Platform.Version = version;
28
+ }
29
+ });
30
+ });
@@ -8,6 +8,7 @@
8
8
 
9
9
  export { useReducedMotion } from "./use-reduced-motion";
10
10
  export { useThemeMode, type ThemeMode } from "./use-theme-mode";
11
+ export { useThemeRoles, type ThemeRoleColors, type UseThemeRolesOptions } from "./use-theme-roles";
11
12
  export {
12
13
  BrandExtensionsProvider,
13
14
  useGenesisExtension,
@@ -0,0 +1,45 @@
1
+ /**
2
+ * useThemeRoles — the theme roles (background, label, separator, tint…) as
3
+ * colors for this platform and color scheme.
4
+ *
5
+ * On iOS every neutral role is a system color through `PlatformColor`, so a
6
+ * screen follows light and dark mode, increased contrast and accessibility
7
+ * settings like the system apps. On Android the roles are the Genesis tokens
8
+ * for the current scheme, or Material You colors on Android 12+ with
9
+ * `materialYou`. A brand sets `tint`.
10
+ *
11
+ * Use it for `style` props and anything Tailwind classes don't reach, such as
12
+ * navigation header and tab bar options.
13
+ *
14
+ * @stability Beta
15
+ */
16
+ import { useMemo } from "react";
17
+ import { Platform, PlatformColor, type ColorValue } from "react-native";
18
+ import { resolveThemeRoles, type ThemeRole } from "@marktiderman/genesis-design-system";
19
+ import { useThemeMode } from "./use-theme-mode";
20
+
21
+ export type ThemeRoleColors = Record<ThemeRole, ColorValue>;
22
+
23
+ export interface UseThemeRolesOptions {
24
+ /** The brand's primary color. */
25
+ tint?: string;
26
+ /** On Android 12+, use Material You dynamic colors for the neutral roles (and the tint, unless `tint` is set). Ignored elsewhere. */
27
+ materialYou?: boolean;
28
+ }
29
+
30
+ export function useThemeRoles(options: UseThemeRolesOptions = {}): ThemeRoleColors {
31
+ const scheme = useThemeMode();
32
+ const { tint, materialYou = false } = options;
33
+ const androidDynamic = materialYou && Platform.OS === "android" && Number(Platform.Version) >= 31;
34
+ return useMemo(
35
+ () =>
36
+ resolveThemeRoles<ColorValue>({
37
+ target: Platform.OS === "ios" ? "ios" : "android",
38
+ scheme,
39
+ platformColor: (name) => PlatformColor(name),
40
+ tint,
41
+ androidDynamic,
42
+ }),
43
+ [scheme, tint, androidDynamic],
44
+ );
45
+ }
@@ -0,0 +1,72 @@
1
+ // @feat:native-components
2
+ import { fireEvent, render, screen } from "@testing-library/react";
3
+ import { describe, expect, it, vi } from "vitest";
4
+ import { Text } from "react-native";
5
+ import { AuthScreen, type AuthScreenSlotMap } from "../auth-screen";
6
+
7
+ const form = { onSubmit: vi.fn() };
8
+
9
+ describe("AuthScreen", () => {
10
+ it("assembles branding, providers, the form, forgot password and a footer", () => {
11
+ const onForgot = vi.fn();
12
+ render(
13
+ <AuthScreen
14
+ branding={{ headline: "Welcome back" }}
15
+ providers={[{ id: "apple", label: "Continue with Apple", onPress: () => {} }]}
16
+ form={form}
17
+ onForgotPassword={onForgot}
18
+ footer={<Text>Terms</Text>}
19
+ />,
20
+ );
21
+ expect(screen.getByText("Welcome back")).toBeTruthy();
22
+ expect(screen.getByText("Continue with Apple")).toBeTruthy();
23
+ expect(screen.getByTestId("auth-screen-form")).toBeTruthy();
24
+ expect(screen.getByText("Terms")).toBeTruthy();
25
+ fireEvent.click(screen.getByTestId("auth-forgot-password"));
26
+ expect(onForgot).toHaveBeenCalled();
27
+ });
28
+
29
+ it("leaves out what isn't given, and forgot password in magic-link mode", () => {
30
+ render(<AuthScreen form={{ ...form, mode: "magic-link" }} onForgotPassword={() => {}} />);
31
+ expect(screen.queryByTestId("auth-screen-social")).toBeNull();
32
+ expect(screen.queryByTestId("auth-forgot-password")).toBeNull();
33
+ expect(screen.getByTestId("auth-screen-form")).toBeTruthy();
34
+ });
35
+
36
+ it("replaces or drops a part through slots", () => {
37
+ const Social = ({ providers }: AuthScreenSlotMap["social"]) => <Text>{`${providers.length} custom`}</Text>;
38
+ render(
39
+ <AuthScreen
40
+ branding={{ headline: "Hi" }}
41
+ providers={[{ id: "g", label: "Google", onPress: () => {} }]}
42
+ form={form}
43
+ slots={{ social: Social, branding: null }}
44
+ />,
45
+ );
46
+ expect(screen.getByText("1 custom")).toBeTruthy();
47
+ expect(screen.queryByText("Hi")).toBeNull();
48
+ });
49
+ });
50
+
51
+ describe("AuthScreen review fixes", () => {
52
+ it("moves focus to the password field when return is pressed on email", () => {
53
+ render(<AuthScreen form={form} />);
54
+ fireEvent.keyDown(screen.getByTestId("auth-screen-form-email"), { key: "Enter" });
55
+ expect(document.activeElement).toBe(screen.getByTestId("auth-screen-form-password"));
56
+ });
57
+
58
+ it("warns once on iOS when a third-party provider has no Sign in with Apple beside it", () => {
59
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
60
+ const github = [{ id: "github", label: "GitHub", onPress: () => {} }];
61
+ render(<AuthScreen form={form} providers={github} />);
62
+ render(<AuthScreen form={form} providers={github} />);
63
+ expect(warn).toHaveBeenCalledTimes(1);
64
+ expect(warn.mock.calls[0]![0]).toContain("4.8");
65
+ warn.mockRestore();
66
+ });
67
+
68
+ it("stays above the keyboard", () => {
69
+ render(<AuthScreen form={form} />);
70
+ expect(screen.getByTestId("auth-screen-kav")).toBeTruthy();
71
+ });
72
+ });
@@ -1,3 +1,4 @@
1
+ // @feat:native-layouts
1
2
  import { fireEvent, render, screen } from "@testing-library/react";
2
3
  import { describe, expect, it, vi } from "vitest";
3
4
  import {
@@ -0,0 +1,34 @@
1
+ // @feat:native-layouts
2
+ import { render, screen } from "@testing-library/react";
3
+ import { describe, expect, it, vi } from "vitest";
4
+ import { View } from "react-native";
5
+ import { AuthScreen } from "../auth-screen";
6
+ import { SettingsSubPage } from "../settings-sub-page";
7
+ import { KeyboardScrollProvider, type KeyboardScrollProps } from "../keyboard";
8
+
9
+ const Aware = ({ children, testID }: KeyboardScrollProps) => <View testID={testID}>{children}</View>;
10
+
11
+ describe("KeyboardScrollProvider", () => {
12
+ it("puts AuthScreen in the app's keyboard-aware scroll view", () => {
13
+ render(
14
+ <KeyboardScrollProvider component={Aware}>
15
+ <AuthScreen form={{ onSubmit: vi.fn() }} />
16
+ </KeyboardScrollProvider>,
17
+ );
18
+ expect(screen.getByTestId("auth-screen-keyboard")).toBeTruthy();
19
+ expect(screen.queryByTestId("auth-screen-kav")).toBeNull();
20
+ expect(screen.getByTestId("auth-screen-form")).toBeTruthy();
21
+ });
22
+
23
+ it("puts SettingsSubPage in it too, and falls back without a provider", () => {
24
+ const { unmount } = render(
25
+ <KeyboardScrollProvider component={Aware}>
26
+ <SettingsSubPage testID="sub">{null}</SettingsSubPage>
27
+ </KeyboardScrollProvider>,
28
+ );
29
+ expect(screen.getByTestId("sub-keyboard")).toBeTruthy();
30
+ unmount();
31
+ render(<SettingsSubPage testID="sub">{null}</SettingsSubPage>);
32
+ expect(screen.getByTestId("sub-kav")).toBeTruthy();
33
+ });
34
+ });
@@ -1,3 +1,4 @@
1
+ // @feat:native-layouts
1
2
  import { fireEvent, render, screen } from "@testing-library/react";
2
3
  import { describe, expect, it, vi } from "vitest";
3
4
  import {
@@ -0,0 +1,23 @@
1
+ // @feat:native-components
2
+ import { render, screen } from "@testing-library/react";
3
+ import { describe, expect, it } from "vitest";
4
+ import { Text } from "react-native";
5
+ import { NotificationsPage, type NotificationsPageSlotMap } from "../notifications-page";
6
+
7
+ describe("NotificationsPage slots", () => {
8
+ it("replaces the empty state", () => {
9
+ const Empty = ({ title }: NotificationsPageSlotMap["empty"]) => <Text>{`custom ${title}`}</Text>;
10
+ render(<NotificationsPage items={[]} slots={{ empty: Empty }} />);
11
+ expect(screen.getByText("custom No notifications")).toBeTruthy();
12
+ });
13
+
14
+ it("feeds the default empty state through slotProps", () => {
15
+ render(<NotificationsPage items={[]} slotProps={{ empty: { body: "All caught up." } }} />);
16
+ expect(screen.getByText("All caught up.")).toBeTruthy();
17
+ });
18
+
19
+ it("keeps the old emptyState prop working", () => {
20
+ render(<NotificationsPage items={[]} emptyState={<Text>legacy</Text>} />);
21
+ expect(screen.getByText("legacy")).toBeTruthy();
22
+ });
23
+ });
@@ -1,3 +1,4 @@
1
+ // @feat:native-layouts
1
2
  import { render, screen } from "@testing-library/react";
2
3
  import { describe, expect, it, vi } from "vitest";
3
4
  import {
@@ -1,3 +1,4 @@
1
+ // @feat:native-layouts
1
2
  import { render, screen } from "@testing-library/react";
2
3
  import { describe, expect, it } from "vitest";
3
4
  import {
@@ -0,0 +1,41 @@
1
+ // @feat:native-components
2
+ import { render, screen } from "@testing-library/react";
3
+ import { describe, expect, it } from "vitest";
4
+ import { Text, View } from "react-native";
5
+ import { SettingsPage, type SettingsPageSlotMap } from "../settings-page";
6
+
7
+ const sections = [
8
+ { id: "account", title: "Account", footnote: "Only you see this.", rows: [{ id: "name", title: "Name" }, { id: "email", title: "Email" }] },
9
+ ];
10
+
11
+ describe("SettingsPage slots", () => {
12
+ it("replaces one part and keeps the rest", () => {
13
+ const Row = ({ title, testID, isLast }: SettingsPageSlotMap["row"]) => (
14
+ <View testID={testID}>
15
+ <Text>{`custom ${title}${isLast ? " (last)" : ""}`}</Text>
16
+ </View>
17
+ );
18
+ render(<SettingsPage testID="s" sections={sections} slots={{ row: Row }} />);
19
+ expect(screen.getByText("custom Name")).toBeTruthy();
20
+ expect(screen.getByText("custom Email (last)")).toBeTruthy();
21
+ expect(screen.getByTestId("s-section-account-header")).toBeTruthy();
22
+ expect(screen.getByText("Only you see this.")).toBeTruthy();
23
+ });
24
+
25
+ it("drops a part with null", () => {
26
+ render(<SettingsPage testID="s" sections={sections} slots={{ sectionHeader: null, footnote: null }} />);
27
+ expect(screen.queryByTestId("s-section-account-header")).toBeNull();
28
+ expect(screen.queryByText("Only you see this.")).toBeNull();
29
+ expect(screen.getByTestId("s-row-name")).toBeTruthy();
30
+ });
31
+
32
+ it("feeds a default part through slotProps", () => {
33
+ render(<SettingsPage testID="s" sections={sections} slotProps={{ footnote: { text: "Overridden." } }} />);
34
+ expect(screen.getByText("Overridden.")).toBeTruthy();
35
+ });
36
+
37
+ it("gives each dangerous action a stable test id", () => {
38
+ render(<SettingsPage testID="s" sections={sections} dangerousActions={[{ label: "Sign out", onPress: () => {} }]} />);
39
+ expect(screen.getByTestId("s-danger-sign-out")).toBeTruthy();
40
+ });
41
+ });
@@ -1,3 +1,4 @@
1
+ // @feat:native-layouts
1
2
  import { fireEvent, render, screen } from "@testing-library/react";
2
3
  import { describe, expect, it, vi } from "vitest";
3
4
  import {
@@ -1,3 +1,4 @@
1
+ // @feat:native-layouts
1
2
  import { render, screen } from "@testing-library/react";
2
3
  import { describe, expect, it, vi } from "vitest";
3
4
  import {
@@ -0,0 +1,138 @@
1
+ /**
2
+ * AuthScreen — a whole sign-in screen: branding, social providers, the
3
+ * email form with a "Forgot password?" link, and a footer (terms, a
4
+ * sign-up link). It assembles the auth primitives (`AuthBranding`,
5
+ * `SocialAuthRow`, `AuthForm`, `ForgotPasswordLink`) so an app passes
6
+ * props instead of composing them.
7
+ *
8
+ * The form stays above the keyboard on small phones: with the app's
9
+ * `KeyboardScrollProvider` (react-native-keyboard-controller), else with
10
+ * `KeyboardAvoidingView`. In development, on
11
+ * iOS, it warns when a third-party provider is offered without Sign in with
12
+ * Apple (App Store Review Guideline 4.8 rejects that).
13
+ *
14
+ * Slots: replace or drop (`null`) `branding`, `social`, `form` or `footer`;
15
+ * `slotProps` feeds a default part. Composing the primitives yourself is
16
+ * still the escape hatch.
17
+ *
18
+ * @stability Beta
19
+ */
20
+ import type { ReactNode } from "react";
21
+ import { KeyboardAvoidingView, Platform, View } from "react-native";
22
+ import { renderSlot, type SlotPropsFor, type Slots } from "@marktiderman/genesis-core/slots";
23
+ import {
24
+ AuthBranding,
25
+ AuthForm,
26
+ ForgotPasswordLink,
27
+ SocialAuthRow,
28
+ type AuthBrandingProps,
29
+ type AuthFormProps,
30
+ type SocialAuthProvider,
31
+ } from "./auth";
32
+ import { ScreenContainer } from "./screen-container";
33
+ import { useKeyboardScroll } from "./keyboard";
34
+
35
+ /** The parts of an {@link AuthScreen} that `slots` and `slotProps` reach. */
36
+ export type AuthScreenSlotMap = {
37
+ branding: AuthBrandingProps;
38
+ social: { providers: SocialAuthProvider[]; testID: string };
39
+ form: AuthFormProps;
40
+ footer: { children: ReactNode; testID: string };
41
+ };
42
+
43
+ export interface AuthScreenProps {
44
+ /** Logo, headline and subhead above everything else. */
45
+ branding?: AuthBrandingProps;
46
+ /** Sign-in providers (Apple, Google…). None: no social row. */
47
+ providers?: SocialAuthProvider[];
48
+ /** The email form. */
49
+ form: AuthFormProps;
50
+ /** Adds a "Forgot password?" link below the fields (password mode only). */
51
+ onForgotPassword?: () => void;
52
+ /** Below the form: terms, a sign-up link. */
53
+ footer?: ReactNode;
54
+ /** Replace (a component) or drop (`null`) one part. */
55
+ slots?: Slots<AuthScreenSlotMap>;
56
+ /** More props for a default part, merged over what the screen passes. */
57
+ slotProps?: SlotPropsFor<AuthScreenSlotMap>;
58
+ /** testID on the root container. Default `"auth-screen"`. */
59
+ testID?: string;
60
+ }
61
+
62
+ export function AuthScreen({
63
+ branding,
64
+ providers,
65
+ form,
66
+ onForgotPassword,
67
+ footer,
68
+ slots = {},
69
+ slotProps = {},
70
+ testID = "auth-screen",
71
+ }: AuthScreenProps) {
72
+ warnIfNoAppleSignIn(providers);
73
+ const forgot =
74
+ onForgotPassword && (form.mode ?? "password") === "password" ? <ForgotPasswordLink onPress={onForgotPassword} /> : null;
75
+ const formProps: AuthFormProps = { ...form, belowFields: form.belowFields ?? forgot, testID: form.testID ?? `${testID}-form` };
76
+ const KeyboardScroll = useKeyboardScroll();
77
+ const content = (
78
+ <>
79
+ {branding ? renderSlot(AuthBranding, slots.branding, { ...branding, testID: branding.testID ?? `${testID}-branding` }, slotProps.branding) : null}
80
+ {providers?.length
81
+ ? renderSlot(DefaultSocial, slots.social, { providers, testID: `${testID}-social` }, slotProps.social)
82
+ : null}
83
+ {renderSlot(AuthForm, slots.form, formProps, slotProps.form)}
84
+ {footer ? renderSlot(DefaultFooter, slots.footer, { children: footer, testID: `${testID}-footer` }, slotProps.footer) : null}
85
+ </>
86
+ );
87
+ if (KeyboardScroll) {
88
+ return (
89
+ <ScreenContainer testID={testID}>
90
+ <KeyboardScroll
91
+ testID={`${testID}-keyboard`}
92
+ keyboardShouldPersistTaps="handled"
93
+ contentInsetAdjustmentBehavior="automatic"
94
+ bottomOffset={24}
95
+ contentContainerStyle={{ flexGrow: 1, justifyContent: "center", gap: 24, paddingHorizontal: 24, paddingVertical: 32 }}
96
+ >
97
+ {content}
98
+ </KeyboardScroll>
99
+ </ScreenContainer>
100
+ );
101
+ }
102
+ return (
103
+ <KeyboardAvoidingView testID={`${testID}-kav`} style={{ flex: 1 }} behavior={Platform.OS === "ios" ? "padding" : undefined}>
104
+ <ScreenContainer scroll keyboardShouldPersistTaps="handled" testID={testID} contentClassName="flex-grow justify-center gap-6 px-6 py-8">
105
+ {content}
106
+ </ScreenContainer>
107
+ </KeyboardAvoidingView>
108
+ );
109
+ }
110
+
111
+ declare const __DEV__: boolean | undefined;
112
+ declare const process: { env: Record<string, string | undefined> } | undefined;
113
+ const warnedNoApple = new Set<string>();
114
+
115
+ /** Development-only: App Store Review Guideline 4.8 requires Sign in with Apple alongside third-party sign-in. */
116
+ function warnIfNoAppleSignIn(providers: SocialAuthProvider[] | undefined) {
117
+ const dev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env.NODE_ENV !== "production";
118
+ if (!dev || Platform.OS !== "ios" || !providers?.length) return;
119
+ if (providers.some((p) => p.id === "apple")) return;
120
+ const ids = providers.map((p) => p.id).join(",");
121
+ if (warnedNoApple.has(ids)) return;
122
+ warnedNoApple.add(ids);
123
+ console.warn(
124
+ `[genesis] AuthScreen offers ${providers.map((p) => p.label).join(", ")} on iOS without Sign in with Apple. App Store Review Guideline 4.8 requires it; add a provider with id "apple".`,
125
+ );
126
+ }
127
+
128
+ function DefaultSocial({ providers, testID }: AuthScreenSlotMap["social"]) {
129
+ return <SocialAuthRow providers={providers} testID={testID} />;
130
+ }
131
+
132
+ function DefaultFooter({ children, testID }: AuthScreenSlotMap["footer"]) {
133
+ return (
134
+ <View testID={testID} className="items-center">
135
+ {children}
136
+ </View>
137
+ );
138
+ }
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * @stability Beta
16
16
  */
17
- import { useCallback, useState, type ReactNode } from "react";
17
+ import { useCallback, useRef, useState, type ReactNode } from "react";
18
18
  import { Pressable, Text, View } from "react-native";
19
19
  import { NativeButton } from "../components/button";
20
20
  import { NativeInput } from "../components/input";
@@ -210,6 +210,7 @@ export function AuthForm({
210
210
  const [password, setPassword] = useState("");
211
211
  const [localError, setLocalError] = useState<string | null>(null);
212
212
  const [submitting, setSubmitting] = useState(false);
213
+ const passwordRef = useRef<{ focus(): void } | null>(null);
213
214
 
214
215
  const isMagic = mode === "magic-link";
215
216
  const resolvedSubmitLabel =
@@ -270,13 +271,16 @@ export function AuthForm({
270
271
  autoCapitalize="none"
271
272
  autoCorrect={false}
272
273
  keyboardType="email-address"
274
+ textContentType="emailAddress"
275
+ autoComplete="email"
273
276
  returnKeyType={isMagic ? "send" : "next"}
274
277
  editable={!loading && !submitting}
275
- // In magic-link mode the email field is the last input, so the
276
- // return key dispatches submit. In password mode the next return
277
- // moves focus to password (default RN behavior); the password
278
- // field's onSubmitEditing handles the actual send.
279
- onSubmitEditing={isMagic ? handleSubmit : undefined}
278
+ // Magic-link mode: the email field is the last input, so return
279
+ // submits. Password mode: React Native doesn't move focus by
280
+ // itself, so return focuses the password field and keeps the
281
+ // keyboard open.
282
+ submitBehavior={isMagic ? "blurAndSubmit" : "submit"}
283
+ onSubmitEditing={isMagic ? handleSubmit : () => passwordRef.current?.focus()}
280
284
  />
281
285
  </View>
282
286
 
@@ -284,12 +288,15 @@ export function AuthForm({
284
288
  <View className="gap-1">
285
289
  <Text className="text-sm font-medium text-foreground">Password</Text>
286
290
  <NativeInput
291
+ ref={passwordRef}
287
292
  testID={`${testID}-password`}
288
293
  accessibilityLabel="Password"
289
294
  value={password}
290
295
  onChangeText={setPassword}
291
296
  placeholder="••••••••"
292
297
  secureTextEntry
298
+ textContentType="password"
299
+ autoComplete="current-password"
293
300
  autoCapitalize="none"
294
301
  autoCorrect={false}
295
302
  returnKeyType="send"
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Layer-2 primitive: ScreenContainer (composable chrome).
5
5
  * Layer-3/4 layouts: SettingsPage, SettingsSubPage, NotificationsPage,
6
- * AuthForm + SocialAuthRow + AuthBranding.
6
+ * AuthScreen (assembled from AuthForm + SocialAuthRow + AuthBranding).
7
7
  *
8
8
  * See standards/usage-doctrine.md for the Layer 1-4 progression.
9
9
  */
@@ -32,6 +32,8 @@ export {
32
32
  type SettingsPageProps,
33
33
  type SettingsPageSection,
34
34
  type SettingsPageRow,
35
+ type SettingsPageSlotMap,
36
+ type SettingsPageDangerousAction,
35
37
  } from "./settings-page";
36
38
 
37
39
  export {
@@ -45,6 +47,7 @@ export {
45
47
  NotificationsPage,
46
48
  getNotificationsPageStackOptions,
47
49
  type NotificationsPageProps,
50
+ type NotificationsPageSlotMap,
48
51
  type NotificationItem,
49
52
  } from "./notifications-page";
50
53
 
@@ -59,3 +62,6 @@ export {
59
62
  type SocialAuthProvider,
60
63
  type AuthBrandingProps,
61
64
  } from "./auth";
65
+
66
+ export { AuthScreen, type AuthScreenProps, type AuthScreenSlotMap } from "./auth-screen";
67
+ export { KeyboardScrollProvider, useKeyboardScroll, type KeyboardScrollProps } from "./keyboard";
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Keyboard-aware scrolling for form screens. Expo recommends
3
+ * react-native-keyboard-controller's `KeyboardAwareScrollView` over
4
+ * `KeyboardAvoidingView` for real apps; it is an optional peer here, so an app
5
+ * that has it passes it once:
6
+ *
7
+ * import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
8
+ * <KeyboardScrollProvider component={KeyboardAwareScrollView}>…</KeyboardScrollProvider>
9
+ *
10
+ * (The native app shell does this for you.) Without it, form screens fall back
11
+ * to `KeyboardAvoidingView`.
12
+ *
13
+ * @stability Beta
14
+ */
15
+ import { createContext, createElement, useContext, type ComponentType, type ReactNode } from "react";
16
+ import type { ViewStyle } from "react-native";
17
+
18
+ /** The props Genesis passes to a keyboard-aware scroll view. */
19
+ export interface KeyboardScrollProps {
20
+ children?: ReactNode;
21
+ testID?: string;
22
+ keyboardShouldPersistTaps?: "always" | "never" | "handled";
23
+ contentContainerStyle?: ViewStyle;
24
+ /** iOS: inset content under a translucent or large-title header, as `ScreenContainer` does. */
25
+ contentInsetAdjustmentBehavior?: "automatic" | "scrollableAxes" | "never" | "always";
26
+ /** Extra space between the focused input and the keyboard. */
27
+ bottomOffset?: number;
28
+ }
29
+
30
+ const KeyboardScrollContext = createContext<ComponentType<KeyboardScrollProps> | null>(null);
31
+
32
+ export function KeyboardScrollProvider({ component, children }: { component: ComponentType<KeyboardScrollProps>; children: ReactNode }) {
33
+ return createElement(KeyboardScrollContext.Provider, { value: component }, children);
34
+ }
35
+
36
+ /** The app's keyboard-aware scroll view, or null when none was provided. */
37
+ export function useKeyboardScroll(): ComponentType<KeyboardScrollProps> | null {
38
+ return useContext(KeyboardScrollContext);
39
+ }