Fix map re-mount issue
parent
b0b0da447c
commit
7c99b629fc
|
|
@ -16,6 +16,9 @@
|
||||||
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
|
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
|
||||||
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
|
||||||
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.geo.API_KEY"
|
||||||
|
android:value="AIzaSyBfz20PwTeQkeMonsgXETOViBAy9LOBlXY"/>
|
||||||
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
|
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,7 @@ export default function HomeScreen() {
|
||||||
latitudeDelta: 0.0922,
|
latitudeDelta: 0.0922,
|
||||||
longitudeDelta: 0.0421,
|
longitudeDelta: 0.0421,
|
||||||
}}
|
}}
|
||||||
|
// customMapStyle={mapStyle}
|
||||||
>
|
>
|
||||||
<Marker
|
<Marker
|
||||||
draggable
|
draggable
|
||||||
|
|
|
||||||
|
|
@ -13,30 +13,60 @@ const BatteryDetails = () => {
|
||||||
const vimId = data?.batteries[0]?.vim_id ?? "---";
|
const vimId = data?.batteries[0]?.vim_id ?? "---";
|
||||||
const serialNumber = data?.batteries[0]?.serial_no ?? "---";
|
const serialNumber = data?.batteries[0]?.serial_no ?? "---";
|
||||||
const chargerUid = data?.batteries[0]?.charger_uid ?? "---";
|
const chargerUid = data?.batteries[0]?.charger_uid ?? "---";
|
||||||
const start = new Date(warrantyStartDate);
|
const battery = data?.batteries?.[0];
|
||||||
const end = new Date(warrantyEndDate);
|
|
||||||
|
const start = battery?.warranty_start_date
|
||||||
|
? new Date(battery.warranty_start_date)
|
||||||
|
: null;
|
||||||
|
const end = battery?.warranty_end_date
|
||||||
|
? new Date(battery.warranty_end_date)
|
||||||
|
: null;
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
const totalDuration = end.getTime() - start.getTime();
|
let progress = 0;
|
||||||
const elapsed = now.getTime() - start.getTime();
|
let durationText = "---";
|
||||||
const remaining = Math.max(end.getTime() - now.getTime(), 0);
|
|
||||||
|
|
||||||
const progress = Math.min(elapsed / totalDuration, 1);
|
if (
|
||||||
|
start &&
|
||||||
|
end &&
|
||||||
|
!isNaN(start.getTime()) &&
|
||||||
|
!isNaN(end.getTime()) &&
|
||||||
|
now < end
|
||||||
|
) {
|
||||||
|
const totalDuration = end.getTime() - start.getTime();
|
||||||
|
const elapsed = now.getTime() - start.getTime();
|
||||||
|
const remaining = Math.max(end.getTime() - now.getTime(), 0);
|
||||||
|
|
||||||
const yearsLeft = Math.floor(remaining / (365.25 * 24 * 60 * 60 * 1000));
|
progress = Math.min(elapsed / totalDuration, 1);
|
||||||
const monthsLeft = Math.floor(
|
|
||||||
(remaining % (365.25 * 24 * 60 * 60 * 1000)) / (30.44 * 24 * 60 * 60 * 1000)
|
|
||||||
);
|
|
||||||
const daysLeft = Math.floor(
|
|
||||||
(remaining % (30.44 * 24 * 60 * 60 * 1000)) / (24 * 60 * 60 * 1000)
|
|
||||||
);
|
|
||||||
|
|
||||||
const formatDate = (date: Date): string =>
|
const yearsLeft = Math.floor(remaining / (365.25 * 24 * 60 * 60 * 1000));
|
||||||
date.toLocaleDateString("en-GB", {
|
const monthsLeft = Math.floor(
|
||||||
day: "2-digit",
|
(remaining % (365.25 * 24 * 60 * 60 * 1000)) /
|
||||||
month: "short",
|
(30.44 * 24 * 60 * 60 * 1000)
|
||||||
year: "numeric",
|
);
|
||||||
});
|
const daysLeft = Math.floor(
|
||||||
|
(remaining % (30.44 * 24 * 60 * 60 * 1000)) / (24 * 60 * 60 * 1000)
|
||||||
|
);
|
||||||
|
|
||||||
|
durationText = `${yearsLeft} years, ${monthsLeft} months, ${daysLeft} days`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatDate = (date?: Date | null): string =>
|
||||||
|
date && !isNaN(date.getTime())
|
||||||
|
? date.toLocaleDateString("en-GB", {
|
||||||
|
day: "2-digit",
|
||||||
|
month: "short",
|
||||||
|
year: "numeric",
|
||||||
|
})
|
||||||
|
: "---";
|
||||||
|
|
||||||
|
const isInWarranty =
|
||||||
|
start &&
|
||||||
|
end &&
|
||||||
|
now >= start &&
|
||||||
|
now <= end &&
|
||||||
|
!isNaN(start.getTime()) &&
|
||||||
|
!isNaN(end.getTime());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView contentContainerStyle={styles.container}>
|
<ScrollView contentContainerStyle={styles.container}>
|
||||||
|
|
@ -44,9 +74,11 @@ const BatteryDetails = () => {
|
||||||
<View style={styles.card}>
|
<View style={styles.card}>
|
||||||
<View style={styles.cardHeader}>
|
<View style={styles.cardHeader}>
|
||||||
<Text style={styles.cardTitle}>Battery</Text>
|
<Text style={styles.cardTitle}>Battery</Text>
|
||||||
<View style={styles.badge}>
|
{isInWarranty && (
|
||||||
<Text style={styles.badgeText}>In Warranty</Text>
|
<View style={styles.badge}>
|
||||||
</View>
|
<Text style={styles.badgeText}>In Warranty</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.divider} />
|
<View style={styles.divider} />
|
||||||
<InfoRow label="Model" value={model} />
|
<InfoRow label="Model" value={model} />
|
||||||
|
|
@ -60,18 +92,17 @@ const BatteryDetails = () => {
|
||||||
<View style={styles.divider} />
|
<View style={styles.divider} />
|
||||||
<InfoRow label="Start Date" value={formatDate(start)} />
|
<InfoRow label="Start Date" value={formatDate(start)} />
|
||||||
<InfoRow label="End Date" value={formatDate(end)} />
|
<InfoRow label="End Date" value={formatDate(end)} />
|
||||||
<InfoRow
|
<InfoRow label="Duration Left" value={durationText} />
|
||||||
label="Duration Left"
|
{start && end && !isNaN(start.getTime()) && !isNaN(end.getTime()) && (
|
||||||
value={`${yearsLeft} years, ${monthsLeft} months, ${daysLeft} days`}
|
<View style={styles.progressBarBackground}>
|
||||||
/>
|
<View
|
||||||
<View style={styles.progressBarBackground}>
|
style={[
|
||||||
<View
|
styles.progressBarFill,
|
||||||
style={[
|
{ width: `${(1 - progress) * 100}%` },
|
||||||
styles.progressBarFill,
|
]}
|
||||||
{ width: `${(1 - progress) * 100}%` },
|
/>
|
||||||
]}
|
</View>
|
||||||
/>
|
)}
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* VIM Details */}
|
{/* VIM Details */}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ export const BASE_URL = "https://dev-driver-saathi-api.vecmocon.com";
|
||||||
// const SERVER_URL =
|
// const SERVER_URL =
|
||||||
// "http://dev.vec-tr.ai:8089/?dashboardId=deviceDashboardSocket&assetId=V16000868651064644504";
|
// "http://dev.vec-tr.ai:8089/?dashboardId=deviceDashboardSocket&assetId=V16000868651064644504";
|
||||||
export const VECTOR_BASE_URL = "https://vec-tr.ai";
|
export const VECTOR_BASE_URL = "https://vec-tr.ai";
|
||||||
|
export const SOCKET_BASE_URL = "wss://vec-tr.ai";
|
||||||
|
|
||||||
export const STORAGE_KEYS = {
|
export const STORAGE_KEYS = {
|
||||||
LANGUAGE: "userLanguage",
|
LANGUAGE: "userLanguage",
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
"react-i18next": "^15.5.3",
|
"react-i18next": "^15.5.3",
|
||||||
"react-native": "0.79.4",
|
"react-native": "0.79.4",
|
||||||
"react-native-element-dropdown": "^2.12.4",
|
"react-native-element-dropdown": "^2.12.4",
|
||||||
"react-native-maps": "^1.24.3",
|
"react-native-maps": "1.24.2",
|
||||||
"react-native-otp-entry": "^1.8.5",
|
"react-native-otp-entry": "^1.8.5",
|
||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-reanimated": "~3.17.4",
|
"react-native-reanimated": "~3.17.4",
|
||||||
|
|
@ -11979,9 +11979,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-native-maps": {
|
"node_modules/react-native-maps": {
|
||||||
"version": "1.24.3",
|
"version": "1.24.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-maps/-/react-native-maps-1.24.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-maps/-/react-native-maps-1.24.2.tgz",
|
||||||
"integrity": "sha512-cF5oTA8z24QqGIRFfDcsXLEs/gCd0RhaJ9KPv/2HiogKD5gpjh1naimZUJQ6IsEcUngSSk8iov6p2jd7dB+/bQ==",
|
"integrity": "sha512-MiMKe/dUQe6g85Bdmr0QD+kNt9dXK/fuhTVx1NcfR5PWaWOD6K9Shs6RL522tXKfNorDmX3bkUdBYvn86yM+6w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/geojson": "^7946.0.13"
|
"@types/geojson": "^7946.0.13"
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
"react-i18next": "^15.5.3",
|
"react-i18next": "^15.5.3",
|
||||||
"react-native": "0.79.4",
|
"react-native": "0.79.4",
|
||||||
"react-native-element-dropdown": "^2.12.4",
|
"react-native-element-dropdown": "^2.12.4",
|
||||||
"react-native-maps": "^1.24.3",
|
"react-native-maps": "1.24.2",
|
||||||
"react-native-otp-entry": "^1.8.5",
|
"react-native-otp-entry": "^1.8.5",
|
||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-reanimated": "~3.17.4",
|
"react-native-reanimated": "~3.17.4",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue