diff --git a/apps/reference/docs/guides/with-expo.mdx b/apps/reference/docs/guides/with-expo.mdx index e10b5a6c564..6419ac9d0cc 100644 --- a/apps/reference/docs/guides/with-expo.mdx +++ b/apps/reference/docs/guides/with-expo.mdx @@ -8,6 +8,12 @@ sidebar_label: Expo import Tabs from '@theme/Tabs' import TabItem from '@theme/TabItem' +:::note + +This guide uses supabase-js v2.0.0 Release Candidate (RC). + +::: + ## Intro This example provides the steps to build a simple user management app (from scratch!) using Supabase and React Native. It includes: @@ -138,23 +144,19 @@ Let's start building the React Native app from scratch. ### Initialize a React Native app We can use [`expo`](https://docs.expo.dev/get-started/create-a-new-app/) to initialize -an app called `supabaseReactNative`: +an app called `expo-user-management`: ```bash -#select the "Blank (TypeScript)" template when prompted -expo init supabaseReactNative +npx create-expo-app -t expo-template-blank-typescript expo-user-management -cd supabaseReactNative +cd expo-user-management ``` Then let's install the additional dependencies: [supabase-js](https://github.com/supabase/supabase-js) ```bash -yarn add @supabase/supabase-js -yarn add react-native-elements -yarn add react-native-safe-area-context -yarn add @react-native-async-storage/async-storage -yarn add react-native-url-polyfill +npm install @supabase/supabase-js@rc +npm install react-native-elements @react-native-async-storage/async-storage react-native-url-polyfill ``` Now let's create a helper file to initialize the Supabase client. @@ -170,11 +172,13 @@ const supabaseUrl = YOUR_REACT_NATIVE_SUPABASE_URL const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_ANON_KEY export const supabase = createClient(supabaseUrl, supabaseAnonKey, { - localStorage: AsyncStorage as any, - autoRefreshToken: true, - persistSession: true, - detectSessionInUrl: false, -}); + auth: { + storage: AsyncStorage as any, + autoRefreshToken: true, + persistSession: true, + detectSessionInUrl: false, + }, +}) ``` ### Set up a Login component @@ -195,7 +199,7 @@ export default function Auth() { async function signInWithEmail() { setLoading(true) - const { user, error } = await supabase.auth.signIn({ + const { error } = await supabase.auth.signInWithPassword({ email: email, password: password, }) @@ -206,7 +210,7 @@ export default function Auth() { async function signUpWithEmail() { setLoading(true) - const { user, error } = await supabase.auth.signUp({ + const { error } = await supabase.auth.signUp({ email: email, password: password, }) @@ -239,18 +243,10 @@ export default function Auth() { /> -