Skip to content

feat(example): add Google sign in demo and env setup#1

Merged
MalcolmTomisin merged 5 commits into
mainfrom
ta-example-code
Jun 19, 2026
Merged

feat(example): add Google sign in demo and env setup#1
MalcolmTomisin merged 5 commits into
mainfrom
ta-example-code

Conversation

@MalcolmTomisin

@MalcolmTomisin MalcolmTomisin commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Builds out a complete, runnable example app for the Google Sign-In package and hardens the Android native module with stable dependency versions. The example showcases every variant of the GoogleSignInButton (themes, shapes, text, sizes, disabled state) and exercises the full public API (configure, signIn, signOut, GoogleSignInErrorCode, isGoogleSignInError). The Web Client ID is loaded from a .env file via Expo's built-in EXPO_PUBLIC_* support so contributors can drop in their own credentials without editing source.

Changes

Example app

  • example/src/App.tsx — replaced the placeholder demo with a stateful sign-in flow:
    • Calls GoogleSignIn.configure() + GoogleSignIn.signIn(), stores the returned GoogleUser, and renders a profile view on success
    • Handles errors with isGoogleSignInError() + per-code branching (SIGN_IN_CANCELLED, NO_CREDENTIALS, PLAY_SERVICES_NOT_AVAILABLE)
    • Showcases all button variants — 3 themes × (3 text variants + icon-only), square shape, disabled state
  • example/.env.example — checked-in template documenting the required EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID env var
  • example/src/env.d.ts — small ambient declaration so TypeScript knows about process.env.EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID without pulling in @types/node
  • example/package.json — adds react-native-svg so the example app can render the GoogleLogo SVG (the library declares it as a peer dependency)
  • .gitignore — ignores .env/.env.local while keeping .env.example tracked

Public API

  • src/index.tsx — exports the new GoogleSignInButtonShape and GoogleSignInButtonText types so consumers can type props they pass through

Android

  • android/build.gradle — pins to stable versions instead of alpha tags that weren't resolvable:
    • androidx.credentials:credentials1.5.0
    • androidx.credentials:credentials-play-services-auth1.5.0 (was the unresolvable 17.0-alpha01)
    • com.google.android.libraries.identity.googleid:googleid1.1.1

Demo

screen-20260612-155543-1781276125097.mp4

Test plan

  • yarn typecheck passes
  • Copy example/.env.exampleexample/.env and fill in a real Web Client ID
  • yarn workspace @thoughtbot/react-native-social-auth-example start --clear then yarn android
  • Confirm cd example/android && ./gradlew :app:assembleDebug resolves all credentials/googleid deps (regression check for the version fix)
  • Tap a "Sign in with Google" button → Google bottom sheet appears
  • Complete sign-in → profile view renders with displayName + email
  • Tap sign-out → returns to button gallery
  • Delete .env, restart Metro with --clear, tap sign-in → "Missing config" alert fires (graceful failure check)
  • Verify all three button themes (light/dark/neutral), both shapes (rounded/square), all text variants (signin/signup/continue), icon-only, and disabled state render per Google branding spec

@MalcolmTomisin MalcolmTomisin merged commit 97bca8e into main Jun 19, 2026
6 of 7 checks passed
@rakeshpetit

Copy link
Copy Markdown

Looks good overall. Is the Kotlin code something that we have to write and manage? Are there no existing SDKs for this? Or is the purpose of this project to create Kotlin and Swift based Social login experiences that can be plugged into an existing RN project?

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.

2 participants