diff --git a/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx b/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx index 08abb969fa0..0e7a738170c 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx @@ -6,7 +6,7 @@ tocVideo: 'AE7dKIKMJy4' <$Partial path="quickstart_intro.mdx" /> -![Supabase User Management example](/docs/img/supabase-flutter-demo.png) +![Supabase User Management example](/docs/img/supabase-expo-react-native-demo.png) @@ -37,7 +37,7 @@ cd expo-user-management Then install the additional dependencies: ```bash -npx expo install @supabase/supabase-js @rneui/themed expo-sqlite +npx expo install @supabase/supabase-js @react-native-async-storage/async-storage ``` Now create a helper file to initialize the Supabase client using the API URL and the key that you copied [earlier](#get-api-details). @@ -75,7 +75,7 @@ These variables are safe to expose in your Expo app since Supabase has ```bash npm install @supabase/supabase-js - npm install @rneui/themed @react-native-async-storage/async-storage + npm install @react-native-async-storage/async-storage npm install aes-js react-native-get-random-values npm install --save-dev @types/aes-js npx expo install expo-secure-store @@ -156,6 +156,16 @@ These variables are safe to expose in your Expo app since Supabase has +### App styling + +You can use the following `StyleSheet` component in `styles/styles.ts` to add style to the app: + +<$CodeSample +path="/user-management/expo-user-management/styles/styles.ts" +lines={[[1, -1]]} +meta="name=styles/styles.ts" +/> + ### Set up a login component Set up a React Native component to manage logins and sign ups. @@ -177,7 +187,7 @@ While testing, you can disable email confirmation in your [project's email auth ### Account page -After a user signs in, you can let them to edit their profile details and manage their account. +After a user signs in, let them edit their profile details and manage their account. Create a new component for that called `Account.tsx`. diff --git a/apps/docs/public/img/supabase-expo-react-native-demo.png b/apps/docs/public/img/supabase-expo-react-native-demo.png new file mode 100644 index 00000000000..bbb96293d3e Binary files /dev/null and b/apps/docs/public/img/supabase-expo-react-native-demo.png differ diff --git a/examples/user-management/expo-user-management/.prettierrc b/examples/user-management/expo-user-management/.prettierrc deleted file mode 100644 index 76aea4cb1f2..00000000000 --- a/examples/user-management/expo-user-management/.prettierrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "arrowParens": "always", - "bracketSpacing": true, - "bracketSameLine": false, - "endOfLine": "lf", - "jsxSingleQuote": false, - "htmlWhitespaceSensitivity": "ignore", - "printWidth": 100, - "semi": false, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all", - "useTabs": false -} \ No newline at end of file diff --git a/examples/user-management/expo-user-management/App.tsx b/examples/user-management/expo-user-management/App.tsx index d764b062615..faff2bdb5be 100644 --- a/examples/user-management/expo-user-management/App.tsx +++ b/examples/user-management/expo-user-management/App.tsx @@ -1,4 +1,3 @@ -import 'react-native-url-polyfill/auto' import { useState, useEffect } from 'react' import { supabase } from './lib/supabase' import Auth from './components/Auth' diff --git a/examples/user-management/expo-user-management/components/Account.tsx b/examples/user-management/expo-user-management/components/Account.tsx index 7c1acd8ec99..fcb36f502ce 100644 --- a/examples/user-management/expo-user-management/components/Account.tsx +++ b/examples/user-management/expo-user-management/components/Account.tsx @@ -1,14 +1,15 @@ import { useState, useEffect } from 'react' import { supabase } from '../lib/supabase' -import { StyleSheet, View, Alert } from 'react-native' -import { Button, Input } from '@rneui/themed' +import { View, Alert, TextInput, Text, TouchableOpacity } from 'react-native' import Avatar from './Avatar' +import { appStyles } from '../styles/styles' export default function Account({ userId, email }: { userId: string; email?: string }) { const [loading, setLoading] = useState(true) const [username, setUsername] = useState('') const [website, setWebsite] = useState('') const [avatarUrl, setAvatarUrl] = useState('') + const styles = appStyles useEffect(() => { if (userId) getProfile() @@ -66,17 +67,15 @@ export default function Account({ userId, email }: { userId: string; email?: str if (error) { throw error } - } catch (error) { - if (error instanceof Error) { - Alert.alert(error.message) - } + } catch (error: any) { + Alert.alert(error.message) } finally { setLoading(false) } } return ( - + - + Email + - setUsername(text)} /> + Username + setUsername(text)} + style={styles.input} + /> - setWebsite(text)} /> - - - -