We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapbox
10.0.11
Android
@rnmapbox/maps
import geoViewport from '@mapbox/geo-viewport'; import Mapbox, { Camera, MapView, offlineManager, StyleURL, } from '@rnmapbox/maps'; import React, { useState } from 'react'; import { Button, Dimensions, TextInput } from 'react-native';
const CENTER_COORD: [number, number] = [-73.970895, 40.723279]; const MAPBOX_VECTOR_TILE_SIZE = 512; console.log('=> Mapbox[0]:', Mapbox); console.log('=> Mapbox.StyleURL[1]:', Mapbox.StyleURL); console.log('=> StyleURL[2]:', StyleURL); const STYLE_URL = Mapbox.StyleURL.Satellite;
const OfflineExample = () => { const [packName, setPackName] = useState('pack-1'); const [showEditTitle, setShowEditTitle] = useState(false);
return ( <> <Button title={Pack name: ${packName}} onPress={() => { setShowEditTitle(!showEditTitle); }} /> {showEditTitle && ( <TextInput value={packName} autoFocus={true} onChangeText={(text) => setPackName(text)} onBlur={() => setShowEditTitle(false)} /> )} <Button title="Get all packs" onPress={async () => { const packs = await offlineManager.getPacks(); console.log('=> packs:', packs); packs.forEach((pack) => { console.log( 'pack:', pack, 'name:', pack.name, 'bounds:', pack?.bounds, 'metadata', pack?.metadata, ); }); }} /> <Button title="Get pack" onPress={async () => { const pack = await offlineManager.getPack(packName); if (pack) { console.log( 'pack:', pack, 'name:', pack.name, 'bounds:', pack?.bounds, 'metadata', pack?.metadata, );
Pack name: ${packName}
console.log('=> status', await pack?.status()); } }} /> <Button title="Resume pack" onPress={async () => { const pack = await offlineManager.getPack(packName); if (pack) { await pack.resume(); } }} /> <Button title="Remove packs" onPress={async () => { const result = await offlineManager.resetDatabase(); console.log('Reset DB done:', result); }} /> <Button title="Create Pack" onPress={() => { const { width, height } = Dimensions.get('window'); const bounds: [number, number, number, number] = geoViewport.bounds( CENTER_COORD, 12, [width, height], MAPBOX_VECTOR_TILE_SIZE, ); const options = { name: packName, styleURL: STYLE_URL, bounds: [ [bounds[0], bounds[1]], [bounds[2], bounds[3]], ] as [[number, number], [number, number]], minZoom: 10, maxZoom: 20, metadata: { whatIsThat: 'foo', }, }; offlineManager.createPack(options, (region, status) => console.log('=> progress callback region:', 'status: ', status), ); }} /> <MapView style={{ flex: 1 }} styleURL={STYLE_URL}> <Camera zoomLevel={10} centerCoordinate={CENTER_COORD} /> </MapView> </>
); };
export default OfflineExample;
/* end-example-doc */
const metadata: ExampleWithMetadata['metadata'] = { title: 'Offline Example', tags: [ 'offlineManager#createPack', 'offlineManager#getPack', 'offlineManager#getPacks', ], docs: Demonstates basic use of offlineManager api., }; OfflineExample.metadata = metadata;
Demonstates basic use of offlineManager api.
when i click the create pack i got this one LOG => progress callback region: status: {"completedResourceCount": 10, "completedResourceSize": 188188823, "erroredResourceCount": 0, "loadedResourceCount": 10, "loadedResourceSize": 188188823, "name": "pack-1", "percentage": 100, "requiredResourceCount": 10, "state": "complete"}
when i click the getall packes , i got this one i console
LOG => packs: [{"_metadata": {"_rnmapbox": [Object], "name": "pack-1", "whatIsThat": "foo"}, "pack": {"bounds": [Array], "completedResourceCount": 10, "completedResourceSize": 188188823, "expires": "Sun Feb 04 12:41:28 GMT+05:30 2024", "metadata": "{"name":"pack-1","_rnmapbox":{"bounds":{"coordinates":[[[-74.0808105,40.6751702],[-73.861084,40.6751702],[-73.861084,40.7714419],[-74.0808105,40.7714419],[-74.0808105,40.6751702]]],"type":"Polygon"},"zoomRange":[10,20],"styleURI":"mapbox:\/\/styles\/mapbox\/satellite-v9"},"whatIsThat":"foo"}", "percentage": 100, "requiredResourceCount": 10, "state": "complete"}}] LOG pack: {"_metadata": {"_rnmapbox": {"bounds": [Object], "styleURI": "mapbox://styles/mapbox/satellite-v9", "zoomRange": [Array]}, "name": "pack-1", "whatIsThat": "foo"}, "pack": {"bounds": [-73.861083984375, 40.77144186567577, -74.080810546875, 40.67517023238807], "completedResourceCount": 10, "completedResourceSize": 188188823, "expires": "Sun Feb 04 12:41:28 GMT+05:30 2024", "metadata": "{"name":"pack-1","_rnmapbox":{"bounds":{"coordinates":[[[-74.0808105,40.6751702],[-73.861084,40.6751702],[-73.861084,40.7714419],[-74.0808105,40.7714419],[-74.0808105,40.6751702]]],"type":"Polygon"},"zoomRange":[10,20],"styleURI":"mapbox:\/\/styles\/mapbox\/satellite-v9"},"whatIsThat":"foo"}", "percentage": 100, "requiredResourceCount": 10, "state": "complete"}} name: pack-1 bounds: [-73.861083984375, 40.77144186567577, -74.080810546875, 40.67517023238807] metadata {"_rnmapbox": {"bounds": {"coordinates": [Array], "type": "Polygon"}, "styleURI": "mapbox://styles/mapbox/satellite-v9", "zoomRange": [10, 20]}, "name": "pack-1", "whatIsThat": "foo"}
when i click the remove the packs
LOG Reset DB done: undefined
if i click the remove packs after that agin am click the getall packs click it was showing no package but app memory was not cleard LOG => packs: []
in the below pic , still user data was stored it was not removed from the app memory
it should remove from app memory if click the the remove all packes, it was just removing pack names , not from the app memory
No response
The text was updated successfully, but these errors were encountered:
No code example found in issue body - More info
Sorry, something went wrong.
@ZiZasaurus can you look this problem
#3076 (comment)
No branches or pull requests
Mapbox Implementation
Mapbox
Mapbox Version
10.0.11
Platform
Android
@rnmapbox/maps
version10.0.11
Standalone component to reproduce
import geoViewport from '@mapbox/geo-viewport';
import Mapbox, {
Camera,
MapView,
offlineManager,
StyleURL,
} from '@rnmapbox/maps';
import React, { useState } from 'react';
import { Button, Dimensions, TextInput } from 'react-native';
const CENTER_COORD: [number, number] = [-73.970895, 40.723279];
const MAPBOX_VECTOR_TILE_SIZE = 512;
console.log('=> Mapbox[0]:', Mapbox);
console.log('=> Mapbox.StyleURL[1]:', Mapbox.StyleURL);
console.log('=> StyleURL[2]:', StyleURL);
const STYLE_URL = Mapbox.StyleURL.Satellite;
const OfflineExample = () => {
const [packName, setPackName] = useState('pack-1');
const [showEditTitle, setShowEditTitle] = useState(false);
return (
<>
<Button
title={
Pack name: ${packName}
}onPress={() => {
setShowEditTitle(!showEditTitle);
}}
/>
{showEditTitle && (
<TextInput
value={packName}
autoFocus={true}
onChangeText={(text) => setPackName(text)}
onBlur={() => setShowEditTitle(false)}
/>
)}
<Button
title="Get all packs"
onPress={async () => {
const packs = await offlineManager.getPacks();
console.log('=> packs:', packs);
packs.forEach((pack) => {
console.log(
'pack:',
pack,
'name:',
pack.name,
'bounds:',
pack?.bounds,
'metadata',
pack?.metadata,
);
});
}}
/>
<Button
title="Get pack"
onPress={async () => {
const pack = await offlineManager.getPack(packName);
if (pack) {
console.log(
'pack:',
pack,
'name:',
pack.name,
'bounds:',
pack?.bounds,
'metadata',
pack?.metadata,
);
);
};
export default OfflineExample;
/* end-example-doc */
const metadata: ExampleWithMetadata['metadata'] = {
title: 'Offline Example',
tags: [
'offlineManager#createPack',
'offlineManager#getPack',
'offlineManager#getPacks',
],
docs:
Demonstates basic use of offlineManager api.
,};
OfflineExample.metadata = metadata;
Observed behavior and steps to reproduce
when i click the create pack i got this one
LOG => progress callback region: status: {"completedResourceCount": 10, "completedResourceSize": 188188823, "erroredResourceCount": 0, "loadedResourceCount": 10, "loadedResourceSize": 188188823, "name": "pack-1", "percentage": 100, "requiredResourceCount": 10, "state": "complete"}
when i click the getall packes , i got this one i console
LOG => packs: [{"_metadata": {"_rnmapbox": [Object], "name": "pack-1", "whatIsThat": "foo"}, "pack": {"bounds": [Array], "completedResourceCount": 10, "completedResourceSize": 188188823, "expires": "Sun Feb 04 12:41:28 GMT+05:30 2024", "metadata": "{"name":"pack-1","_rnmapbox":{"bounds":{"coordinates":[[[-74.0808105,40.6751702],[-73.861084,40.6751702],[-73.861084,40.7714419],[-74.0808105,40.7714419],[-74.0808105,40.6751702]]],"type":"Polygon"},"zoomRange":[10,20],"styleURI":"mapbox:\/\/styles\/mapbox\/satellite-v9"},"whatIsThat":"foo"}", "percentage": 100, "requiredResourceCount": 10, "state": "complete"}}]
LOG pack: {"_metadata": {"_rnmapbox": {"bounds": [Object], "styleURI": "mapbox://styles/mapbox/satellite-v9", "zoomRange": [Array]}, "name": "pack-1", "whatIsThat": "foo"}, "pack": {"bounds": [-73.861083984375, 40.77144186567577, -74.080810546875, 40.67517023238807], "completedResourceCount": 10, "completedResourceSize": 188188823, "expires": "Sun Feb 04 12:41:28 GMT+05:30 2024", "metadata": "{"name":"pack-1","_rnmapbox":{"bounds":{"coordinates":[[[-74.0808105,40.6751702],[-73.861084,40.6751702],[-73.861084,40.7714419],[-74.0808105,40.7714419],[-74.0808105,40.6751702]]],"type":"Polygon"},"zoomRange":[10,20],"styleURI":"mapbox:\/\/styles\/mapbox\/satellite-v9"},"whatIsThat":"foo"}", "percentage": 100, "requiredResourceCount": 10, "state": "complete"}} name: pack-1 bounds: [-73.861083984375, 40.77144186567577, -74.080810546875, 40.67517023238807] metadata {"_rnmapbox": {"bounds": {"coordinates": [Array], "type": "Polygon"}, "styleURI": "mapbox://styles/mapbox/satellite-v9", "zoomRange": [10, 20]}, "name": "pack-1", "whatIsThat": "foo"}
when i click the remove the packs
LOG Reset DB done: undefined
![Untitled design](https://private-user-images.githubusercontent.com/50162627/294422737-29ef6c65-85fc-4dac-a1cc-0c2a80f70620.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NzQ5MjIsIm5iZiI6MTczOTQ3NDYyMiwicGF0aCI6Ii81MDE2MjYyNy8yOTQ0MjI3MzctMjllZjZjNjUtODVmYy00ZGFjLWExY2MtMGMyYTgwZjcwNjIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDE5MjM0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFiMzlhZTExMmI0NGM3MDc5Nzg1NmI4MjQ0MWU4MGFhM2M4MjIxMDc0ZTdlZGI0MjUxMWFkZjE3YWU1MjQ4MDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.a7NcEbkGX99QWz7DU39hjPmv4xituNBxAP6PAyVZJRc)
Expected behavior
if i click the remove packs after that agin am click the getall packs click it was showing no package but app memory was not cleard
LOG => packs: []
in the below pic , still user data was stored it was not removed from the app memory
Notes / preliminary analysis
it should remove from app memory if click the the remove all packes, it was just removing pack names , not from the app memory
Additional links and references
No response
The text was updated successfully, but these errors were encountered: