mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 01:10:15 -04:00
8f08df1600
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Clarified React Native and Angular auth guides with improved environment setup and JWT validation guidance. * **New Features** * Added a React Native environment template for quickstart. * Example app now uses JWT claims for user state and display. * **Chores** * Replaced UI library components with native React Native components for compatibility. * Updated package configuration and dependency versions. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
30 lines
729 B
TypeScript
30 lines
729 B
TypeScript
import 'react-native-url-polyfill/auto'
|
|
import { useState, useEffect } from 'react'
|
|
import { supabase } from './lib/supabase'
|
|
import Auth from './components/Auth'
|
|
import { View, Text } from 'react-native'
|
|
import { JwtPayload } from '@supabase/supabase-js'
|
|
|
|
export default function App() {
|
|
const [claims, setClaims] = useState<JwtPayload | null>(null)
|
|
|
|
useEffect(() => {
|
|
supabase.auth.getClaims().then(({ data: { claims } }) => {
|
|
setClaims(claims)
|
|
})
|
|
|
|
supabase.auth.onAuthStateChange(() => {
|
|
supabase.auth.getClaims().then(({ data: { claims } }) => {
|
|
setClaims(claims)
|
|
})
|
|
})
|
|
}, [])
|
|
|
|
return (
|
|
<View>
|
|
<Auth />
|
|
{claims && <Text>{claims.sub}</Text>}
|
|
</View>
|
|
)
|
|
}
|