-
-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
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
[Bug]: offlineManager.resetDatabase not clearing pack list #3076
Comments
Have you try close the app and open it again? Do the list have been gone? |
I am facing the same problem not able to delete offline maps and also not able to reset the database both functions are not working. It would be great if you guys can help. |
@vishaldybot Have you tried to close the app after resetting the database or deleting the offline maps? |
@thdailong Yes, I have done everything and if possible can you please help with this?? as I am in the end of the project and now facing this issue. If you want I can share you how can you a standalone file with you so that you can try the same. |
@vishaldybot It would be great if you could provide more information about the issue you are facing. I have facing a similar issue #3265 and managed to fix this bug. |
@thdailong,` I was following samething but I was creating multiple offline packs. After that i want clear the all downloaded offlinemaps so i am calling offlineManager.resetDatabase() API, after calling api downloaded offline map names was not showing in console but in the app memory size (MB) not clearing and app memory size Increasing while downloading offline map everytime. import geoViewport from '@mapbox/geo-viewport';
import Mapbox, {Camera,MapView,offlineManager,StyleURL,} from '@rnmapbox/maps;
import { Button, Dimensions, TextInput ,StyleSheet} from 'react-native';
const CENTER_COORD: [number, number] = [-73.970895, 40.723279];
const MAPBOX_VECTOR_TILE_SIZE = 512;
const STYLE_URL = Mapbox.StyleURL.SatelliteStreet;`
const Offline_Map = () => {
const [packName, setPackName] = useState('pack-1');
const [showEditTitle, setShowEditTitle] = useState(false);
return (
<>
<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="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),
);
}}
/>
</>
);
}
export default Offline_Map; In console after clicking the
while clicking the
while clicking the " LOG Reset DB done: undefined " getting this one |
@sampathkumarch |
@thdailong thankyou for reply |
@mfazekas, @thdailong can you help me with this point, am unable to delete the offline maps in the app memory. |
Mapbox Implementation
Mapbox
Mapbox Version
default
Platform
iOS, Android
@rnmapbox/maps
version10.0.15
Standalone component to reproduce
Observed behavior and steps to reproduce
When calling
await offlineManager.resetDatabase()
and then getting again the list of offline packs, the list remains the same.This is true after having awated the response from the async
resetDatabase
and is true even if we wait for several seconds before callingofflineManager.getPacks()
.Calling
await pack.status()
on any of these packs though will result in"Does not exist"
exception.Expected behavior
The result of
await offlineManager.getPacks()
should be an empty list, as the offline tile packs should have been cleared.Notes / preliminary analysis
Restarting the app completely and calling
getPacks()
will return correctly an empty list.Additional links and references
No response
The text was updated successfully, but these errors were encountered: