@vvedantb/native-ui 0.29.0 → 0.30.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/README.md CHANGED
@@ -238,7 +238,19 @@ export default function SignUp() {
238
238
  - `needs_new_password` shows a new-password step (`signIn.resetPassword`), then starts the session.
239
239
  - `onIncomplete(signIn)`: optional. Called only for statuses the built-in UI cannot finish: `needs_identifier`, `needs_first_factor` without an `email_code` or `phone_code` first factor, unknown statuses, and `needs_second_factor` or `needs_client_trust` when no supported strategy (totp, backup code, phone code, email code) exists. The built-in screen always runs `needs_second_factor`, `needs_client_trust` and `needs_new_password`, and runs `needs_first_factor` when an email or phone code exists. When `onIncomplete` is called, the screen shows no message. Without it, those statuses show "This account needs another step to sign in. Finish it on the web." and log the status and strategy ids with `console.warn`. Ignored in `sign-up`.
240
240
  - Keyboard: `AuthScreen` (and so every screen here) pads for the soft keyboard on iOS and Android, including edge-to-edge Android, and scrolls the focused field and the button above it.
241
- - No forgot-password step. An app that needs one keeps its own screen.
241
+ - Sign-up has a confirm-password field. A mismatch blocks the submit and shows "The passwords do not match" under the field, also with `errorDisplay="toast"`.
242
+ - Forgot password: `ResetPasswordScreen` (`SignInScreen` with `mode="reset-password"`, same props) on its own route, and `forgotPasswordHref` on the sign-in screen for the "Forgot password?" link.
243
+
244
+ ```tsx
245
+ // app/(auth)/sign-in.tsx
246
+ <SignInScreen scheme="myapp" signUpHref="/sign-up" forgotPasswordHref="/reset-password" />
247
+
248
+ // app/(auth)/reset-password.tsx
249
+ <ResetPasswordScreen scheme="myapp" signInHref="/sign-in" minPasswordLength={8} />
250
+ ```
251
+
252
+ It asks for the email and sends a code (`signIn.create` with `reset_password_email_code`), checks the code (`attemptFirstFactor`), then takes the new password twice (`signIn.resetPassword`) and starts the session. An account with two-step verification gets that step before the session. "Send a new code" sends another; back returns to the email form. The dashboard must have email-code password reset on. Test IDs: `reset-password-email`, `reset-password-submit`, `reset-password-email-code-code`, `reset-password-resend`, `reset-password-new-password`, `reset-password-confirm-password`, `reset-password-new-password-submit`.
253
+ - Every password field is a `PasswordInput`, so each has the show and hide button.
242
254
 
243
255
  `GoogleSignInButton` (`scheme`, `redirectPath`, `afterAuthHref`, `replaceOptions`, `onSuccess`, `onError`, `label` and the `Button` props), `AuthScreen`, `OrDivider` and `FieldError` build custom screens. The module calls `WebBrowser.maybeCompleteAuthSession()` once when it loads, so the app no longer needs its own call.
244
256
 
@@ -14,6 +14,9 @@ import { authErrorMessage, DEFAULT_STAGE_TIMEOUT_MS, isAuthTimeoutError, logAuth
14
14
  import { SecondFactorScreen } from "./SecondFactorScreen";
15
15
  import { pickFirstFactorStrategy, pickSecondFactorStrategy, prepareFirstFactorIfNeeded, submitFirstFactor, supportedFirstFactorStrategies, supportedSecondFactorStrategies, useSecondFactor } from "./totp";
16
16
  import { GoogleSignInButton } from "./GoogleSignInButton";
17
+ /** The first factor that emails a password-reset code. */
18
+ const RESET_STRATEGY = "reset_password_email_code";
19
+
17
20
  /** The messages the screen can show. Generic: none names a provider. */
18
21
  export const AUTH_MESSAGES = {
19
22
  missingFields: "Enter your email and password",
@@ -45,7 +48,17 @@ export const AUTH_MESSAGES = {
45
48
  passwordMismatch: "The passwords do not match",
46
49
  passwordTooShort: "Use a longer password",
47
50
  resetPasswordFailed: "Could not set the new password",
48
- setPassword: "Set password"
51
+ setPassword: "Set password",
52
+ missingNewPassword: "Enter a new password",
53
+ confirmSignUpPasswordLabel: "Confirm password",
54
+ forgotPassword: "Forgot password?",
55
+ resetTitle: "Reset password",
56
+ resetSubtitle: "Enter your email and we will send you a code.",
57
+ resetNewPasswordDescription: "Choose a new password for your account.",
58
+ missingEmail: "Enter your email",
59
+ sendResetCode: "Send code",
60
+ sendResetFailed: "Could not send the code",
61
+ resendCode: "Send a new code"
49
62
  };
50
63
 
51
64
  /**
@@ -94,7 +107,13 @@ function secondFactorCopy(strategy, clientTrust) {
94
107
  * code and checks it before the session starts. On success it calls
95
108
  * `onSuccess`, or `router.replace(afterAuthHref, replaceOptions)`.
96
109
  *
97
- * Forgot-password is not here: an app that needs it keeps its own screen.
110
+ * Sign-up has a confirm-password field: a mismatch blocks the submit and shows
111
+ * under the field, whatever `errorDisplay` is.
112
+ *
113
+ * `mode="reset-password"` (`ResetPasswordScreen`) is the forgot-password flow:
114
+ * email, then the emailed code, then a new password typed twice. It ends
115
+ * signed in, through the same second-factor step when the account has one.
116
+ * `forgotPasswordHref` links the sign-in form to it.
98
117
  */
99
118
  export function SignInScreen({
100
119
  mode = "sign-in",
@@ -109,6 +128,7 @@ export function SignInScreen({
109
128
  googleLabel,
110
129
  signUpHref,
111
130
  signInHref,
131
+ forgotPasswordHref,
112
132
  minPasswordLength,
113
133
  errorDisplay = "toast",
114
134
  testIDPrefix,
@@ -136,6 +156,11 @@ export function SignInScreen({
136
156
  const [pendingNewPassword, setPendingNewPassword] = useState(false);
137
157
  const [newPassword, setNewPassword] = useState("");
138
158
  const [confirmPassword, setConfirmPassword] = useState("");
159
+ const [signUpConfirm, setSignUpConfirm] = useState("");
160
+ const [mismatch, setMismatch] = useState(false);
161
+ const [pendingResetCode, setPendingResetCode] = useState(false);
162
+ const [resetLoading, setResetLoading] = useState(false);
163
+ const [resetCodeError, setResetCodeError] = useState("");
139
164
  const secondFactor = useSecondFactor({
140
165
  stageTimeoutMs
141
166
  });
@@ -145,6 +170,7 @@ export function SignInScreen({
145
170
  const passwordField = useRef(null);
146
171
  const confirmField = useRef(null);
147
172
  const signUp = mode === "sign-up";
173
+ const reset = mode === "reset-password";
148
174
  const id = name => `${testIDPrefix ?? mode}-${name}`;
149
175
  const fail = (heading, message) => {
150
176
  if (errorDisplay === "inline") setError(message);else toast.error(heading, message === heading ? undefined : {
@@ -218,9 +244,11 @@ export function SignInScreen({
218
244
  done();
219
245
  } else if (status === "needs_new_password") {
220
246
  setPendingFirstFactor(false);
247
+ setPendingResetCode(false);
221
248
  setPendingNewPassword(true);
222
249
  } else if (status === "needs_second_factor" || status === "needs_client_trust") {
223
250
  setPendingFirstFactor(false);
251
+ setPendingResetCode(false);
224
252
  await startSecondFactor(attempt_3, status === "needs_client_trust");
225
253
  } else if (status === "needs_first_factor" && afterCreate) {
226
254
  await startFirstFactor(attempt_3);
@@ -263,7 +291,7 @@ export function SignInScreen({
263
291
  setActive: setActive_0
264
292
  } = signInState;
265
293
  if (!isLoaded_0 || !signIn_1 || !setActive_0 || submitting) return;
266
- if (!newPassword) return fail(AUTH_MESSAGES.resetPasswordFailed, AUTH_MESSAGES.missingFields);
294
+ if (!newPassword) return fail(AUTH_MESSAGES.resetPasswordFailed, AUTH_MESSAGES.missingNewPassword);
267
295
  if (minPasswordLength && newPassword.length < minPasswordLength) {
268
296
  return fail(AUTH_MESSAGES.resetPasswordFailed, `Use at least ${minPasswordLength} characters for the password`);
269
297
  }
@@ -276,11 +304,17 @@ export function SignInScreen({
276
304
  const result_0 = await withAuthTimeout(signIn_1.resetPassword({
277
305
  password: newPassword
278
306
  }), "reset-password", stageTimeoutMs);
279
- if (result_0.status === "complete" && result_0.createdSessionId) {
307
+ // Clerk's `SignInStatus` omits `needs_client_trust`: widen before comparing.
308
+ const afterReset = result_0.status;
309
+ if (afterReset === "complete" && result_0.createdSessionId) {
280
310
  await withAuthTimeout(setActive_0({
281
311
  session: result_0.createdSessionId
282
312
  }), "set-active", stageTimeoutMs);
283
313
  done();
314
+ } else if (afterReset === "needs_second_factor" || afterReset === "needs_client_trust") {
315
+ // A reset on an account with two-step verification: the code step, then the session.
316
+ setPendingNewPassword(false);
317
+ await startSecondFactor(result_0, afterReset === "needs_client_trust");
284
318
  } else if (onIncomplete) {
285
319
  onIncomplete(result_0);
286
320
  } else {
@@ -319,6 +353,87 @@ export function SignInScreen({
319
353
  setSubmitting(false);
320
354
  }
321
355
  };
356
+
357
+ // Emails the reset code. Throws what the call throws.
358
+ const requestResetCode = async () => {
359
+ const {
360
+ signIn: signIn_3
361
+ } = signInState;
362
+ if (!signIn_3) return;
363
+ await withAuthTimeout(signIn_3.create({
364
+ strategy: RESET_STRATEGY,
365
+ identifier: email.trim()
366
+ }), "create", stageTimeoutMs);
367
+ };
368
+ const onResetRequest = async () => {
369
+ const {
370
+ isLoaded: isLoaded_2,
371
+ signIn: signIn_4
372
+ } = signInState;
373
+ if (!isLoaded_2 || !signIn_4 || submitting) return;
374
+ if (!email.trim()) return fail(AUTH_MESSAGES.sendResetFailed, AUTH_MESSAGES.missingEmail);
375
+ setSubmitting(true);
376
+ setError("");
377
+ try {
378
+ await requestResetCode();
379
+ setResetCodeError("");
380
+ setPendingResetCode(true);
381
+ } catch (caught_2) {
382
+ logAuthFailure("create", caught_2);
383
+ fail(AUTH_MESSAGES.sendResetFailed, authErrorMessage(caught_2, AUTH_MESSAGES.sendResetFailed));
384
+ } finally {
385
+ setSubmitting(false);
386
+ }
387
+ };
388
+ const onResetResend = async () => {
389
+ const {
390
+ isLoaded: isLoaded_3,
391
+ signIn: signIn_5
392
+ } = signInState;
393
+ if (!isLoaded_3 || !signIn_5 || resetLoading) return;
394
+ setResetLoading(true);
395
+ setResetCodeError("");
396
+ try {
397
+ await requestResetCode();
398
+ } catch (caught_3) {
399
+ logAuthFailure("create", caught_3);
400
+ setResetCodeError(authErrorMessage(caught_3, AUTH_MESSAGES.sendResetFailed));
401
+ } finally {
402
+ setResetLoading(false);
403
+ }
404
+ };
405
+
406
+ // Checks the emailed code. A good code gives `needs_new_password`, which `routeAttempt` shows.
407
+ const onResetCode = async resetCode => {
408
+ const {
409
+ isLoaded: isLoaded_4,
410
+ signIn: signIn_6
411
+ } = signInState;
412
+ if (!isLoaded_4 || !signIn_6 || resetLoading) return;
413
+ setResetLoading(true);
414
+ setResetCodeError("");
415
+ try {
416
+ const attempt_5 = await withAuthTimeout(signIn_6.attemptFirstFactor({
417
+ strategy: RESET_STRATEGY,
418
+ code: resetCode
419
+ }), "attempt-first-factor", stageTimeoutMs);
420
+ const status_0 = attempt_5.status;
421
+ const known = ["complete", "needs_new_password", "needs_second_factor", "needs_client_trust"];
422
+ if (status_0 && known.includes(status_0)) {
423
+ await routeAttempt(attempt_5, false);
424
+ } else if (onIncomplete) {
425
+ onIncomplete(attempt_5);
426
+ } else {
427
+ warnIncomplete(attempt_5);
428
+ setResetCodeError(AUTH_MESSAGES.needsAnotherStep);
429
+ }
430
+ } catch (caught_4) {
431
+ if (isAuthTimeoutError(caught_4)) logAuthFailure("attempt-first-factor", caught_4);
432
+ setResetCodeError(authErrorMessage(caught_4, AUTH_MESSAGES.verifyFailed));
433
+ } finally {
434
+ setResetLoading(false);
435
+ }
436
+ };
322
437
  const onSecondFactor = async secondFactorCode => {
323
438
  const result_1 = await secondFactor.submit(secondFactorCode);
324
439
  if (result_1.ok) done();
@@ -328,6 +443,8 @@ export function SignInScreen({
328
443
  setPendingSecondFactor(false);
329
444
  setPendingFirstFactor(false);
330
445
  setFirstError("");
446
+ setPendingResetCode(false);
447
+ setResetCodeError("");
331
448
  setPendingNewPassword(false);
332
449
  setNewPassword("");
333
450
  setConfirmPassword("");
@@ -337,43 +454,49 @@ export function SignInScreen({
337
454
  };
338
455
  const onSignUp = async () => {
339
456
  const {
340
- isLoaded: isLoaded_2,
341
- signUp: attempt_5
457
+ isLoaded: isLoaded_5,
458
+ signUp: attempt_6
342
459
  } = signUpState;
343
- if (!isLoaded_2 || !attempt_5 || submitting) return;
460
+ if (!isLoaded_5 || !attempt_6 || submitting) return;
344
461
  if (!email || !password) return fail(AUTH_MESSAGES.signUpFailed, AUTH_MESSAGES.missingFields);
345
462
  if (minPasswordLength && password.length < minPasswordLength) {
346
463
  return fail(AUTH_MESSAGES.signUpFailed, `Use at least ${minPasswordLength} characters for the password`);
347
464
  }
465
+ if (password !== signUpConfirm) {
466
+ // Always under the confirm field, also with `errorDisplay="toast"`.
467
+ setError("");
468
+ setMismatch(true);
469
+ return;
470
+ }
348
471
  setSubmitting(true);
349
472
  setError("");
350
473
  try {
351
- await attempt_5.create({
474
+ await attempt_6.create({
352
475
  emailAddress: email,
353
476
  password
354
477
  });
355
- await attempt_5.prepareEmailAddressVerification({
478
+ await attempt_6.prepareEmailAddressVerification({
356
479
  strategy: "email_code"
357
480
  });
358
481
  setPendingVerification(true);
359
- } catch (caught_2) {
360
- fail(AUTH_MESSAGES.signUpFailed, authErrorMessage(caught_2, AUTH_MESSAGES.signUpFailed));
482
+ } catch (caught_5) {
483
+ fail(AUTH_MESSAGES.signUpFailed, authErrorMessage(caught_5, AUTH_MESSAGES.signUpFailed));
361
484
  } finally {
362
485
  setSubmitting(false);
363
486
  }
364
487
  };
365
488
  const onVerify = async () => {
366
489
  const {
367
- isLoaded: isLoaded_3,
368
- signUp: attempt_6,
490
+ isLoaded: isLoaded_6,
491
+ signUp: attempt_7,
369
492
  setActive: setActive_2
370
493
  } = signUpState;
371
- if (!isLoaded_3 || !attempt_6 || !setActive_2 || submitting) return;
494
+ if (!isLoaded_6 || !attempt_7 || !setActive_2 || submitting) return;
372
495
  if (!code) return fail(AUTH_MESSAGES.verifyFailed, AUTH_MESSAGES.missingCode);
373
496
  setSubmitting(true);
374
497
  setError("");
375
498
  try {
376
- const result_2 = await attempt_6.attemptEmailAddressVerification({
499
+ const result_2 = await attempt_7.attemptEmailAddressVerification({
377
500
  code
378
501
  });
379
502
  if (result_2.status === "complete" && result_2.createdSessionId) {
@@ -384,27 +507,28 @@ export function SignInScreen({
384
507
  } else {
385
508
  fail(AUTH_MESSAGES.verifyFailed, AUTH_MESSAGES.needsAnotherStep);
386
509
  }
387
- } catch (caught_3) {
388
- fail(AUTH_MESSAGES.verifyFailed, authErrorMessage(caught_3, AUTH_MESSAGES.verifyFailed));
510
+ } catch (caught_6) {
511
+ fail(AUTH_MESSAGES.verifyFailed, authErrorMessage(caught_6, AUTH_MESSAGES.verifyFailed));
389
512
  } finally {
390
513
  setSubmitting(false);
391
514
  }
392
515
  };
393
- const linkHref = signUp ? signInHref : signUpHref;
516
+ const toSignIn = signUp || reset;
517
+ const linkHref = toSignIn ? signInHref : signUpHref;
394
518
  const footerRow = <>
395
519
  {linkHref && !pendingVerification ? <>
396
520
  <Text className="font-instrument-sans text-sm" style={textStyle("muted", colorScheme)}>
397
- {signUp ? "Already have an account?" : "Don't have an account?"}
521
+ {reset ? "Remembered your password?" : signUp ? "Already have an account?" : "Don't have an account?"}
398
522
  </Text>
399
- <Button testID={id(signUp ? "sign-in-link" : "sign-up-link")} variant="link" size="sm" fullWidth={false} onPress={() => router.push(linkHref)}>
400
- {signUp ? "Sign in" : "Sign up"}
523
+ <Button testID={id(toSignIn ? "sign-in-link" : "sign-up-link")} variant="link" size="sm" fullWidth={false} onPress={() => router.push(linkHref)}>
524
+ {toSignIn ? "Sign in" : "Sign up"}
401
525
  </Button>
402
526
  </> : null}
403
527
  {footer}
404
528
  </>;
405
529
  const hasFooter = Boolean(linkHref && !pendingVerification || footer);
406
530
  if (pendingNewPassword) {
407
- return <AuthScreen testID={id("new-password-screen")} title={AUTH_MESSAGES.newPasswordTitle} subtitle={AUTH_MESSAGES.newPasswordDescription} header={header}>
531
+ return <AuthScreen testID={id("new-password-screen")} title={AUTH_MESSAGES.newPasswordTitle} subtitle={reset ? AUTH_MESSAGES.resetNewPasswordDescription : AUTH_MESSAGES.newPasswordDescription} header={header}>
408
532
  <PasswordInput testID={id("new-password")} accessibilityLabel={AUTH_MESSAGES.newPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" autoFocus returnKeyType="next" submitBehavior="submit" onSubmitEditing={() => confirmField.current?.focus()} value={newPassword} placeholder={AUTH_MESSAGES.newPasswordLabel} onChangeText={setNewPassword} />
409
533
  <PasswordInput testID={id("confirm-password")} ref={confirmField} accessibilityLabel={AUTH_MESSAGES.confirmPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" returnKeyType="go" value={confirmPassword} placeholder={AUTH_MESSAGES.confirmPasswordLabel} onChangeText={setConfirmPassword} onSubmitEditing={() => void onNewPassword()} />
410
534
  <FieldError testID={id("error")} message={error} />
@@ -412,10 +536,15 @@ export function SignInScreen({
412
536
  {AUTH_MESSAGES.setPassword}
413
537
  </Button>
414
538
  <Button testID={id("new-password-back")} variant="ghost" onPress={onSecondFactorBack}>
415
- Use a different account
539
+ {reset ? "Use a different email" : "Use a different account"}
416
540
  </Button>
417
541
  </AuthScreen>;
418
542
  }
543
+ if (pendingResetCode && !pendingSecondFactor) {
544
+ return <SecondFactorScreen key="reset-code" title={AUTH_MESSAGES.emailCodeTitle} description={AUTH_MESSAGES.emailCodeDescription} footer={<Button testID={id("resend")} variant="link" size="sm" fullWidth={false} disabled={resetLoading} onPress={() => void onResetResend()}>
545
+ {AUTH_MESSAGES.resendCode}
546
+ </Button>} onSubmit={onResetCode} error={resetCodeError} loading={resetLoading} onBack={onSecondFactorBack} backLabel="Use a different email" header={header} testIDPrefix={id("email-code")} />;
547
+ }
419
548
  if (pendingFirstFactor && !pendingSecondFactor && !pendingNewPassword) {
420
549
  const others = supportedFirstFactorStrategies(firstFactors).filter(strategy_3 => strategy_3 !== firstStrategy);
421
550
  const switchTo = others[0] ?? null;
@@ -452,16 +581,31 @@ export function SignInScreen({
452
581
  </Button>
453
582
  </AuthScreen>;
454
583
  }
455
- return <AuthScreen testID={id("screen")} title={title ?? (signUp ? "Create account" : "Welcome back")} subtitle={subtitle ?? (signUp ? "Sign up to get started" : "Sign in to continue")} header={header} footer={hasFooter ? footerRow : undefined}>
456
- {showGoogle ? <>
584
+ return <AuthScreen testID={id("screen")} title={title ?? (reset ? AUTH_MESSAGES.resetTitle : signUp ? "Create account" : "Welcome back")} subtitle={subtitle ?? (reset ? AUTH_MESSAGES.resetSubtitle : signUp ? "Sign up to get started" : "Sign in to continue")} header={header} footer={hasFooter ? footerRow : undefined}>
585
+ {showGoogle && !reset ? <>
457
586
  <GoogleSignInButton testID={id("google")} scheme={scheme} redirectPath={redirectPath} afterAuthHref={afterAuthHref} replaceOptions={replaceOptions} onSuccess={onSuccess} onError={message_0 => fail(message_0, message_0)} label={googleLabel} disabled={submitting} />
458
587
  <OrDivider />
459
588
  </> : null}
460
- <Input testID={id("email")} accessibilityLabel="Email" autoCapitalize="none" autoComplete="email" textContentType="emailAddress" keyboardType="email-address" returnKeyType="next" submitBehavior="submit" onSubmitEditing={() => passwordField.current?.focus()} value={email} placeholder="Email" onChangeText={setEmail} />
461
- <PasswordInput testID={id("password")} ref={passwordField} accessibilityLabel="Password" autoCapitalize="none" autoComplete={signUp ? "new-password" : "password"} textContentType={signUp ? "newPassword" : "password"} returnKeyType="go" value={password} placeholder="Password" onChangeText={setPassword} onSubmitEditing={() => void (signUp ? onSignUp() : onSignIn())} />
589
+ <Input testID={id("email")} accessibilityLabel="Email" autoCapitalize="none" autoComplete="email" textContentType="emailAddress" keyboardType="email-address" returnKeyType={reset ? "go" : "next"} submitBehavior={reset ? undefined : "submit"} onSubmitEditing={() => reset ? void onResetRequest() : passwordField.current?.focus()} value={email} placeholder="Email" onChangeText={setEmail} />
590
+ {reset ? null : <PasswordInput testID={id("password")} ref={passwordField} accessibilityLabel="Password" autoCapitalize="none" autoComplete={signUp ? "new-password" : "password"} textContentType={signUp ? "newPassword" : "password"} returnKeyType={signUp ? "next" : "go"} submitBehavior={signUp ? "submit" : undefined} value={password} placeholder="Password" onChangeText={text => {
591
+ setPassword(text);
592
+ setMismatch(false);
593
+ }} onSubmitEditing={() => signUp ? confirmField.current?.focus() : void onSignIn()} />}
594
+ {signUp ? <>
595
+ <PasswordInput testID={id("confirm-password")} ref={confirmField} accessibilityLabel={AUTH_MESSAGES.confirmSignUpPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" returnKeyType="go" value={signUpConfirm} placeholder={AUTH_MESSAGES.confirmSignUpPasswordLabel} onChangeText={text_0 => {
596
+ setSignUpConfirm(text_0);
597
+ setMismatch(false);
598
+ }} onSubmitEditing={() => void onSignUp()} />
599
+ <FieldError testID={id("confirm-error")} message={mismatch ? AUTH_MESSAGES.passwordMismatch : ""} />
600
+ </> : null}
601
+ {!signUp && !reset && forgotPasswordHref ? <View className="items-end">
602
+ <Button testID={id("forgot-password")} variant="link" size="sm" fullWidth={false} onPress={() => router.push(forgotPasswordHref)}>
603
+ {AUTH_MESSAGES.forgotPassword}
604
+ </Button>
605
+ </View> : null}
462
606
  <FieldError testID={id("error")} message={error} />
463
- <Button testID={id("submit")} loading={submitting} onPress={() => void (signUp ? onSignUp() : onSignIn())}>
464
- {signUp ? "Create account" : "Sign in"}
607
+ <Button testID={id("submit")} loading={submitting} onPress={() => void (reset ? onResetRequest() : signUp ? onSignUp() : onSignIn())}>
608
+ {reset ? AUTH_MESSAGES.sendResetCode : signUp ? "Create account" : "Sign in"}
465
609
  </Button>
466
610
  {/* Bot protection mounts its widget here on web sign-up. */}
467
611
  {signUp ? <View nativeID="clerk-captcha" /> : null}
@@ -480,3 +624,16 @@ export function SignUpScreen(props) {
480
624
  }
481
625
  return t0;
482
626
  }
627
+ /** `SignInScreen` with `mode="reset-password"`: the forgot-password flow. */
628
+ export function ResetPasswordScreen(props) {
629
+ const $ = _c(2);
630
+ let t0;
631
+ if ($[0] !== props) {
632
+ t0 = <SignInScreen {...props} mode="reset-password" />;
633
+ $[0] = props;
634
+ $[1] = t0;
635
+ } else {
636
+ t0 = $[1];
637
+ }
638
+ return t0;
639
+ }
@@ -6,6 +6,6 @@ export { AuthProviders } from "./AuthProviders";
6
6
  export { AuthScreen, OrDivider, FieldError } from "./AuthScreen";
7
7
  export { authErrorMessage, logAuthFailure, withAuthTimeout, AuthTimeoutError, isAuthTimeoutError, AUTH_TIMEOUT_CODE, DEFAULT_STAGE_TIMEOUT_MS, CREDENTIAL_ERROR_CODES } from "./authErrors";
8
8
  export { GoogleSignInButton, useGoogleSignIn, useWarmUpBrowser, GOOGLE_ERROR_MESSAGE } from "./GoogleSignInButton";
9
- export { SignInScreen, SignUpScreen, AUTH_MESSAGES } from "./SignInScreen";
9
+ export { SignInScreen, SignUpScreen, ResetPasswordScreen, AUTH_MESSAGES } from "./SignInScreen";
10
10
  export { SecondFactorScreen } from "./SecondFactorScreen";
11
11
  export { submitTotpSecondFactor, submitSecondFactor, prepareSecondFactorIfNeeded, prepareFirstFactorIfNeeded, submitFirstFactor, pickFirstFactorStrategy, supportedFirstFactorStrategies, FIRST_FACTOR_PREFERENCE, pickSecondFactorStrategy, supportedSecondFactorStrategies, SECOND_FACTOR_PREFERENCE, useSecondFactor, TOTP_MESSAGES } from "./totp";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/native-ui",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
6
6
  "type": "module",
@@ -32,7 +32,10 @@ import {
32
32
  } from "./totp";
33
33
  import { GoogleSignInButton, type AuthNavigationOptions } from "./GoogleSignInButton";
34
34
 
35
- export type SignInMode = "sign-in" | "sign-up";
35
+ export type SignInMode = "sign-in" | "sign-up" | "reset-password";
36
+
37
+ /** The first factor that emails a password-reset code. */
38
+ const RESET_STRATEGY = "reset_password_email_code";
36
39
 
37
40
  /** The messages the screen can show. Generic: none names a provider. */
38
41
  export const AUTH_MESSAGES = {
@@ -66,6 +69,16 @@ export const AUTH_MESSAGES = {
66
69
  passwordTooShort: "Use a longer password",
67
70
  resetPasswordFailed: "Could not set the new password",
68
71
  setPassword: "Set password",
72
+ missingNewPassword: "Enter a new password",
73
+ confirmSignUpPasswordLabel: "Confirm password",
74
+ forgotPassword: "Forgot password?",
75
+ resetTitle: "Reset password",
76
+ resetSubtitle: "Enter your email and we will send you a code.",
77
+ resetNewPasswordDescription: "Choose a new password for your account.",
78
+ missingEmail: "Enter your email",
79
+ sendResetCode: "Send code",
80
+ sendResetFailed: "Could not send the code",
81
+ resendCode: "Send a new code",
69
82
  } as const;
70
83
 
71
84
  /**
@@ -104,11 +117,15 @@ function secondFactorCopy(strategy: SecondFactorStrategy, clientTrust: boolean)
104
117
  }
105
118
 
106
119
  export type SignInScreenProps = AuthNavigationOptions & {
107
- /** Default `"sign-in"`. `"sign-up"` creates the account and checks an emailed code. */
120
+ /**
121
+ * Default `"sign-in"`. `"sign-up"` creates the account and checks an emailed
122
+ * code. `"reset-password"` emails a code, checks it, then sets a new password
123
+ * and signs in.
124
+ */
108
125
  mode?: SignInMode;
109
- /** Default "Welcome back", or "Create account" in `sign-up`. */
126
+ /** Default "Welcome back", "Create account" in `sign-up`, or "Reset password" in `reset-password`. */
110
127
  title?: string;
111
- /** Default "Sign in to continue", or "Sign up to get started" in `sign-up`. */
128
+ /** Default "Sign in to continue", "Sign up to get started" in `sign-up`, or the reset hint in `reset-password`. */
112
129
  subtitle?: string;
113
130
  /** The app URL scheme, such as `"vibot"`, for the Google redirect `scheme://sso-callback`. */
114
131
  scheme: string;
@@ -120,9 +137,14 @@ export type SignInScreenProps = AuthNavigationOptions & {
120
137
  googleLabel?: string;
121
138
  /** In `sign-in`: the "Sign up" link in the footer. No link without it. */
122
139
  signUpHref?: Href;
123
- /** In `sign-up`: the "Sign in" link in the footer. No link without it. */
140
+ /** In `sign-up` and `reset-password`: the "Sign in" link in the footer. No link without it. */
124
141
  signInHref?: Href;
125
- /** Sign-up rejects a shorter password before sending it. Default: no check. */
142
+ /**
143
+ * In `sign-in`: the "Forgot password?" link under the password, to a route
144
+ * that renders `ResetPasswordScreen`. No link without it.
145
+ */
146
+ forgotPasswordHref?: Href;
147
+ /** Sign-up and the new-password step reject a shorter password before sending it. Default: no check. */
126
148
  minPasswordLength?: number;
127
149
  /** Default `"toast"`. `"inline"` shows errors under the fields. */
128
150
  errorDisplay?: "toast" | "inline";
@@ -158,7 +180,13 @@ export type SignInScreenProps = AuthNavigationOptions & {
158
180
  * code and checks it before the session starts. On success it calls
159
181
  * `onSuccess`, or `router.replace(afterAuthHref, replaceOptions)`.
160
182
  *
161
- * Forgot-password is not here: an app that needs it keeps its own screen.
183
+ * Sign-up has a confirm-password field: a mismatch blocks the submit and shows
184
+ * under the field, whatever `errorDisplay` is.
185
+ *
186
+ * `mode="reset-password"` (`ResetPasswordScreen`) is the forgot-password flow:
187
+ * email, then the emailed code, then a new password typed twice. It ends
188
+ * signed in, through the same second-factor step when the account has one.
189
+ * `forgotPasswordHref` links the sign-in form to it.
162
190
  */
163
191
  export function SignInScreen({
164
192
  mode = "sign-in",
@@ -173,6 +201,7 @@ export function SignInScreen({
173
201
  googleLabel,
174
202
  signUpHref,
175
203
  signInHref,
204
+ forgotPasswordHref,
176
205
  minPasswordLength,
177
206
  errorDisplay = "toast",
178
207
  testIDPrefix,
@@ -200,6 +229,11 @@ export function SignInScreen({
200
229
  const [pendingNewPassword, setPendingNewPassword] = useState(false);
201
230
  const [newPassword, setNewPassword] = useState("");
202
231
  const [confirmPassword, setConfirmPassword] = useState("");
232
+ const [signUpConfirm, setSignUpConfirm] = useState("");
233
+ const [mismatch, setMismatch] = useState(false);
234
+ const [pendingResetCode, setPendingResetCode] = useState(false);
235
+ const [resetLoading, setResetLoading] = useState(false);
236
+ const [resetCodeError, setResetCodeError] = useState("");
203
237
  const secondFactor = useSecondFactor({ stageTimeoutMs });
204
238
  const [error, setError] = useState("");
205
239
  const [submitting, setSubmitting] = useState(false);
@@ -207,6 +241,7 @@ export function SignInScreen({
207
241
  const passwordField = useRef<TextInput>(null);
208
242
  const confirmField = useRef<TextInput>(null);
209
243
  const signUp = mode === "sign-up";
244
+ const reset = mode === "reset-password";
210
245
  const id = (name: string) => `${testIDPrefix ?? mode}-${name}`;
211
246
 
212
247
  const fail = (heading: string, message: string) => {
@@ -289,9 +324,11 @@ export function SignInScreen({
289
324
  done();
290
325
  } else if (status === "needs_new_password") {
291
326
  setPendingFirstFactor(false);
327
+ setPendingResetCode(false);
292
328
  setPendingNewPassword(true);
293
329
  } else if (status === "needs_second_factor" || status === "needs_client_trust") {
294
330
  setPendingFirstFactor(false);
331
+ setPendingResetCode(false);
295
332
  await startSecondFactor(attempt, status === "needs_client_trust");
296
333
  } else if (status === "needs_first_factor" && afterCreate) {
297
334
  await startFirstFactor(attempt);
@@ -329,7 +366,7 @@ export function SignInScreen({
329
366
  const onNewPassword = async () => {
330
367
  const { isLoaded, signIn, setActive } = signInState;
331
368
  if (!isLoaded || !signIn || !setActive || submitting) return;
332
- if (!newPassword) return fail(AUTH_MESSAGES.resetPasswordFailed, AUTH_MESSAGES.missingFields);
369
+ if (!newPassword) return fail(AUTH_MESSAGES.resetPasswordFailed, AUTH_MESSAGES.missingNewPassword);
333
370
  if (minPasswordLength && newPassword.length < minPasswordLength) {
334
371
  return fail(AUTH_MESSAGES.resetPasswordFailed, `Use at least ${minPasswordLength} characters for the password`);
335
372
  }
@@ -344,9 +381,15 @@ export function SignInScreen({
344
381
  "reset-password",
345
382
  stageTimeoutMs,
346
383
  );
347
- if (result.status === "complete" && result.createdSessionId) {
384
+ // Clerk's `SignInStatus` omits `needs_client_trust`: widen before comparing.
385
+ const afterReset: string | null = result.status;
386
+ if (afterReset === "complete" && result.createdSessionId) {
348
387
  await withAuthTimeout(setActive({ session: result.createdSessionId }), "set-active", stageTimeoutMs);
349
388
  done();
389
+ } else if (afterReset === "needs_second_factor" || afterReset === "needs_client_trust") {
390
+ // A reset on an account with two-step verification: the code step, then the session.
391
+ setPendingNewPassword(false);
392
+ await startSecondFactor(result, afterReset === "needs_client_trust");
350
393
  } else if (onIncomplete) {
351
394
  onIncomplete(result);
352
395
  } else {
@@ -385,6 +428,80 @@ export function SignInScreen({
385
428
  }
386
429
  };
387
430
 
431
+ // Emails the reset code. Throws what the call throws.
432
+ const requestResetCode = async () => {
433
+ const { signIn } = signInState;
434
+ if (!signIn) return;
435
+ await withAuthTimeout(
436
+ signIn.create({ strategy: RESET_STRATEGY, identifier: email.trim() }),
437
+ "create",
438
+ stageTimeoutMs,
439
+ );
440
+ };
441
+
442
+ const onResetRequest = async () => {
443
+ const { isLoaded, signIn } = signInState;
444
+ if (!isLoaded || !signIn || submitting) return;
445
+ if (!email.trim()) return fail(AUTH_MESSAGES.sendResetFailed, AUTH_MESSAGES.missingEmail);
446
+ setSubmitting(true);
447
+ setError("");
448
+ try {
449
+ await requestResetCode();
450
+ setResetCodeError("");
451
+ setPendingResetCode(true);
452
+ } catch (caught) {
453
+ logAuthFailure("create", caught);
454
+ fail(AUTH_MESSAGES.sendResetFailed, authErrorMessage(caught, AUTH_MESSAGES.sendResetFailed));
455
+ } finally {
456
+ setSubmitting(false);
457
+ }
458
+ };
459
+
460
+ const onResetResend = async () => {
461
+ const { isLoaded, signIn } = signInState;
462
+ if (!isLoaded || !signIn || resetLoading) return;
463
+ setResetLoading(true);
464
+ setResetCodeError("");
465
+ try {
466
+ await requestResetCode();
467
+ } catch (caught) {
468
+ logAuthFailure("create", caught);
469
+ setResetCodeError(authErrorMessage(caught, AUTH_MESSAGES.sendResetFailed));
470
+ } finally {
471
+ setResetLoading(false);
472
+ }
473
+ };
474
+
475
+ // Checks the emailed code. A good code gives `needs_new_password`, which `routeAttempt` shows.
476
+ const onResetCode = async (resetCode: string) => {
477
+ const { isLoaded, signIn } = signInState;
478
+ if (!isLoaded || !signIn || resetLoading) return;
479
+ setResetLoading(true);
480
+ setResetCodeError("");
481
+ try {
482
+ const attempt: IncompleteSignIn = await withAuthTimeout(
483
+ signIn.attemptFirstFactor({ strategy: RESET_STRATEGY, code: resetCode }),
484
+ "attempt-first-factor",
485
+ stageTimeoutMs,
486
+ );
487
+ const status: string | null = attempt.status;
488
+ const known = ["complete", "needs_new_password", "needs_second_factor", "needs_client_trust"];
489
+ if (status && known.includes(status)) {
490
+ await routeAttempt(attempt, false);
491
+ } else if (onIncomplete) {
492
+ onIncomplete(attempt);
493
+ } else {
494
+ warnIncomplete(attempt);
495
+ setResetCodeError(AUTH_MESSAGES.needsAnotherStep);
496
+ }
497
+ } catch (caught) {
498
+ if (isAuthTimeoutError(caught)) logAuthFailure("attempt-first-factor", caught);
499
+ setResetCodeError(authErrorMessage(caught, AUTH_MESSAGES.verifyFailed));
500
+ } finally {
501
+ setResetLoading(false);
502
+ }
503
+ };
504
+
388
505
  const onSecondFactor = async (secondFactorCode: string) => {
389
506
  const result = await secondFactor.submit(secondFactorCode);
390
507
  if (result.ok) done();
@@ -395,6 +512,8 @@ export function SignInScreen({
395
512
  setPendingSecondFactor(false);
396
513
  setPendingFirstFactor(false);
397
514
  setFirstError("");
515
+ setPendingResetCode(false);
516
+ setResetCodeError("");
398
517
  setPendingNewPassword(false);
399
518
  setNewPassword("");
400
519
  setConfirmPassword("");
@@ -410,6 +529,12 @@ export function SignInScreen({
410
529
  if (minPasswordLength && password.length < minPasswordLength) {
411
530
  return fail(AUTH_MESSAGES.signUpFailed, `Use at least ${minPasswordLength} characters for the password`);
412
531
  }
532
+ if (password !== signUpConfirm) {
533
+ // Always under the confirm field, also with `errorDisplay="toast"`.
534
+ setError("");
535
+ setMismatch(true);
536
+ return;
537
+ }
413
538
  setSubmitting(true);
414
539
  setError("");
415
540
  try {
@@ -444,22 +569,23 @@ export function SignInScreen({
444
569
  }
445
570
  };
446
571
 
447
- const linkHref = signUp ? signInHref : signUpHref;
572
+ const toSignIn = signUp || reset;
573
+ const linkHref = toSignIn ? signInHref : signUpHref;
448
574
  const footerRow = (
449
575
  <>
450
576
  {linkHref && !pendingVerification ? (
451
577
  <>
452
578
  <Text className="font-instrument-sans text-sm" style={textStyle("muted", colorScheme)}>
453
- {signUp ? "Already have an account?" : "Don't have an account?"}
579
+ {reset ? "Remembered your password?" : signUp ? "Already have an account?" : "Don't have an account?"}
454
580
  </Text>
455
581
  <Button
456
- testID={id(signUp ? "sign-in-link" : "sign-up-link")}
582
+ testID={id(toSignIn ? "sign-in-link" : "sign-up-link")}
457
583
  variant="link"
458
584
  size="sm"
459
585
  fullWidth={false}
460
586
  onPress={() => router.push(linkHref)}
461
587
  >
462
- {signUp ? "Sign in" : "Sign up"}
588
+ {toSignIn ? "Sign in" : "Sign up"}
463
589
  </Button>
464
590
  </>
465
591
  ) : null}
@@ -473,7 +599,7 @@ export function SignInScreen({
473
599
  <AuthScreen
474
600
  testID={id("new-password-screen")}
475
601
  title={AUTH_MESSAGES.newPasswordTitle}
476
- subtitle={AUTH_MESSAGES.newPasswordDescription}
602
+ subtitle={reset ? AUTH_MESSAGES.resetNewPasswordDescription : AUTH_MESSAGES.newPasswordDescription}
477
603
  header={header}
478
604
  >
479
605
  <PasswordInput
@@ -508,12 +634,41 @@ export function SignInScreen({
508
634
  {AUTH_MESSAGES.setPassword}
509
635
  </Button>
510
636
  <Button testID={id("new-password-back")} variant="ghost" onPress={onSecondFactorBack}>
511
- Use a different account
637
+ {reset ? "Use a different email" : "Use a different account"}
512
638
  </Button>
513
639
  </AuthScreen>
514
640
  );
515
641
  }
516
642
 
643
+ if (pendingResetCode && !pendingSecondFactor) {
644
+ return (
645
+ <SecondFactorScreen
646
+ key="reset-code"
647
+ title={AUTH_MESSAGES.emailCodeTitle}
648
+ description={AUTH_MESSAGES.emailCodeDescription}
649
+ footer={
650
+ <Button
651
+ testID={id("resend")}
652
+ variant="link"
653
+ size="sm"
654
+ fullWidth={false}
655
+ disabled={resetLoading}
656
+ onPress={() => void onResetResend()}
657
+ >
658
+ {AUTH_MESSAGES.resendCode}
659
+ </Button>
660
+ }
661
+ onSubmit={onResetCode}
662
+ error={resetCodeError}
663
+ loading={resetLoading}
664
+ onBack={onSecondFactorBack}
665
+ backLabel="Use a different email"
666
+ header={header}
667
+ testIDPrefix={id("email-code")}
668
+ />
669
+ );
670
+ }
671
+
517
672
  if (pendingFirstFactor && !pendingSecondFactor && !pendingNewPassword) {
518
673
  const others = supportedFirstFactorStrategies(firstFactors).filter((strategy) => strategy !== firstStrategy);
519
674
  const switchTo = others[0] ?? null;
@@ -638,12 +793,14 @@ export function SignInScreen({
638
793
  return (
639
794
  <AuthScreen
640
795
  testID={id("screen")}
641
- title={title ?? (signUp ? "Create account" : "Welcome back")}
642
- subtitle={subtitle ?? (signUp ? "Sign up to get started" : "Sign in to continue")}
796
+ title={title ?? (reset ? AUTH_MESSAGES.resetTitle : signUp ? "Create account" : "Welcome back")}
797
+ subtitle={
798
+ subtitle ?? (reset ? AUTH_MESSAGES.resetSubtitle : signUp ? "Sign up to get started" : "Sign in to continue")
799
+ }
643
800
  header={header}
644
801
  footer={hasFooter ? footerRow : undefined}
645
802
  >
646
- {showGoogle ? (
803
+ {showGoogle && !reset ? (
647
804
  <>
648
805
  <GoogleSignInButton
649
806
  testID={id("google")}
@@ -666,33 +823,73 @@ export function SignInScreen({
666
823
  autoComplete="email"
667
824
  textContentType="emailAddress"
668
825
  keyboardType="email-address"
669
- returnKeyType="next"
670
- submitBehavior="submit"
671
- onSubmitEditing={() => passwordField.current?.focus()}
826
+ returnKeyType={reset ? "go" : "next"}
827
+ submitBehavior={reset ? undefined : "submit"}
828
+ onSubmitEditing={() => (reset ? void onResetRequest() : passwordField.current?.focus())}
672
829
  value={email}
673
830
  placeholder="Email"
674
831
  onChangeText={setEmail}
675
832
  />
676
- <PasswordInput
677
- testID={id("password")}
678
- ref={passwordField}
679
- accessibilityLabel="Password"
680
- autoCapitalize="none"
681
- autoComplete={signUp ? "new-password" : "password"}
682
- textContentType={signUp ? "newPassword" : "password"}
683
- returnKeyType="go"
684
- value={password}
685
- placeholder="Password"
686
- onChangeText={setPassword}
687
- onSubmitEditing={() => void (signUp ? onSignUp() : onSignIn())}
688
- />
833
+ {reset ? null : (
834
+ <PasswordInput
835
+ testID={id("password")}
836
+ ref={passwordField}
837
+ accessibilityLabel="Password"
838
+ autoCapitalize="none"
839
+ autoComplete={signUp ? "new-password" : "password"}
840
+ textContentType={signUp ? "newPassword" : "password"}
841
+ returnKeyType={signUp ? "next" : "go"}
842
+ submitBehavior={signUp ? "submit" : undefined}
843
+ value={password}
844
+ placeholder="Password"
845
+ onChangeText={(text) => {
846
+ setPassword(text);
847
+ setMismatch(false);
848
+ }}
849
+ onSubmitEditing={() => (signUp ? confirmField.current?.focus() : void onSignIn())}
850
+ />
851
+ )}
852
+ {signUp ? (
853
+ <>
854
+ <PasswordInput
855
+ testID={id("confirm-password")}
856
+ ref={confirmField}
857
+ accessibilityLabel={AUTH_MESSAGES.confirmSignUpPasswordLabel}
858
+ autoCapitalize="none"
859
+ autoComplete="new-password"
860
+ textContentType="newPassword"
861
+ returnKeyType="go"
862
+ value={signUpConfirm}
863
+ placeholder={AUTH_MESSAGES.confirmSignUpPasswordLabel}
864
+ onChangeText={(text) => {
865
+ setSignUpConfirm(text);
866
+ setMismatch(false);
867
+ }}
868
+ onSubmitEditing={() => void onSignUp()}
869
+ />
870
+ <FieldError testID={id("confirm-error")} message={mismatch ? AUTH_MESSAGES.passwordMismatch : ""} />
871
+ </>
872
+ ) : null}
873
+ {!signUp && !reset && forgotPasswordHref ? (
874
+ <View className="items-end">
875
+ <Button
876
+ testID={id("forgot-password")}
877
+ variant="link"
878
+ size="sm"
879
+ fullWidth={false}
880
+ onPress={() => router.push(forgotPasswordHref)}
881
+ >
882
+ {AUTH_MESSAGES.forgotPassword}
883
+ </Button>
884
+ </View>
885
+ ) : null}
689
886
  <FieldError testID={id("error")} message={error} />
690
887
  <Button
691
888
  testID={id("submit")}
692
889
  loading={submitting}
693
- onPress={() => void (signUp ? onSignUp() : onSignIn())}
890
+ onPress={() => void (reset ? onResetRequest() : signUp ? onSignUp() : onSignIn())}
694
891
  >
695
- {signUp ? "Create account" : "Sign in"}
892
+ {reset ? AUTH_MESSAGES.sendResetCode : signUp ? "Create account" : "Sign in"}
696
893
  </Button>
697
894
  {/* Bot protection mounts its widget here on web sign-up. */}
698
895
  {signUp ? <View nativeID="clerk-captcha" /> : null}
@@ -706,3 +903,10 @@ export type SignUpScreenProps = Omit<SignInScreenProps, "mode">;
706
903
  export function SignUpScreen(props: SignUpScreenProps) {
707
904
  return <SignInScreen {...props} mode="sign-up" />;
708
905
  }
906
+
907
+ export type ResetPasswordScreenProps = Omit<SignInScreenProps, "mode">;
908
+
909
+ /** `SignInScreen` with `mode="reset-password"`: the forgot-password flow. */
910
+ export function ResetPasswordScreen(props: ResetPasswordScreenProps) {
911
+ return <SignInScreen {...props} mode="reset-password" />;
912
+ }
package/src/auth/index.ts CHANGED
@@ -28,8 +28,14 @@ export type {
28
28
  GoogleSignInOptions,
29
29
  GoogleSignInButtonProps,
30
30
  } from "./GoogleSignInButton";
31
- export { SignInScreen, SignUpScreen, AUTH_MESSAGES } from "./SignInScreen";
32
- export type { IncompleteSignIn, SignInMode, SignInScreenProps, SignUpScreenProps } from "./SignInScreen";
31
+ export { SignInScreen, SignUpScreen, ResetPasswordScreen, AUTH_MESSAGES } from "./SignInScreen";
32
+ export type {
33
+ IncompleteSignIn,
34
+ ResetPasswordScreenProps,
35
+ SignInMode,
36
+ SignInScreenProps,
37
+ SignUpScreenProps,
38
+ } from "./SignInScreen";
33
39
  export { SecondFactorScreen } from "./SecondFactorScreen";
34
40
  export type { SecondFactorScreenProps } from "./SecondFactorScreen";
35
41
  export {