diff --git a/packages/examples/src/examples/Map/CreateOfflineRegion.tsx b/packages/examples/src/examples/Map/CreateOfflineRegion.tsx index 676743838..bf006c353 100755 --- a/packages/examples/src/examples/Map/CreateOfflineRegion.tsx +++ b/packages/examples/src/examples/Map/CreateOfflineRegion.tsx @@ -2,7 +2,7 @@ import geoViewport from "@mapbox/geo-viewport"; import MapLibreGL, { OfflinePack, type OfflinePackError, - type OfflineProgressStatus, + type OfflinePackStatus, } from "@maplibre/maplibre-react-native"; import { useEffect, useState } from "react"; import { @@ -69,7 +69,7 @@ function getRegionDownloadState(downloadState: OfflinePackDownloadState) { export default function CreateOfflineRegion() { const [offlineRegionStatus, setOfflineRegionStatus] = - useState(null); + useState(null); const [offlinePack, setOfflinePack] = useState(null); const [isLoading, setIsLoading] = useState(true); @@ -79,10 +79,7 @@ export default function CreateOfflineRegion() { }; }, []); - function onDownloadProgress( - pack: OfflinePack, - status: OfflineProgressStatus, - ) { + function onDownloadProgress(pack: OfflinePack, status: OfflinePackStatus) { setOfflinePack(pack); setOfflineRegionStatus(status); } diff --git a/src/MapLibreRN.ts b/src/MapLibreRN.ts index e60cb9288..4101f24f9 100644 --- a/src/MapLibreRN.ts +++ b/src/MapLibreRN.ts @@ -47,10 +47,7 @@ export { type Location, } from "./modules/location/locationManager"; export { default as offlineManager } from "./modules/offline/offlineManager"; -export type { - OfflineProgressStatus, - OfflinePackError, -} from "./modules/offline/offlineManager"; +export type { OfflinePackError } from "./modules/offline/offlineManager"; export type { OfflinePackStatus } from "./modules/offline/OfflinePack"; export { default as OfflinePack } from "./modules/offline/OfflinePack"; export { default as OfflineCreatePackOptions } from "./modules/offline/OfflineCreatePackOptions"; diff --git a/src/modules/offline/OfflinePack.ts b/src/modules/offline/OfflinePack.ts index b680240f0..6503e883f 100644 --- a/src/modules/offline/OfflinePack.ts +++ b/src/modules/offline/OfflinePack.ts @@ -10,8 +10,8 @@ export type OfflinePackStatus = { percentage: number; completedResourceCount: number; completedResourceSize: number; - completedTileSize: number; completedTileCount: number; + completedTileSize: number; requiredResourceCount: number; }; diff --git a/src/modules/offline/offlineManager.ts b/src/modules/offline/offlineManager.ts index 0daf5ac7e..ad3723a92 100644 --- a/src/modules/offline/offlineManager.ts +++ b/src/modules/offline/offlineManager.ts @@ -7,7 +7,7 @@ import { import OfflineCreatePackOptions, { type OfflineCreatePackInputOptions, } from "./OfflineCreatePackOptions"; -import OfflinePack from "./OfflinePack"; +import OfflinePack, { type OfflinePackStatus } from "./OfflinePack"; import { isUndefined, isFunction, isAndroid } from "../../utils"; const MapLibreRN = NativeModules.MLRNModule; @@ -16,17 +16,6 @@ export const OfflineModuleEventEmitter = new NativeEventEmitter( MLRNOfflineModule, ); -export type OfflineProgressStatus = { - name: string; - state: number; - percentage: number; - completedResourceSize: number; - completedTileCount: number; - completedResourceCount: number; - requiredResourceCount: number; - completedTileSize: number; -}; - export type OfflinePackError = { name: string; message: string; @@ -37,13 +26,10 @@ type ErrorEvent = { }; type ProgressEvent = { - payload: OfflineProgressStatus; + payload: OfflinePackStatus; }; -type ProgressListener = ( - pack: OfflinePack, - status: OfflineProgressStatus, -) => void; +type ProgressListener = (pack: OfflinePack, status: OfflinePackStatus) => void; type ErrorListener = (pack: OfflinePack, err: OfflinePackError) => void; /**