Skip to content

add auth function & profile page#4

Merged
Retsomm merged 3 commits into
mainfrom
dev
May 18, 2026
Merged

add auth function & profile page#4
Retsomm merged 3 commits into
mainfrom
dev

Conversation

@Retsomm
Copy link
Copy Markdown
Owner

@Retsomm Retsomm commented May 18, 2026

Add Clerk integration and profile screen

  • Updated skills-lock.json to include Clerk-related skills.
  • Created oauth-callback.tsx for handling OAuth callbacks.
  • Implemented profile.tsx to display user profile information and sign-out functionality.

Summary by CodeRabbit

  • New Features

    • Full Clerk-based auth: email/password, social SSO, verification flow, OAuth callback, profile screen, and auth-gated navigation with onboarding redirects.
    • Improved safe-area and responsive layout handling.
  • Documentation

    • Expanded Clerk Expo quickstart and integration guide.
  • Chores

    • Added Clerk/Expo and related Expo packages, registered plugins, added mascot image asset, updated skills lock, and added .env to .gitignore.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e6f74eb-a13a-40da-8e5e-6d1f1e9a1aeb

📥 Commits

Reviewing files that changed from the base of the PR and between 641fa74 and c725329.

📒 Files selected for processing (2)
  • components/auth-screen.tsx
  • prompts/05-clerk.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/auth-screen.tsx

📝 Walkthrough

Walkthrough

Integrates Clerk into the Expo app: bootstraps ClerkProvider, completes OAuth sessions, gates auth routes, implements Clerk-backed auth (email + SSO + verification), updates index/onboarding/profile screens and assets, and adds a Clerk quickstart plus skills metadata.

Changes

Clerk Authentication Integration

Layer / File(s) Summary
Clerk provider bootstrap & deps
app/_layout.tsx, app.json, package.json, .gitignore
ClerkProvider initialized with publishable key and token cache; @clerk/expo and Expo packages added to dependencies; app.json plugins updated; .env added to .gitignore.
OAuth callback & auth route gating
app/oauth-callback.tsx, app/(auth)/_layout.tsx
Adds OAuth callback that calls maybeCompleteAuthSession() and gates the (auth) route group: wait for auth load, redirect signed-in users to /, otherwise render the auth Stack.
AuthScreen: Clerk email/SSO and verification
components/auth-screen.tsx
Refactors AuthScreen to use Clerk hooks (useSignIn, useSignUp, useSSO), adds social strategies and unified isSubmitting state, centralizes auth errors, implements SSO redirect handling, and redesigns VerificationModal to accept async onCodeComplete, inline errors, and digit-only input.
Index, Onboarding, and Profile screens
app/index.tsx, app/onboarding.tsx, app/profile.tsx
Index waits for auth and redirects unauthenticated users to /onboarding with safe-area padding; Onboarding waits for auth, redirects signed-in users to /, updates styling and uses images.mascotWelcome; ProfileScreen displays user info and sign-out flow (with disabled/loading state and error handling).
Asset constants
constants/images.ts
Adds mascotWelcome import and includes it in exported images object for onboarding.
Clerk quickstart docs & skills metadata
prompts/05-clerk.md, skills-lock.json
Adds an extensive Clerk Expo quickstart (native components and JS examples and route-group patterns) and registers Clerk-related entries in skills-lock.json.

Sequence Diagram

sequenceDiagram
  participant User
  participant App as Expo App
  participant ClerkProvider
  participant AuthScreen
  participant WebBrowser
  participant ClerkSDK as Clerk SDK
  participant Router

  User->>App: open app / perform OAuth
  App->>ClerkProvider: initialize with publishable key
  ClerkProvider->>AuthScreen: provide auth hooks/context
  User->>AuthScreen: submit email/password or tap social
  AuthScreen->>WebBrowser: dismiss/start SSO browser if needed
  AuthScreen->>ClerkSDK: useSignIn/useSignUp/useSSO flows
  alt verification required
    ClerkSDK->>AuthScreen: request verification
    User->>AuthScreen: enter 6-digit code
    AuthScreen->>ClerkSDK: onCodeComplete(code)
  end
  ClerkSDK->>Router: on success -> router.replace("/")
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Retsomm/react-native-lingua#3: Modifies components/auth-screen.tsx and auth routing; this PR builds Clerk-based verification and SSO into the same auth UI.
  • Retsomm/react-native-lingua#1: Previously added onboarding/home screens; this PR updates onboarding assets and adds Clerk auth gating.

Poem

🐰
I hopped in with a publishable key,
Wrapped the root so auth could be,
Emails, socials, codes in flight—
Profiles safe by soft lamplight.
Hooray! The app now signs in right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title refers to adding auth functionality and a profile page, which are central changes in this PR that integrates Clerk authentication and adds a ProfileScreen component.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/auth-screen.tsx (1)

239-240: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Move NativeWind classes off ScrollView/TextInput in this file.

Line 240, Line 296, and Line 313 apply className on components that are explicitly excluded by project rules; use style/StyleSheet for these instead.

As per coding guidelines, "Use StyleSheet or inline styles instead of NativeWind classes for SafeAreaView, Button, KeyboardAvoidingView, Modal, ScrollView, TextInput, Animated.View, dynamic styles, platform-specific styles, Pressable/TouchableOpacity pressed states, shadows, transform arrays, and z-index".

Also applies to: 296-297, 313-314

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/auth-screen.tsx` around lines 239 - 240, The ScrollView and
TextInput instances in this file are using NativeWind className props (refer to
the ScrollView at the top and the TextInput usages around the later form fields)
which are disallowed; remove the className prop from those components and
convert the styling into a StyleSheet entry or an inline style object, then pass
it via the style prop (e.g., create styles.scrollView and styles.textInput and
replace className on ScrollView and the two TextInput occurrences with
style={styles...}); ensure you migrate any layout, padding, backgroundColor,
fontSize, and color rules from the class strings into the StyleSheet so behavior
remains identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/profile.tsx`:
- Around line 16-19: The sign-out flow in handleSignOut should guard against
duplicate taps and surface errors: add a local pending boolean state (e.g.,
isSigningOut) and return early if it's already true, set it true before calling
the async signOut(), wrap signOut() and router.replace("/onboarding") in
try/catch/finally to catch and log/display errors and ensure the pending flag is
cleared in finally; also pass the isSigningOut flag to the sign-out button's
disabled prop so the UI is disabled while processing.

In `@components/auth-screen.tsx`:
- Around line 116-127: The Clerk method calls use incorrect signatures and must
be updated to match `@clerk/expo` v3.2.12: replace signUp.password(...) with
signUp.create(...); replace signUp.verifications.sendEmailCode() with
signUp.verifications.emailAddress.prepareVerification({ strategy: 'email_code'
}); replace signIn.emailCode.sendCode() with
signIn.emailCode.prepareVerification({ strategy: 'email_code' }); replace
signUp.verifications.verifyEmailCode(...) with
signUp.verifications.emailAddress.attemptVerification(...); and replace
signIn.emailCode.verifyCode(...) with signIn.emailCode.attemptVerification(...);
update any variable names and error handling around these calls (e.g.,
verificationError) to match the new return shapes from signUp.create,
prepareVerification, and attemptVerification.

In `@prompts/05-clerk.md`:
- Line 7: There's a typo in the route path string "(/onboarding(" — the closing
parenthesis is missing; update the prompt text so the onboarding route reads
"(/onboarding)" (replace the "(/onboarding(" occurrence) to correct the route
punctuation in prompts/05-clerk.md.

---

Outside diff comments:
In `@components/auth-screen.tsx`:
- Around line 239-240: The ScrollView and TextInput instances in this file are
using NativeWind className props (refer to the ScrollView at the top and the
TextInput usages around the later form fields) which are disallowed; remove the
className prop from those components and convert the styling into a StyleSheet
entry or an inline style object, then pass it via the style prop (e.g., create
styles.scrollView and styles.textInput and replace className on ScrollView and
the two TextInput occurrences with style={styles...}); ensure you migrate any
layout, padding, backgroundColor, fontSize, and color rules from the class
strings into the StyleSheet so behavior remains identical.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d372801-b493-499e-bf91-39ed8dd080df

📥 Commits

Reviewing files that changed from the base of the PR and between ee3f34c and a7d324f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • .gitignore
  • app.json
  • app/(auth)/_layout.tsx
  • app/_layout.tsx
  • app/index.tsx
  • app/oauth-callback.tsx
  • app/onboarding.tsx
  • app/profile.tsx
  • components/auth-screen.tsx
  • constants/images.ts
  • package.json
  • prompts/05-clerk.md
  • skills-lock.json

Comment thread app/profile.tsx
Comment on lines +116 to +127
const { error } = await signUp.password({
emailAddress: email,
password,
});

if (error) {
setAuthError(error.message);
return;
}

const { error: verificationError } =
await signUp.verifications.sendEmailCode();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

For @clerk/expo` version 3.2.x, what are the exact useSignIn/useSignUp methods for:

  1. email+password sign-up,
  2. sending email code for sign-in/sign-up verification,
  3. verifying the code,
  4. activating/finalizing the session in Expo React Native?
    Please provide official Clerk docs links and method signatures.`

💡 Result:

For @clerk/expo version 3.2.x, which utilizes the Core 3 API, you should use the useSignUp() and useSignIn() hooks to manage custom authentication flows [1]. These hooks provide access to SignUpFuture and SignInFuture objects, respectively [2][3]. Below are the methods for an email+password sign-up flow: 1) Email+Password Sign-Up Initiate the process by collecting the user's email and password using the signUp.create() method [4][5]. Method: signUp.create({ emailAddress, password }) [5] 2) Sending Email Code After initiating the sign-up, send the verification code to the user's email [5]. Method: signUp.verifications.emailAddress.prepareVerification({ strategy: 'email_code' }) [5] 3) Verifying the Code Once the user provides the code, verify it to complete the verification step [5]. Method: signUp.verifications.emailAddress.attemptVerification({ code }) [5] 4) Activating/Finalizing the Session If the sign-up status becomes complete, finalize the process to set the session as active [5]. Method: signUp.finalize() [5] Official Documentation Links: - Custom Email/Password Flow Guide: https://clerk.com/docs/guides/development/custom-flows/authentication/email-password - useSignUp Hook Reference: https://clerk.com/docs/expo/reference/hooks/use-sign-up - useSignIn Hook Reference: https://clerk.com/docs/expo/reference/hooks/use-sign-in Note: Ensure you are using the Core 3 SignUpFuture and SignInFuture APIs rather than the legacy SignUp or SignIn objects, as the legacy APIs are deprecated [6][7][8]. Always check the signUp.status or signIn.status to determine the next required step in your flow [5].

Citations:


🏁 Script executed:

# Check the installed `@clerk/expo` version
cat package.json | grep -A 2 -B 2 "`@clerk/expo`"

Repository: Retsomm/react-native-lingua

Length of output: 210


🏁 Script executed:

# Read the specific lines from auth-screen.tsx
cat -n components/auth-screen.tsx | sed -n '110,130p'

Repository: Retsomm/react-native-lingua

Length of output: 669


🏁 Script executed:

# Also check the other flagged lines
cat -n components/auth-screen.tsx | sed -n '130,140p'
cat -n components/auth-screen.tsx | sed -n '155,175p'
cat -n components/auth-screen.tsx | sed -n '175,195p'

Repository: Retsomm/react-native-lingua

Length of output: 1664


Clerk API methods do not match @clerk/expo v3.2.12 documentation.

Multiple method calls use incorrect signatures that will fail typecheck and runtime:

  • Line 116: signUp.password() should be signUp.create()
  • Line 127: signUp.verifications.sendEmailCode() should be signUp.verifications.emailAddress.prepareVerification({ strategy: 'email_code' })
  • Line 134: signIn.emailCode.sendCode() should be signIn.emailCode.prepareVerification({ strategy: 'email_code' })
  • Line 159: signUp.verifications.verifyEmailCode() should be signUp.verifications.emailAddress.attemptVerification()
  • Line 177: signIn.emailCode.verifyCode() should be signIn.emailCode.attemptVerification()

See Clerk Expo docs: https://clerk.com/docs/guides/development/custom-flows/authentication/email-password

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/auth-screen.tsx` around lines 116 - 127, The Clerk method calls
use incorrect signatures and must be updated to match `@clerk/expo` v3.2.12:
replace signUp.password(...) with signUp.create(...); replace
signUp.verifications.sendEmailCode() with
signUp.verifications.emailAddress.prepareVerification({ strategy: 'email_code'
}); replace signIn.emailCode.sendCode() with
signIn.emailCode.prepareVerification({ strategy: 'email_code' }); replace
signUp.verifications.verifyEmailCode(...) with
signUp.verifications.emailAddress.attemptVerification(...); and replace
signIn.emailCode.verifyCode(...) with signIn.emailCode.attemptVerification(...);
update any variable names and error handling around these calls (e.g.,
verificationError) to match the new return shapes from signUp.create,
prepareVerification, and attemptVerification.

Comment thread prompts/05-clerk.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/auth-screen.tsx`:
- Around line 58-62: The type annotation uses React.ReactNode (in the
tuple/array type for the social options) but React isn't imported, causing
TS2503; fix by either adding an import for React (so React.ReactNode resolves)
or change to a type-only import and use ReactNode (import type { ReactNode }
from 'react') and update the annotation accordingly; update the declaration that
references React.ReactNode (the array element type paired with label and
strategy / SocialStrategy) to match the chosen import.
- Around line 157-194: After a successful verifyEmailCode / verifyCode call,
check signUp.status or signIn.status === "complete" before calling
signUp.finalize() / signIn.finalize(); if the status is not "complete" (e.g.,
"missing_requirements" for MFA or extra fields) do not call finalize but instead
handle the next step (e.g., surface setAuthError, navigate to the required flow,
or render the additional requirements UI). Update the branches that call
signUp.verifications.verifyEmailCode, signIn.emailCode.verifyCode,
signUp.finalize, and signIn.finalize to inspect signUp.status and signIn.status
and only call finalize when status === "complete", otherwise handle the
non-complete status path appropriately.
- Around line 218-229: The code treats missing createdSessionId as a
cancellation; instead destructure signIn and signUp from startSSOFlow()
alongside createdSessionId and setActive, and if signIn or signUp is present,
route the user into the OAuth-completion flow (e.g. save signIn/signUp to state
or call your existing pending-OAuth handler and navigate to the completion form)
rather than calling setAuthError; only show the cancellation error when none of
createdSessionId, signIn, or signUp are returned.

In `@prompts/05-clerk.md`:
- Around line 342-400: Duplicate top-level headings (e.g., "Enable Native API",
"Create a new Expo app", "Remove default template files", etc.) cause MD024 lint
warnings; make each heading unique per approach by appending a short
disambiguator (like "— Web", "— Expo", "— Native", or " (Approach B)") or by
changing level/wording so they are distinct; update all repeated headings in the
document (including the instances noted around "Enable Native API" and "Create a
new Expo app") to use the new unique text so markdownlint MD024 is resolved and
navigation anchors remain distinct.
- Around line 301-305: The run flow contradicts itself by telling users to "Scan
the QR code with Expo Go" even though this doc states native-components cannot
run in Expo Go; remove the "Scan the QR code with Expo Go" bullet from the
terminal shortcuts section (the bullets that include "Press `i` to open the iOS
simulator" and "Press `a` to open the Android emulator") and replace it with a
concise alternative that directs users to use an Expo development client or a
platform-specific dev build/installation for physical devices (mention "Expo
development client" or "development build" instead of "Expo Go").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a901ee5-e8a3-4c3e-8072-9e011da49d8f

📥 Commits

Reviewing files that changed from the base of the PR and between a7d324f and 641fa74.

📒 Files selected for processing (3)
  • app/profile.tsx
  • components/auth-screen.tsx
  • prompts/05-clerk.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/profile.tsx

Comment thread components/auth-screen.tsx
Comment thread components/auth-screen.tsx
Comment thread components/auth-screen.tsx Outdated
Comment thread prompts/05-clerk.md
Comment thread prompts/05-clerk.md Outdated
@Retsomm Retsomm merged commit 9495626 into main May 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant