Files
supabase/examples/user-management/expo-user-management/App.tsx
b99a9ea416 docs: react native expo user management update (#42300)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Docs - [React Native Expo user management
guide](https://supabase.com/docs/guides/getting-started/tutorials/with-expo-react-native)

## What is the new behavior?

Guide has been updated to be in line with #42269 

- Removing `@rneui/themed` package and using native components.
- Update guide screenshot.
- Main stylesheet for the example.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Documentation
- Updated Expo React Native tutorial with modernized component approach
using React Native primitives and centralized styling patterns.
- Simplified codebase examples with consistent formatting and improved
maintainability.
- Core functionality preserved with updated implementation patterns.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-23 12:09:10 +01:00

35 lines
966 B
TypeScript

import { useState, useEffect } from 'react'
import { supabase } from './lib/supabase'
import Auth from './components/Auth'
import Account from './components/Account'
import { View } from 'react-native'
export default function App() {
const [userId, setUserId] = useState<string | null>(null)
const [email, setEmail] = useState<string | undefined>(undefined)
useEffect(() => {
supabase.auth.getClaims().then(({ data: { claims } }) => {
if (claims) {
setUserId(claims.sub)
setEmail(claims.email)
}
})
supabase.auth.onAuthStateChange(async (_event, _session) => {
const {
data: { claims },
} = await supabase.auth.getClaims()
if (claims) {
setUserId(claims.sub)
setEmail(claims.email)
} else {
setUserId(null)
setEmail(undefined)
}
})
}, [])
return <View>{userId ? <Account key={userId} userId={userId} email={email} /> : <Auth />}</View>
}