mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.04k stars 2.21k forks source link

Getting error on basemap setConfigProperty #13102

Open Kixx723 opened 6 months ago

Kixx723 commented 6 months ago

Sometimes i got this error Uncaught (in promise) Error: Style import not found: basemap

useEffect(() => { mapboxgl.accessToken = "edited"; map.current = new mapboxgl.Map({ container: mapContainer.current!, style: "mapbox://styles/mapbox/standard", center: [125.1716, 6.1164], zoom: 12, pitch: 50, bearing: 20, attributionControl: false });

map.current.on('style.load', () => {
  map.current!.setConfigProperty('basemap', 'lightPreset', 'night');
});

}, []);

stepankuzmin commented 6 months ago

Hi @Kixx723,

Thank you for opening this ticket. Please provide a minimal, complete, verifiable demonstration of the issue to help the maintainers and community understand and address the problem accurately. We recommend using https://jsbin.com/. Please include information about the browser version and operating system used.