@marktiderman/genesis-ui-native 2.0.3 → 2.2.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 (47) hide show
  1. package/README.md +52 -0
  2. package/dist/{chunk-3LK5ZJ4M.js → chunk-2WCXMJL6.js} +2 -2
  3. package/dist/{chunk-3LK5ZJ4M.js.map → chunk-2WCXMJL6.js.map} +1 -1
  4. package/dist/{chunk-HNIEFTEL.js → chunk-F2TGDKOO.js} +2 -2
  5. package/dist/{chunk-HNIEFTEL.js.map → chunk-F2TGDKOO.js.map} +1 -1
  6. package/dist/{chunk-OMTXD7ND.js → chunk-FZTUSM56.js} +267 -93
  7. package/dist/chunk-FZTUSM56.js.map +1 -0
  8. package/dist/chunk-Z3AQYVUA.js +36 -0
  9. package/dist/chunk-Z3AQYVUA.js.map +1 -0
  10. package/dist/components/index.d.ts +1 -0
  11. package/dist/components/index.js +1 -1
  12. package/dist/data/index.js +1 -1
  13. package/dist/hooks/index.d.ts +12 -2
  14. package/dist/hooks/index.js +2 -2
  15. package/dist/index.d.ts +3 -2
  16. package/dist/index.js +4 -4
  17. package/dist/layouts/index.d.ts +186 -13
  18. package/dist/layouts/index.js +2 -2
  19. package/package.json +6 -6
  20. package/src/components/__tests__/badge.test.tsx +1 -0
  21. package/src/components/textarea.tsx +1 -0
  22. package/src/hooks/__tests__/use-theme-roles.test.tsx +30 -0
  23. package/src/hooks/index.ts +1 -0
  24. package/src/hooks/use-theme-roles.ts +45 -0
  25. package/src/layouts/__tests__/apple-sign-in.test.tsx +97 -0
  26. package/src/layouts/__tests__/auth-screen.test.tsx +72 -0
  27. package/src/layouts/__tests__/auth.test.tsx +1 -0
  28. package/src/layouts/__tests__/keyboard-scroll.test.tsx +34 -0
  29. package/src/layouts/__tests__/nav-bar.test.tsx +1 -0
  30. package/src/layouts/__tests__/notifications-page-slots.test.tsx +23 -0
  31. package/src/layouts/__tests__/notifications-page.test.tsx +1 -0
  32. package/src/layouts/__tests__/screen-container.test.tsx +1 -0
  33. package/src/layouts/__tests__/settings-page-slots.test.tsx +41 -0
  34. package/src/layouts/__tests__/settings-page.test.tsx +1 -0
  35. package/src/layouts/__tests__/settings-sub-page.test.tsx +1 -0
  36. package/src/layouts/apple-sign-in.tsx +136 -0
  37. package/src/layouts/auth-screen.tsx +144 -0
  38. package/src/layouts/auth.tsx +41 -24
  39. package/src/layouts/index.ts +15 -1
  40. package/src/layouts/keyboard.tsx +39 -0
  41. package/src/layouts/notifications-page.tsx +63 -35
  42. package/src/layouts/screen-container.tsx +11 -3
  43. package/src/layouts/settings-page.tsx +122 -55
  44. package/src/layouts/settings-sub-page.tsx +21 -0
  45. package/dist/chunk-N4WHTQIO.js +0 -20
  46. package/dist/chunk-N4WHTQIO.js.map +0 -1
  47. package/dist/chunk-OMTXD7ND.js.map +0 -1
@@ -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,136 @@
1
+ /**
2
+ * Sign in with Apple for `AuthScreen` / `SocialAuthRow`, drawn with Apple's
3
+ * own `AppleAuthenticationButton` (Apple's Human Interface Guidelines require
4
+ * its button; a look-alike gets an app rejected). Nothing here imports
5
+ * `expo-apple-authentication`: pass the module in.
6
+ *
7
+ * ```tsx
8
+ * import * as AppleAuthentication from "expo-apple-authentication";
9
+ *
10
+ * <AuthScreen providers={[appleProvider({ apple: AppleAuthentication, onPress: signIn }), google]} … />
11
+ * ```
12
+ *
13
+ * `appleProvider` returns `null` off iOS or without the module, and
14
+ * `AuthScreen` skips a `null` provider, so the same line works everywhere.
15
+ *
16
+ * @stability Beta
17
+ */
18
+ import { useRef, useState, type ComponentType } from "react";
19
+ import { Platform, View, type ViewStyle } from "react-native";
20
+ import { useThemeMode } from "../hooks/use-theme-mode";
21
+ import type { SocialAuthProvider } from "./auth";
22
+
23
+ /** The parts of `expo-apple-authentication` the button uses. Pass the module itself. */
24
+ export interface AppleButtonModuleLike {
25
+ AppleAuthenticationButton: ComponentType<{
26
+ buttonType: number;
27
+ buttonStyle: number;
28
+ cornerRadius?: number;
29
+ onPress: () => void;
30
+ // The style the button is given, typed as the module types it: with `unknown` here the real
31
+ // module's button (which takes a ViewStyle) wasn't assignable under strictFunctionTypes.
32
+ style?: ViewStyle;
33
+ testID?: string;
34
+ accessibilityState?: { disabled?: boolean; busy?: boolean };
35
+ }>;
36
+ AppleAuthenticationButtonType: { SIGN_IN: number; CONTINUE: number; SIGN_UP: number };
37
+ AppleAuthenticationButtonStyle: { BLACK: number; WHITE: number; WHITE_OUTLINE: number };
38
+ }
39
+
40
+ export interface AppleSignInButtonProps {
41
+ /** `expo-apple-authentication`. */
42
+ apple: AppleButtonModuleLike;
43
+ /** Usually `() => signInWithApple(supabase, AppleAuthentication, { digest })` from `@marktiderman/genesis-supabase/native`. */
44
+ onPress: () => void | Promise<void>;
45
+ /** Apple's wording: "Sign in with Apple", "Continue with Apple" (default) or "Sign up with Apple". */
46
+ type?: "sign-in" | "continue" | "sign-up";
47
+ /** `"auto"` (default): black in light mode, white in dark, as Apple recommends. */
48
+ appearance?: "auto" | "black" | "white" | "white-outline";
49
+ /** Default 10, to sit with Genesis buttons. */
50
+ cornerRadius?: number;
51
+ /** Default 44, the recommended touch target (Apple's HIG minimum for this button is 30pt). */
52
+ height?: number;
53
+ /** Dims the button and ignores presses. It is also ignored on its own while an `onPress` promise is pending, so a second tap can't open a second sheet. */
54
+ disabled?: boolean;
55
+ testID?: string;
56
+ }
57
+
58
+ /** Apple's branded button, full width. Renders nothing off iOS. */
59
+ export function AppleSignInButton({
60
+ apple,
61
+ onPress,
62
+ type = "continue",
63
+ appearance = "auto",
64
+ cornerRadius = 10,
65
+ height = 44,
66
+ disabled,
67
+ testID = "apple-sign-in",
68
+ }: AppleSignInButtonProps) {
69
+ const mode = useThemeMode();
70
+ // A ref, not only state: two taps in the same frame both see the old state.
71
+ const pending = useRef(false);
72
+ const [busy, setBusy] = useState(false);
73
+ if (Platform.OS !== "ios") return null;
74
+ const press = async () => {
75
+ if (disabled || pending.current) return;
76
+ pending.current = true;
77
+ setBusy(true);
78
+ try {
79
+ await onPress();
80
+ } finally {
81
+ pending.current = false;
82
+ setBusy(false);
83
+ }
84
+ };
85
+ const inactive = !!disabled || busy;
86
+ const { AppleAuthenticationButton, AppleAuthenticationButtonType: Type, AppleAuthenticationButtonStyle: Style } = apple;
87
+ const buttonType = type === "sign-in" ? Type.SIGN_IN : type === "sign-up" ? Type.SIGN_UP : Type.CONTINUE;
88
+ const resolved = appearance === "auto" ? (mode === "dark" ? "white" : "black") : appearance;
89
+ const buttonStyle = resolved === "white" ? Style.WHITE : resolved === "white-outline" ? Style.WHITE_OUTLINE : Style.BLACK;
90
+ return (
91
+ <View testID={`${testID}-container`} pointerEvents={inactive ? "none" : "auto"} style={disabled ? { opacity: 0.5 } : undefined}>
92
+ <AppleAuthenticationButton
93
+ testID={testID}
94
+ buttonType={buttonType}
95
+ buttonStyle={buttonStyle}
96
+ cornerRadius={cornerRadius}
97
+ style={{ width: "100%", height }}
98
+ accessibilityState={{ disabled: inactive, busy }}
99
+ onPress={() => {
100
+ void press();
101
+ }}
102
+ />
103
+ </View>
104
+ );
105
+ }
106
+
107
+ export interface AppleProviderOptions extends Omit<AppleSignInButtonProps, "apple" | "testID"> {
108
+ /** `expo-apple-authentication`, or `undefined` where it isn't installed. */
109
+ apple: AppleButtonModuleLike | null | undefined;
110
+ /**
111
+ * The provider's `label`, used only by `AuthScreen`'s dev warning and a
112
+ * custom `social` slot. Apple's button draws and announces its own localized
113
+ * text. Default follows `type`: "Continue with Apple", "Sign in with Apple"
114
+ * or "Sign up with Apple".
115
+ */
116
+ label?: string;
117
+ }
118
+
119
+ const APPLE_LABELS = { continue: "Continue with Apple", "sign-in": "Sign in with Apple", "sign-up": "Sign up with Apple" } as const;
120
+
121
+ /**
122
+ * A `SocialAuthProvider` (id `"apple"`) that draws Apple's button, for
123
+ * `AuthScreen`'s `providers`. `null` off iOS or without the module.
124
+ *
125
+ * @stability Beta
126
+ */
127
+ export function appleProvider({ apple, label, ...button }: AppleProviderOptions): SocialAuthProvider | null {
128
+ if (Platform.OS !== "ios" || !apple) return null;
129
+ return {
130
+ id: "apple",
131
+ label: label ?? APPLE_LABELS[button.type ?? "continue"],
132
+ onPress: button.onPress,
133
+ disabled: button.disabled,
134
+ render: ({ testID, disabled }) => <AppleSignInButton apple={apple} {...button} disabled={disabled} testID={testID} />,
135
+ };
136
+ }
@@ -0,0 +1,144 @@
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). `appleProvider()`
13
+ * adds Apple's own button in one line.
14
+ *
15
+ * Slots: replace or drop (`null`) `branding`, `social`, `form` or `footer`;
16
+ * `slotProps` feeds a default part. Composing the primitives yourself is
17
+ * still the escape hatch.
18
+ *
19
+ * @stability Beta
20
+ */
21
+ import type { ReactNode } from "react";
22
+ import { KeyboardAvoidingView, Platform, View } from "react-native";
23
+ import { renderSlot, type SlotPropsFor, type Slots } from "@marktiderman/genesis-core/slots";
24
+ import {
25
+ AuthBranding,
26
+ AuthForm,
27
+ ForgotPasswordLink,
28
+ SocialAuthRow,
29
+ type AuthBrandingProps,
30
+ type AuthFormProps,
31
+ type SocialAuthProvider,
32
+ } from "./auth";
33
+ import { ScreenContainer } from "./screen-container";
34
+ import { useKeyboardScroll } from "./keyboard";
35
+
36
+ /** The parts of an {@link AuthScreen} that `slots` and `slotProps` reach. */
37
+ export type AuthScreenSlotMap = {
38
+ branding: AuthBrandingProps;
39
+ social: { providers: SocialAuthProvider[]; testID: string };
40
+ form: AuthFormProps;
41
+ footer: { children: ReactNode; testID: string };
42
+ };
43
+
44
+ export interface AuthScreenProps {
45
+ /** Logo, headline and subhead above everything else. */
46
+ branding?: AuthBrandingProps;
47
+ /**
48
+ * Sign-in providers (Apple, Google…). None: no social row. A `null` or
49
+ * `false` entry is skipped, so a platform-only provider such as
50
+ * `appleProvider(...)` (null off iOS) goes in the list as is.
51
+ */
52
+ providers?: Array<SocialAuthProvider | null | false | undefined>;
53
+ /** The email form. */
54
+ form: AuthFormProps;
55
+ /** Adds a "Forgot password?" link below the fields (password mode only). */
56
+ onForgotPassword?: () => void;
57
+ /** Below the form: terms, a sign-up link. */
58
+ footer?: ReactNode;
59
+ /** Replace (a component) or drop (`null`) one part. */
60
+ slots?: Slots<AuthScreenSlotMap>;
61
+ /** More props for a default part, merged over what the screen passes. */
62
+ slotProps?: SlotPropsFor<AuthScreenSlotMap>;
63
+ /** testID on the root container. Default `"auth-screen"`. */
64
+ testID?: string;
65
+ }
66
+
67
+ export function AuthScreen({
68
+ branding,
69
+ providers: givenProviders,
70
+ form,
71
+ onForgotPassword,
72
+ footer,
73
+ slots = {},
74
+ slotProps = {},
75
+ testID = "auth-screen",
76
+ }: AuthScreenProps) {
77
+ const providers = givenProviders?.filter((p): p is SocialAuthProvider => !!p);
78
+ warnIfNoAppleSignIn(providers);
79
+ const forgot =
80
+ onForgotPassword && (form.mode ?? "password") === "password" ? <ForgotPasswordLink onPress={onForgotPassword} /> : null;
81
+ const formProps: AuthFormProps = { ...form, belowFields: form.belowFields ?? forgot, testID: form.testID ?? `${testID}-form` };
82
+ const KeyboardScroll = useKeyboardScroll();
83
+ const content = (
84
+ <>
85
+ {branding ? renderSlot(AuthBranding, slots.branding, { ...branding, testID: branding.testID ?? `${testID}-branding` }, slotProps.branding) : null}
86
+ {providers?.length
87
+ ? renderSlot(DefaultSocial, slots.social, { providers, testID: `${testID}-social` }, slotProps.social)
88
+ : null}
89
+ {renderSlot(AuthForm, slots.form, formProps, slotProps.form)}
90
+ {footer ? renderSlot(DefaultFooter, slots.footer, { children: footer, testID: `${testID}-footer` }, slotProps.footer) : null}
91
+ </>
92
+ );
93
+ if (KeyboardScroll) {
94
+ return (
95
+ <ScreenContainer testID={testID}>
96
+ <KeyboardScroll
97
+ testID={`${testID}-keyboard`}
98
+ keyboardShouldPersistTaps="handled"
99
+ contentInsetAdjustmentBehavior="automatic"
100
+ bottomOffset={24}
101
+ contentContainerStyle={{ flexGrow: 1, justifyContent: "center", gap: 24, paddingHorizontal: 24, paddingVertical: 32 }}
102
+ >
103
+ {content}
104
+ </KeyboardScroll>
105
+ </ScreenContainer>
106
+ );
107
+ }
108
+ return (
109
+ <KeyboardAvoidingView testID={`${testID}-kav`} style={{ flex: 1 }} behavior={Platform.OS === "ios" ? "padding" : undefined}>
110
+ <ScreenContainer scroll keyboardShouldPersistTaps="handled" testID={testID} contentClassName="flex-grow justify-center gap-6 px-6 py-8">
111
+ {content}
112
+ </ScreenContainer>
113
+ </KeyboardAvoidingView>
114
+ );
115
+ }
116
+
117
+ declare const __DEV__: boolean | undefined;
118
+ declare const process: { env: Record<string, string | undefined> } | undefined;
119
+ const warnedNoApple = new Set<string>();
120
+
121
+ /** Development-only: App Store Review Guideline 4.8 requires Sign in with Apple alongside third-party sign-in. */
122
+ function warnIfNoAppleSignIn(providers: SocialAuthProvider[] | undefined) {
123
+ const dev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env.NODE_ENV !== "production";
124
+ if (!dev || Platform.OS !== "ios" || !providers?.length) return;
125
+ if (providers.some((p) => p.id === "apple")) return;
126
+ const ids = providers.map((p) => p.id).join(",");
127
+ if (warnedNoApple.has(ids)) return;
128
+ warnedNoApple.add(ids);
129
+ console.warn(
130
+ `[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 appleProvider({ apple: AppleAuthentication, onPress }) (or any provider with id "apple"). If you did, expo-apple-authentication wasn't passed in.`,
131
+ );
132
+ }
133
+
134
+ function DefaultSocial({ providers, testID }: AuthScreenSlotMap["social"]) {
135
+ return <SocialAuthRow providers={providers} testID={testID} />;
136
+ }
137
+
138
+ function DefaultFooter({ children, testID }: AuthScreenSlotMap["footer"]) {
139
+ return (
140
+ <View testID={testID} className="items-center">
141
+ {children}
142
+ </View>
143
+ );
144
+ }
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * @stability Beta
16
16
  */
17
- import { useCallback, useState, type ReactNode } from "react";
17
+ import { Fragment, 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";
@@ -92,6 +92,12 @@ export type SocialAuthProvider = {
92
92
  onPress: () => void | Promise<void>;
93
93
  /** When true, the button is disabled (e.g., loading). */
94
94
  disabled?: boolean;
95
+ /**
96
+ * Draw the provider's own button instead of the default outline button,
97
+ * for a provider whose brand rules require theirs (Apple: see
98
+ * `appleProvider`). Receives the testID the default would use.
99
+ */
100
+ render?: (props: { testID: string; disabled?: boolean }) => ReactNode;
95
101
  };
96
102
 
97
103
  export interface SocialAuthRowProps {
@@ -116,24 +122,28 @@ export function SocialAuthRow({
116
122
  return (
117
123
  <View testID={testID} className={cn("gap-3", className)}>
118
124
  <View className="gap-2">
119
- {providers.map((p) => (
120
- <NativeButton
121
- key={p.id}
122
- testID={`${testID}-${p.id}`}
123
- variant="outline"
124
- disabled={p.disabled}
125
- onPress={() => {
126
- void p.onPress();
127
- }}
128
- >
129
- <View className="flex-row items-center gap-2">
130
- {p.icon}
131
- <Text className="text-sm font-medium text-foreground">
132
- {p.label}
133
- </Text>
134
- </View>
135
- </NativeButton>
136
- ))}
125
+ {providers.map((p) =>
126
+ p.render ? (
127
+ <Fragment key={p.id}>{p.render({ testID: `${testID}-${p.id}`, disabled: p.disabled })}</Fragment>
128
+ ) : (
129
+ <NativeButton
130
+ key={p.id}
131
+ testID={`${testID}-${p.id}`}
132
+ variant="outline"
133
+ disabled={p.disabled}
134
+ onPress={() => {
135
+ void p.onPress();
136
+ }}
137
+ >
138
+ <View className="flex-row items-center gap-2">
139
+ {p.icon}
140
+ <Text className="text-sm font-medium text-foreground">
141
+ {p.label}
142
+ </Text>
143
+ </View>
144
+ </NativeButton>
145
+ ),
146
+ )}
137
147
  </View>
138
148
  {separator !== null && separator !== undefined ? (
139
149
  <View
@@ -210,6 +220,7 @@ export function AuthForm({
210
220
  const [password, setPassword] = useState("");
211
221
  const [localError, setLocalError] = useState<string | null>(null);
212
222
  const [submitting, setSubmitting] = useState(false);
223
+ const passwordRef = useRef<{ focus(): void } | null>(null);
213
224
 
214
225
  const isMagic = mode === "magic-link";
215
226
  const resolvedSubmitLabel =
@@ -270,13 +281,16 @@ export function AuthForm({
270
281
  autoCapitalize="none"
271
282
  autoCorrect={false}
272
283
  keyboardType="email-address"
284
+ textContentType="emailAddress"
285
+ autoComplete="email"
273
286
  returnKeyType={isMagic ? "send" : "next"}
274
287
  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}
288
+ // Magic-link mode: the email field is the last input, so return
289
+ // submits. Password mode: React Native doesn't move focus by
290
+ // itself, so return focuses the password field and keeps the
291
+ // keyboard open.
292
+ submitBehavior={isMagic ? "blurAndSubmit" : "submit"}
293
+ onSubmitEditing={isMagic ? handleSubmit : () => passwordRef.current?.focus()}
280
294
  />
281
295
  </View>
282
296
 
@@ -284,12 +298,15 @@ export function AuthForm({
284
298
  <View className="gap-1">
285
299
  <Text className="text-sm font-medium text-foreground">Password</Text>
286
300
  <NativeInput
301
+ ref={passwordRef}
287
302
  testID={`${testID}-password`}
288
303
  accessibilityLabel="Password"
289
304
  value={password}
290
305
  onChangeText={setPassword}
291
306
  placeholder="••••••••"
292
307
  secureTextEntry
308
+ textContentType="password"
309
+ autoComplete="current-password"
293
310
  autoCapitalize="none"
294
311
  autoCorrect={false}
295
312
  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,14 @@ 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";
68
+
69
+ export {
70
+ AppleSignInButton,
71
+ appleProvider,
72
+ type AppleButtonModuleLike,
73
+ type AppleProviderOptions,
74
+ type AppleSignInButtonProps,
75
+ } from "./apple-sign-in";
@@ -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
+ }