chore: fix updates
This commit is contained in:
+19
-1
@@ -1,8 +1,9 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { StatusBar } from "expo-status-bar";
|
||||
import { ActivityIndicator, View } from "react-native";
|
||||
import { NavigationContainer } from "@react-navigation/native";
|
||||
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
||||
import * as Updates from "expo-updates";
|
||||
|
||||
import { AuthProvider, useAuth } from "./src/auth/AuthContext";
|
||||
import { CartProvider } from "./src/context/CartContext";
|
||||
@@ -99,6 +100,23 @@ function RootNavigator() {
|
||||
|
||||
function AppContent() {
|
||||
const { isDark } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
if (__DEV__) return;
|
||||
const checkForUpdate = async () => {
|
||||
try {
|
||||
const update = await Updates.checkForUpdateAsync();
|
||||
if (update.isAvailable) {
|
||||
await Updates.fetchUpdateAsync();
|
||||
await Updates.reloadAsync();
|
||||
}
|
||||
} catch {
|
||||
// Silently ignore update errors
|
||||
}
|
||||
};
|
||||
checkForUpdate();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<NavigationContainer>
|
||||
<RootNavigator />
|
||||
|
||||
Reference in New Issue
Block a user