Add back button to dashboard header

The dashboard is a hidden tab screen with the tab bar hidden, so on iOS
there was no way to return home (no hardware back, no swipe gesture on
tabs). Match the construction-site header pattern.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 15:11:55 +02:00
co-authored by Claude Opus 5
parent 5c66e9d5cb
commit 38a868a962
+10 -2
View File
@@ -2,7 +2,8 @@ import React, { useState, useEffect, useMemo, useRef } from 'react';
import { View, Text, ScrollView, TouchableOpacity, ActivityIndicator, Dimensions } from 'react-native'; import { View, Text, ScrollView, TouchableOpacity, ActivityIndicator, Dimensions } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context'; import { SafeAreaView } from 'react-native-safe-area-context';
import { StatusBar } from 'expo-status-bar'; import { StatusBar } from 'expo-status-bar';
import { ChevronDown, ChevronUp, LayoutDashboard } from 'lucide-react-native'; import { useRouter } from 'expo-router';
import { ChevronDown, ChevronLeft, ChevronUp, LayoutDashboard } from 'lucide-react-native';
import api from '@/utils/api'; import api from '@/utils/api';
import EchartWrapper from '@/components/EchartWrapper'; import EchartWrapper from '@/components/EchartWrapper';
import { import {
@@ -22,6 +23,7 @@ const TOOLTIP_BASE = {
const screenWidth = Dimensions.get("window").width; const screenWidth = Dimensions.get("window").width;
export default function DashboardScreen() { export default function DashboardScreen() {
const router = useRouter();
const [chartData, setChartData] = useState<any>({ const [chartData, setChartData] = useState<any>({
costiRicavi: null, costiRicavi: null,
@@ -206,7 +208,13 @@ export default function DashboardScreen() {
<SafeAreaView edges={['top']} className="pt-5"> <SafeAreaView edges={['top']} className="pt-5">
<View className="pb-6 px-6 z-10 flex-row justify-between items-center"> <View className="pb-6 px-6 z-10 flex-row justify-between items-center">
<View> <TouchableOpacity
onPress={() => router.navigate('/')}
className="p-2 -ml-2 rounded-full active:bg-white/20 w-12 items-center justify-center"
>
<ChevronLeft size={28} color="white" pointerEvents="none" />
</TouchableOpacity>
<View className="flex-1 px-2">
<Text className="text-white text-md font-semibold uppercase tracking-wider mb-1">Grafici e Statistiche</Text> <Text className="text-white text-md font-semibold uppercase tracking-wider mb-1">Grafici e Statistiche</Text>
<Text className="text-yellow-400 text-3xl font-bold leading-tight">Dashboard</Text> <Text className="text-yellow-400 text-3xl font-bold leading-tight">Dashboard</Text>
</View> </View>