maplibre / maplibre-react-native

A MapLibre react native module for creating custom maps
Other
208 stars 51 forks source link

Performance drops when there are no tiles. #226

Closed iw2rmb closed 7 months ago

iw2rmb commented 7 months ago

I'm using a specific map that covers only the Netherlands. When Maplibre fails to load tiles, it throws an error (below), and performance drops to 1-2 frames per second.

Here are the log messages:

 ERROR  Mapbox error {Thread-398}[Style]: Failed to load tile 10/526/335=>10 for source cartiqo: timeout {"level": "error", "message": "{Thread-398}[Style]: Failed to load tile 10/526/335=>10 for source cartiqo: timeout", "tag": "Mbgl"}

and

 LOG  Mapbox [info] Request failed due to a permanent error: Canceled  {"level": "warning", "message": "Request failed due to a permanent error: Canceled ", "tag": "Mbgl-HttpRequest"}

Here's my code:

import { View } from 'react-native';
import MapLibreGL from '@maplibre/maplibre-react-native';

export default Drawings = () => {
  MapLibreGL.setAccessToken(null);

  return (
    <View style={{
      flex: 1,
      justifyContent: 'center',
      alignItems: 'center',
    }}>
      <MapLibreGL.MapView
        style={{
          flex: 1,
          alignSelf: 'stretch',
        }}
        styleURL={`https://api.maptiler.com/maps/nl-cartiqo-topo/style.json?key=<API_KEY>`}
        logoEnabled={false} />
    </View>
  );
}
iw2rmb commented 7 months ago

Suppressing all log messages helped with the performance of the Android emulator. Logger.setLogCallback(() => true)