diff --git a/app/StatusPage.tsx b/app/StatusPage.tsx index d02f86a..2d39a67 100644 --- a/app/StatusPage.tsx +++ b/app/StatusPage.tsx @@ -73,8 +73,8 @@ interface StatusProps { } const StatusPage: React.FC = ({ id, name, image, currentStatus, setStatus, isProfileActive }) => { - console.log("WebSocket URL: ", WS_URL); - console.log("API URL: ", API_URL); + //console.log("WebSocket URL: ", WS_URL); + //console.log("API URL: ", API_URL); const theme = useTheme(); const [messages, setMessages] = useState([]); const { lastMessage } = useWebSocket(WS_URL + "/ws", { diff --git a/app/_layout.tsx b/app/_layout.tsx index 82061eb..279c411 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -1,12 +1,11 @@ -import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'; import { useFonts } from 'expo-font'; import { Stack } from 'expo-router'; import * as SplashScreen from 'expo-splash-screen'; -import { StatusBar } from 'expo-status-bar'; import { useEffect } from 'react'; import 'react-native-reanimated'; import { useColorScheme } from 'react-native'; -import { Provider } from "react-native-paper"; +import { PaperProvider, Provider } from "react-native-paper"; +import { themes } from '@/app/themes' // Prevent the splash screen from auto-hiding before asset loading is complete. SplashScreen.preventAutoHideAsync(); @@ -27,15 +26,16 @@ export default function RootLayout() { if (!loaded) { return null; } - + const selectedTheme = 'green'; + //const [selectedTheme, setSelectedTheme] = useState<'red' | 'blue' | 'yellow' | 'green' | 'orange'>('red'); + const appTheme = themes[selectedTheme][colorScheme === 'dark' ? 'dark' : 'light']; return ( - - + - + ); } diff --git a/app/index.tsx b/app/index.tsx index 8c9fe0e..f5191f6 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -7,11 +7,10 @@ import ProfileScreen from "@/app/ProfileScreen"; import StatusPage from "@/app/StatusPage"; import Nav from "@/app/Nav"; import axios from "axios"; - export const API_URL = process.env.EXPO_PUBLIC_API_URL; const Index = () => { - const { colors } = useTheme(); + const theme = useTheme(); const [isProfileActive, setProfileActive] = useState(false); const [userId, setUserId] = useState(""); const [userName, setUserName] = useState(""); @@ -68,10 +67,12 @@ const Index = () => { useEffect(() => { const handleAppStateChange = (nextAppState: string) => { + //console.log("App state", appState); + //console.log("Next App state", nextAppState); if (appState.match(/inactive|background/) && nextAppState === "active") { // When the app comes to the foreground, fetch the status if (!isLoading) { - fetchCurrentStatus().then(r => null); + fetchCurrentStatus().then() } else { console.log("Waiting for loading to complete before fetching status..."); } @@ -104,14 +105,14 @@ const Index = () => { if (isLoading) { console.log("Still loading"); return ( - + Loading... ); } return ( - +