Fixed bottom nav, added layout.web
This commit is contained in:
parent
8178179ac2
commit
01ca1efa32
62
app/_layout.web.tsx
Normal file
62
app/_layout.web.tsx
Normal file
@ -0,0 +1,62 @@
|
||||
import { useFonts } from 'expo-font';
|
||||
import { Stack } from 'expo-router';
|
||||
import * as SplashScreen from 'expo-splash-screen';
|
||||
import { useEffect } from 'react';
|
||||
import 'react-native-reanimated';
|
||||
import { useColorScheme } from 'react-native';
|
||||
import { PaperProvider, Provider } from "react-native-paper";
|
||||
import { UserProvider, useUser } from "@/context/UserContext";
|
||||
import themes from '@/assets/themes'
|
||||
import log from "@/util/log"
|
||||
|
||||
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
||||
SplashScreen.preventAutoHideAsync();
|
||||
|
||||
export default function RootLayout() {
|
||||
return (
|
||||
<UserProvider>
|
||||
<InnerRootLayout />
|
||||
</UserProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function InnerRootLayout() {
|
||||
const { currentTheme } = useUser(); // Access the currentTheme from UserContext
|
||||
log.debug(currentTheme);
|
||||
const colorScheme = useColorScheme();
|
||||
log.debug(colorScheme);
|
||||
const [loaded] = useFonts({
|
||||
SpaceReg: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
||||
SpaceBold: require('../assets/fonts/SpaceMono-Bold.ttf'),
|
||||
Light: require('../assets/fonts/font-light.otf'),
|
||||
Medium: require('../assets/fonts/font-medium.otf'),
|
||||
Heavy: require('../assets/fonts/font-heavy.otf'),
|
||||
});
|
||||
useEffect(() => {
|
||||
if (loaded) {
|
||||
SplashScreen.hideAsync();
|
||||
}
|
||||
}, [loaded]);
|
||||
|
||||
if (!loaded) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Ensure currentTheme is treated as a valid key, or fallback to 'blue'
|
||||
//const themeKey: 'blue' | 'green' | 'red' | 'yellow' | 'orange' = (currentTheme as 'blue' | 'green' | 'red' | 'yellow' | 'orange') || 'blue';
|
||||
|
||||
// Use the themeKey to index into the themes object
|
||||
|
||||
//const appTheme = themes[themeKey][colorScheme === 'dark' ? 'dark' : 'light'];
|
||||
const appTheme = themes[currentTheme as keyof typeof themes][colorScheme === 'dark' ? 'dark' : 'light']
|
||||
|
||||
return (
|
||||
<Provider>
|
||||
<PaperProvider theme={appTheme}>
|
||||
<Stack>
|
||||
<Stack.Screen name="index" options={{ headerShown: false }} />
|
||||
</Stack>
|
||||
</PaperProvider>
|
||||
</Provider>
|
||||
);
|
||||
}
|
@ -1,15 +1,22 @@
|
||||
import {Appbar, Portal, Button, Dialog, Menu, Text, useTheme} from "react-native-paper";
|
||||
import {Image, useColorScheme, View} from "react-native";
|
||||
import {Appbar, Button, Text, useTheme} from "react-native-paper";
|
||||
import {View} from "react-native";
|
||||
import styles from "@/assets/styles";
|
||||
import React from "react";
|
||||
|
||||
const BottomNav = () => {
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<View style={{ backgroundColor: theme.colors.background }}>
|
||||
<Appbar.Header style={{ backgroundColor: theme.colors.primaryContainer, height: 38 }}>
|
||||
<View style={{ alignItems: 'flex-start', flexDirection: "row", justifyContent: "space-between", padding: 10, flex: 1, paddingHorizontal: 15 }}>
|
||||
<Text style={{ color: theme.colors.primary, fontFamily: "Light"}}>Daisy Knight Dog Park</Text>
|
||||
<Text style={{ color: theme.colors.primary, fontFamily: "Light"}}>(change)</Text>
|
||||
<View style={{ alignItems: "center", flexDirection: "row", justifyContent: "space-between", padding: 10, flex: 1, paddingHorizontal: 15 }}>
|
||||
<Text style={{ color: theme.colors.primary, fontFamily: "Light" }}>Daisy Knight Dog Park</Text>
|
||||
<Button
|
||||
mode="text"
|
||||
onPress={() => null}
|
||||
style={{ backgroundColor: theme.colors.primary, height: 38/2, justifyContent: "center"}}
|
||||
labelStyle={{ color: theme.colors.onPrimary, fontFamily: "Light"}}>
|
||||
Change
|
||||
</Button>
|
||||
</View>
|
||||
</Appbar.Header>
|
||||
</View>
|
||||
|
Loading…
Reference in New Issue
Block a user