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