Skip to content

Commit

Permalink
Merge pull request #58 from flemingvincent/feature/handle-token-refresh
Browse files Browse the repository at this point in the history
Fixed token refresh issue, updated docs and welcome screen, updated d…
  • Loading branch information
flemingvincent authored Oct 4, 2024
2 parents 27830e9 + 1ebbf00 commit 8721946
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ npm-debug.*
*.orig.*
web-build/


# Ignore .env file
.env

.cursorrules

# macOS
.DS_Store
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
Expand Down
4 changes: 2 additions & 2 deletions app/(app)/welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default function WelcomeScreen() {
/>
<H1 className="text-center">Welcome to Expo Supabase Starter</H1>
<Muted className="text-center">
A comprehensive starter project for developing Expo applications with
Supabase as the backend.
A comprehensive starter project for developing React Native and Expo
applications with Supabase as the backend.
</Muted>
</View>
<View className="flex flex-col gap-y-4 web:m-4">
Expand Down
9 changes: 9 additions & 0 deletions config/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "react-native-url-polyfill/auto";

import AsyncStorage from "@react-native-async-storage/async-storage";
import { createClient } from "@supabase/supabase-js";
import { AppState } from "react-native";

const supabaseUrl = process.env.EXPO_PUBLIC_API_URL as string;
const supabaseKey = process.env.EXPO_PUBLIC_API_KEY as string;
Expand All @@ -14,3 +15,11 @@ export const supabase = createClient(supabaseUrl, supabaseKey, {
detectSessionInUrl: false,
},
});

AppState.addEventListener("change", (state) => {
if (state === "active") {
supabase.auth.startAutoRefresh();
} else {
supabase.auth.stopAutoRefresh();
}
});
2 changes: 2 additions & 0 deletions docs/project-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ root
|
+-- config # This directory contains all the configuration files for your application.
|
+-- constants # This directory contains all the constants used within the application.
|
+-- context # This directory contains all the providers used within the application.
|
+-- lib # This directory contains different libraries preconfigured for the application.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@supabase/supabase-js": "^2.45.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"expo": "~51.0.35",
"expo": "~51.0.36",
"expo-constants": "~16.0.2",
"expo-image": "~1.13.0",
"expo-linking": "~6.3.1",
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3994,10 +3994,10 @@ expo-linking@~6.3.1:
expo-constants "~16.0.0"
invariant "^2.2.4"

[email protected].2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-1.11.2.tgz#98245eb66f157bbfebebd2d576256ea7c683c605"
integrity sha512-fdcaNO8ucHA3yLNY52ZUENBcAG7KEx8QyMmnVNavO1JVBGRMZG8JyVcbrhYQDtVtpxkbai5YzwvLutINvbDZDQ==
[email protected].3:
version "1.11.3"
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-1.11.3.tgz#bc64d278c04015014bb5802e3cfcd942d7c07168"
integrity sha512-oYh8EZEvYF5TYppxEKUTTJmbr8j7eRRnrIxzZtMvxLTXoujThVPMFS/cbnSnf2bFm1lq50TdDNABhmEi7z0ngQ==
dependencies:
chalk "^4.1.0"
commander "^7.2.0"
Expand All @@ -4007,10 +4007,10 @@ [email protected]:
require-from-string "^2.0.2"
resolve-from "^5.0.0"

[email protected].24:
version "1.12.24"
resolved "https://registry.yarnpkg.com/expo-modules-core/-/expo-modules-core-1.12.24.tgz#8c35a16ed6ecb8997f6bd527fc95a8c22f343602"
integrity sha512-3geIe2ecizlp7l26iY8Nmc59z2d1RUC5nQZtI9iJoi5uHEUV/zut8e4zRLFVnZb8KOcMcEDsrvaBL5DPnqdfpg==
[email protected].25:
version "1.12.25"
resolved "https://registry.yarnpkg.com/expo-modules-core/-/expo-modules-core-1.12.25.tgz#9ec8d8762da92d961ab1044817da033ae617c9f4"
integrity sha512-HB2LS2LEM41Xq1bG+Jtzqm6XgPaa+mM9BAvCdX1lDGMQ9Ay9vMTL/GVEs2gpsINPofICopjBRwD+wftyCbVrzg==
dependencies:
invariant "^2.2.4"

Expand Down Expand Up @@ -4054,10 +4054,10 @@ expo-system-ui@~3.0.7:
"@react-native/normalize-colors" "0.74.85"
debug "^4.3.2"

expo@~51.0.35:
version "51.0.35"
resolved "https://registry.yarnpkg.com/expo/-/expo-51.0.35.tgz#08c78785e6510e010b4b43c3bc89718d6ae616bc"
integrity sha512-sSYor9C8oAmHcYfW50gxdLEug8xVO3+cE9eX49caiWj6Xp9hkYvDNw/PxLY/mm84DYq79FAbOWj6KAOYChO4Sw==
expo@~51.0.36:
version "51.0.36"
resolved "https://registry.yarnpkg.com/expo/-/expo-51.0.36.tgz#546fe4ec1670660b50088bb19e640732757c0c3a"
integrity sha512-eQIC0l6fz3p4cU/hV8+QcyKSacyROhaoA1oohfCD6I3F09dxmC8b3SESpzGqHfuq8wsgcUc4q8ckX7ec25IV1g==
dependencies:
"@babel/runtime" "^7.20.0"
"@expo/cli" "0.18.30"
Expand All @@ -4070,8 +4070,8 @@ expo@~51.0.35:
expo-file-system "~17.0.1"
expo-font "~12.0.10"
expo-keep-awake "~13.0.2"
expo-modules-autolinking "1.11.2"
expo-modules-core "1.12.24"
expo-modules-autolinking "1.11.3"
expo-modules-core "1.12.25"
fbemitter "^3.0.0"
whatwg-url-without-unicode "8.0.0-3"

Expand Down

0 comments on commit 8721946

Please sign in to comment.