updated screens

added keyboard avoiding view to avoid blocking keyboard
This commit is contained in:
suddenlyoranges committed 2026-04-09 22:44:45 +01:00
1 parent 05747933cf
commit fbd95892b5
1 file changed
+28 -26
+28 -26
View File
@@ -1,9 +1,9 @@
import {StatusBar} from 'expo-status-bar'; import { StatusBar } from "expo-status-bar";
import {StyleSheet, View} from 'react-native'; import { KeyboardAvoidingView, Platform, StyleSheet, View } from "react-native";
import {useNavigation, useRoute} from '@react-navigation/native'; import { useNavigation, useRoute } from "@react-navigation/native";
import {useSafeAreaInsets} from 'react-native-safe-area-context'; import { useSafeAreaInsets } from "react-native-safe-area-context";
import TopNavbar from './TopNavbar'; import TopNavbar from "./TopNavbar";
import BottomNavbar from './BottomNavbar'; import BottomNavbar from "./BottomNavbar";
const Screen = ({ children, style, showBack = false }) => { const Screen = ({ children, style, showBack = false }) => {
// Initialisation ------------- // Initialisation -------------
@@ -13,33 +13,34 @@ const Screen = ({children, style, showBack = false}) => {
const insets = useSafeAreaInsets(); const insets = useSafeAreaInsets();
const titleMap = { const titleMap = {
LeaderboardScreen: 'Leaderboard', LeaderboardScreen: "Leaderboard",
TeamScreen: 'Current Team', TeamScreen: "Current Team",
MapScreen: 'Map', MapScreen: "Map",
GameSettingsScreen: 'Game Settings', GameSettingsScreen: "Game Settings",
GameSelectionScreen: 'Games', GameSelectionScreen: "Games",
DepartmentSettingsScreen: 'Department Settings', DepartmentSettingsScreen: "Department Settings",
PlayersScreen: 'Players', PlayersScreen: "Players",
ExpandedMapScreen: 'Map View', ExpandedMapScreen: "Map View",
GlobalEventsScreen: 'Global Events', GlobalEventsScreen: "Global Events",
GlobalMapScreen: 'Global Map', GlobalMapScreen: "Global Map",
GlobalCacheViewScreen: 'Cache Details', GlobalCacheViewScreen: "Cache Details",
GlobalLeaderboardScreen: 'Global Leaderboard', GlobalLeaderboardScreen: "Global Leaderboard",
GlobalProfileScreen: 'Global Profile', GlobalProfileScreen: "Global Profile",
}; };
// State ---------------------- // State ----------------------
const routeName = route.name; const routeName = route.name;
const isAuthScreen = routeName === 'LoginScreen' || routeName === 'RegisterScreen'; const isAuthScreen =
const isGlobalRoute = routeName.startsWith('Global'); routeName === "LoginScreen" || routeName === "RegisterScreen";
const pageTitle = titleMap[routeName] || 'Treasure Hunt'; const isGlobalRoute = routeName.startsWith("Global");
const pageTitle = titleMap[routeName] || "Treasure Hunt";
// Handlers ------------------- // Handlers -------------------
// View ----------------------- // View -----------------------
return ( return (
<View <KeyboardAvoidingView
style={[ style={[
styles.screen, styles.screen,
isAuthScreen && { isAuthScreen && {
@@ -47,6 +48,7 @@ const Screen = ({children, style, showBack = false}) => {
paddingBottom: insets.bottom, paddingBottom: insets.bottom,
}, },
]} ]}
behavior={Platform.OS === "ios" ? "padding" : "height"}
> >
{!isAuthScreen && ( {!isAuthScreen && (
<TopNavbar <TopNavbar
@@ -65,20 +67,20 @@ const Screen = ({children, style, showBack = false}) => {
/> />
)} )}
<StatusBar style="light" /> <StatusBar style="light" />
</View> </KeyboardAvoidingView>
); );
}; };
const styles = StyleSheet.create({ const styles = StyleSheet.create({
screen: { screen: {
flex: 1, flex: 1,
backgroundColor: '#1e1e2e', backgroundColor: "#1e1e2e",
}, },
content: { content: {
flex: 1, flex: 1,
padding: 15, padding: 15,
zIndex: 1, zIndex: 1,
overflow: 'hidden', overflow: "hidden",
}, },
}); });