Files
Thor 雷神 SchaeffandCharis f14db85bfe expo push notifications guide and example. (#18952)
* feat: add push notifications example.

* feat: add push notifications guide.

* fix: remove trigger.

* chore: americanize.

* Apply suggestions from code review

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Apply suggestions from code review

* Apply suggestions from code review

* chore: run prettier.

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2023-11-16 14:10:15 +08:00

32 lines
795 B
TypeScript

import "react-native-url-polyfill/auto";
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";
import { Session } from "@supabase/supabase-js";
export default function App() {
const [session, setSession] = useState<Session | null>(null);
useEffect(() => {
supabase.auth.getSession().then(({ data: { session } }) => {
setSession(session);
});
supabase.auth.onAuthStateChange((_event, session) => {
setSession(session);
});
}, []);
return (
<View>
{session && session.user ? (
<Account key={session.user.id} session={session} />
) : (
<Auth />
)}
</View>
);
}