I am using Mapboxgl for React Native project. And I have trouble with fitbounds function
It works well on IOS but not working on Android, it shows whole world map always. This is my code
import MapboxGL from '@mapbox/react-native-mapbox-gl';
export default class App extends Component {
captureRef = (map) => {
this.zoomToBounds(map)
}
async zoomToBounds(map) {
const _ = await map.getCenter()
map.fitBounds(bound[0], bound[1], 0, 0) //it work on IOS
}
render() {
return (
<View style={{flex: 1}}>
<MapboxGL.MapView
style={{ flex: 1 }}
ref={this.captureRef}
/>
</View>
);
}
}
I am not sure why it works well on IOS but not working in Android. Thanks