@@ -6,6 +6,7 @@ import LogViewer from '@/components/LogViewer';
66import BatteryInfo from '@/components/BatteryInfo' ;
77import { triggerLocalSampleNotification } from '@/utils/notifications.utils' ;
88import { usePushNotifications } from '@/hooks/usePushNotifications' ;
9+ import CustomHeader from '@/components/CustomHeader' ;
910
1011export default function LocationComponent ( ) {
1112 const { fcmToken } = usePushNotifications ( ) ;
@@ -14,77 +15,80 @@ export default function LocationComponent() {
1415 const textColor = '#ffffff' ;
1516
1617 return (
17- < ScrollView contentContainerStyle = { styles . scrollContent } >
18- < View style = { styles . container } >
19- < Image source = { require ( '../../assets/images/icon.png' ) } style = { imgStyles . image } />
18+ < View style = { { flex : 1 } } >
19+ < CustomHeader title = "Home" showModalButton = { true } />
20+ < ScrollView contentContainerStyle = { styles . scrollContent } >
21+ < View style = { styles . container } >
22+ < Image source = { require ( '../../assets/images/icon.png' ) } style = { imgStyles . image } />
2023
21- < LogViewer />
24+ < LogViewer />
2225
23- { /* Battery information */ }
24- < BatteryInfo />
26+ { /* Battery information */ }
27+ < BatteryInfo />
2528
26- { /* Location / Map */ }
27- { loading ? (
28- < ActivityIndicator size = "large" color = "#007AFF" />
29- ) : error ? (
30- < Text style = { [ styles . text , { color : textColor } ] } > { error } </ Text >
31- ) : location && address ? (
32- < >
33- < Text style = { [ styles . text , { color : textColor } ] } >
34- Address: { address . name } , { address . city } , { address . region } , { address . country }
35- </ Text >
36- < Text style = { [ styles . text , { color : textColor } ] } >
37- { location . coords . latitude } - { location . coords . longitude }
38- </ Text >
29+ { /* Location / Map */ }
30+ { loading ? (
31+ < ActivityIndicator size = "large" color = "#007AFF" />
32+ ) : error ? (
33+ < Text style = { [ styles . text , { color : textColor } ] } > { error } </ Text >
34+ ) : location && address ? (
35+ < >
36+ < Text style = { [ styles . text , { color : textColor } ] } >
37+ Address: { address . name } , { address . city } , { address . region } , { address . country }
38+ </ Text >
39+ < Text style = { [ styles . text , { color : textColor } ] } >
40+ { location . coords . latitude } - { location . coords . longitude }
41+ </ Text >
3942
40- < View style = { styles . mapContainer } >
41- < MapView
42- style = { styles . map }
43- region = {
44- location
45- ? {
46- latitude : location . coords . latitude ,
47- longitude : location . coords . longitude ,
48- latitudeDelta : 0.01 ,
49- longitudeDelta : 0.01 ,
50- }
51- : {
52- latitude : 37.7749 , // Default to San Francisco
53- longitude : - 122.4194 ,
54- latitudeDelta : 0.05 ,
55- longitudeDelta : 0.05 ,
56- }
57- }
58- showsUserLocation = { true }
59- loadingEnabled = { true }
60- >
61- { location && (
62- < Marker
63- coordinate = { {
64- latitude : location . coords . latitude ,
65- longitude : location . coords . longitude ,
66- } }
67- title = "You are here"
68- />
69- ) }
70- </ MapView >
71- </ View >
72- </ >
73- ) : (
74- < Text style = { [ styles . text , { color : textColor } ] } > Waiting for location...</ Text >
75- ) }
43+ < View style = { styles . mapContainer } >
44+ < MapView
45+ style = { styles . map }
46+ region = {
47+ location
48+ ? {
49+ latitude : location . coords . latitude ,
50+ longitude : location . coords . longitude ,
51+ latitudeDelta : 0.01 ,
52+ longitudeDelta : 0.01 ,
53+ }
54+ : {
55+ latitude : 37.7749 , // Default to San Francisco
56+ longitude : - 122.4194 ,
57+ latitudeDelta : 0.05 ,
58+ longitudeDelta : 0.05 ,
59+ }
60+ }
61+ showsUserLocation = { true }
62+ loadingEnabled = { true }
63+ >
64+ { location && (
65+ < Marker
66+ coordinate = { {
67+ latitude : location . coords . latitude ,
68+ longitude : location . coords . longitude ,
69+ } }
70+ title = "You are here"
71+ />
72+ ) }
73+ </ MapView >
74+ </ View >
75+ </ >
76+ ) : (
77+ < Text style = { [ styles . text , { color : textColor } ] } > Waiting for location...</ Text >
78+ ) }
7679
77- < Button title = "Get Location" onPress = { fetchLocation } />
78- < Button title = "Trigger Sample Notification" onPress = { triggerLocalSampleNotification } />
80+ < Button title = "Get Location" onPress = { fetchLocation } />
81+ < Button title = "Trigger Sample Notification" onPress = { triggerLocalSampleNotification } />
7982
80- { /* Link to Login page */ }
81- < View style = { { marginTop : 12 } } >
82- < Link href = "/login" asChild >
83- < Button title = "Go to Login" />
84- </ Link >
83+ { /* Link to Login page */ }
84+ < View style = { { marginTop : 12 } } >
85+ < Link href = "/login" asChild >
86+ < Button title = "Go to Login" />
87+ </ Link >
88+ </ View >
8589 </ View >
86- </ View >
87- </ ScrollView >
90+ </ ScrollView >
91+ </ View >
8892 ) ;
8993}
9094
0 commit comments