import { showToastError } from "@/config"; import { fetchGpsData } from "@/controller/DeviceController"; import { useState } from "react"; import { StyleSheet, Text, TouchableOpacity } from "react-native"; import MapView, { Marker } from "react-native-maps"; import { SafeAreaProvider } from "react-native-safe-area-context"; export default function HomeScreen() { const [gpsData, setGpsData] = useState(null); // useEffect(() => { // getGpsData(); // }, []); const getGpsData = async () => { try { const response = await fetchGpsData(); console.log("GpsData: ", response.data); setGpsData(response.data); } catch (error) { showToastError("Lỗi", "Không thể lấy dữ liệu GPS"); } }; return ( {gpsData && ( )} Get GPS Data ); } const styles = StyleSheet.create({ container: { flex: 1, }, map: { flex: 1, }, button: { position: "absolute", top: 50, right: 20, backgroundColor: "#007AFF", paddingHorizontal: 16, paddingVertical: 12, borderRadius: 8, elevation: 5, shadowColor: "#000", shadowOffset: { width: 0, height: 2, }, shadowOpacity: 0.25, shadowRadius: 3.84, }, buttonText: { color: "#fff", fontSize: 16, fontWeight: "600", }, titleContainer: { flexDirection: "row", alignItems: "center", gap: 8, }, stepContainer: { gap: 8, marginBottom: 8, }, reactLogo: { height: 178, width: 290, bottom: 0, left: 0, position: "absolute", }, });