sửa l fix xcall api getTrip
This commit is contained in:
@@ -30,19 +30,11 @@ import {
|
||||
convertWKTtoLatLngString,
|
||||
} from "@/utils/geom";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
Animated,
|
||||
Image as RNImage,
|
||||
StyleSheet,
|
||||
View
|
||||
} from "react-native";
|
||||
import { Animated, Image as RNImage, StyleSheet, View } from "react-native";
|
||||
import MapView, { Circle, Marker } from "react-native-maps";
|
||||
|
||||
|
||||
export default function HomeScreen() {
|
||||
const [gpsData, setGpsData] = useState<Model.GPSResonse | null>(
|
||||
null
|
||||
);
|
||||
const [gpsData, setGpsData] = useState<Model.GPSResponse | null>(null);
|
||||
const [alarmData, setAlarmData] = useState<Model.AlarmResponse | null>(null);
|
||||
const [entityData, setEntityData] = useState<
|
||||
Model.TransformedEntity[] | null
|
||||
@@ -54,9 +46,8 @@ export default function HomeScreen() {
|
||||
const [circleRadius, setCircleRadius] = useState(100);
|
||||
const [zoomLevel, setZoomLevel] = useState(10);
|
||||
const [isFirstLoad, setIsFirstLoad] = useState(true);
|
||||
const [polylineCoordinates, setPolylineCoordinates] = useState<
|
||||
PolylineWithLabelProps | null
|
||||
>(null);
|
||||
const [polylineCoordinates, setPolylineCoordinates] =
|
||||
useState<PolylineWithLabelProps | null>(null);
|
||||
const [polygonCoordinates, setPolygonCoordinates] = useState<
|
||||
PolygonWithLabelProps[]
|
||||
>([]);
|
||||
@@ -76,7 +67,7 @@ export default function HomeScreen() {
|
||||
getEntitiesEventBus();
|
||||
getBanzonesEventBus();
|
||||
getTrackPointsEventBus();
|
||||
const queryGpsData = (gpsData: Model.GPSResonse) => {
|
||||
const queryGpsData = (gpsData: Model.GPSResponse) => {
|
||||
if (gpsData) {
|
||||
// console.log("GPS Data: ", gpsData);
|
||||
setGpsData(gpsData);
|
||||
@@ -182,7 +173,6 @@ export default function HomeScreen() {
|
||||
label: zone?.zone_name ?? "",
|
||||
content: zone?.message ?? "",
|
||||
});
|
||||
|
||||
}
|
||||
} else if (geom_type === 1) {
|
||||
// foundPolygon = true;
|
||||
@@ -293,8 +283,9 @@ export default function HomeScreen() {
|
||||
|
||||
return (
|
||||
<View
|
||||
// edges={["top"]}
|
||||
style={styles.container}>
|
||||
// edges={["top"]}
|
||||
style={styles.container}
|
||||
>
|
||||
<MapView
|
||||
onMapReady={handleMapReady}
|
||||
onRegionChangeComplete={handleRegionChangeComplete}
|
||||
@@ -351,7 +342,9 @@ export default function HomeScreen() {
|
||||
|
||||
return (
|
||||
<PolygonWithLabel
|
||||
key={`polygon-${index}-${gpsData?.lat || 0}-${gpsData?.lon || 0}`}
|
||||
key={`polygon-${index}-${gpsData?.lat || 0}-${
|
||||
gpsData?.lon || 0
|
||||
}`}
|
||||
coordinates={polygon.coordinates}
|
||||
label={polygon.label}
|
||||
content={polygon.content}
|
||||
@@ -367,7 +360,11 @@ export default function HomeScreen() {
|
||||
)}
|
||||
{gpsData !== null && (
|
||||
<Marker
|
||||
key={platform === IOS_PLATFORM ? `${gpsData.lat}-${gpsData.lon}` : "gps-data"}
|
||||
key={
|
||||
platform === IOS_PLATFORM
|
||||
? `${gpsData.lat}-${gpsData.lon}`
|
||||
: "gps-data"
|
||||
}
|
||||
coordinate={{
|
||||
latitude: gpsData.lat,
|
||||
longitude: gpsData.lon,
|
||||
@@ -412,10 +409,11 @@ export default function HomeScreen() {
|
||||
height: 32,
|
||||
transform: [
|
||||
{
|
||||
rotate: `${typeof gpsData.h === "number" && !isNaN(gpsData.h)
|
||||
rotate: `${
|
||||
typeof gpsData.h === "number" && !isNaN(gpsData.h)
|
||||
? gpsData.h
|
||||
: 0
|
||||
}deg`,
|
||||
}deg`,
|
||||
},
|
||||
],
|
||||
}}
|
||||
@@ -425,7 +423,7 @@ export default function HomeScreen() {
|
||||
</Marker>
|
||||
)}
|
||||
</MapView>
|
||||
|
||||
|
||||
<View className="absolute top-14 right-2 shadow-md">
|
||||
<SosButton />
|
||||
</View>
|
||||
|
||||
@@ -5,17 +5,15 @@ import CrewListTable from "@/components/tripInfo/CrewListTable";
|
||||
import FishingToolsTable from "@/components/tripInfo/FishingToolsList";
|
||||
import NetListTable from "@/components/tripInfo/NetListTable";
|
||||
import TripCostTable from "@/components/tripInfo/TripCostTable";
|
||||
import { useTrip } from "@/state/use-trip";
|
||||
import { useEffect } from "react";
|
||||
import { Platform, ScrollView, StyleSheet, Text, View } from "react-native";
|
||||
import { SafeAreaView } from "react-native-safe-area-context";
|
||||
|
||||
export default function TripInfoScreen() {
|
||||
const { trip, getTrip } = useTrip();
|
||||
useEffect(() => {
|
||||
getTrip();
|
||||
}, []);
|
||||
|
||||
// const { trip, getTrip } = useTrip();
|
||||
// useEffect(() => {
|
||||
// getTrip();
|
||||
// }, []);
|
||||
|
||||
return (
|
||||
<SafeAreaView style={styles.safeArea} edges={["top", "left", "right"]}>
|
||||
<View style={styles.header}>
|
||||
|
||||
Reference in New Issue
Block a user