Describe the bug
Putting Offlinemanager's getPacks into code leads to crash of App
To Reproduce
1)react-native init AwesomeProject
2)follow installation guide of mapbox
3) Put some sample code with mapbox(example in getting started)
4)use MapboxGL.offlineManager.getPacks()
5)npx react-native run-android
Example:
from getting started page + some usage of getPacks in componentDidMount
import React, { Component } from "react";
import { StyleSheet, View } from "react-native";
import MapboxGL from "@react-native-mapbox-gl/maps";
MapboxGL.setAccessToken("<YOUR_ACCESSTOKEN>");
const styles = StyleSheet.create({
page: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#F5FCFF"
},
container: {
height: 300,
width: 300,
backgroundColor: "tomato"
},
map: {
flex: 1
}
});
export default class App extends Component {
componentDidMount() {
MapboxGL.setTelemetryEnabled(false);
MapboxGL.offlineManager.getPacks().then(res => (console.log(res)));
}
render() {
return (
<View style={styles.page}>
<View style={styles.container}>
<MapboxGL.MapView style={styles.map} />
</View>
</View>
);
}
}
Expected behavior
App works fine and logging all available offline packs
Versions:
Screenshot:
Funny note: If add code with getPacks() after run-android(so by refreshing apps) nothing crash, and getPacks works well
@zanaviska what was the exact crash?!
@mfazekas suddenly stop working. Uploaded post with gif of execution of example code
We ran into the same issue.
Here is the crashing stack trace.

It appears that the issue is called by calling getPack before the map has loaded. Try
```
render() {
return (
onDidFinishLoadingMap={() => {
MapboxGL.setTelemetryEnabled(false);
MapboxGL.offlineManager.getPacks().then(res => (console.log(res)));
}}
/>
);
}
I have the same issue. After a while of investigation, I found out that one of the returned pack is completely invalid. It has invalid bounding box ([18, 112], [-18, -112]). When I omit it stops crashing. I hope it can help somebody.
We ran into the same issue.
Here is the crashing stack trace.
It appears that the issue is called by calling
getPackbefore the map has loaded. Tryrender() { return ( <View style={styles.page}> <View style={styles.container}> <MapboxGL.MapView style={styles.map} onDidFinishLoadingMap={() => { MapboxGL.setTelemetryEnabled(false); MapboxGL.offlineManager.getPacks().then(res => (console.log(res))); }} /> </View> </View> ); }
Hey bro, work for me, thanks..
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
We ran into the same issue.
Here is the crashing stack trace.

It appears that the issue is called by calling
getPackbefore the map has loaded. Try```
style={styles.map}
render() {
return (
onDidFinishLoadingMap={() => {
MapboxGL.setTelemetryEnabled(false);
MapboxGL.offlineManager.getPacks().then(res => (console.log(res)));
}}
/>
);
}