mirror of
https://github.com/visgl/react-map-gl.git
synced 2025-12-08 20:16:02 +00:00
Remove support() check (#2508)
This commit is contained in:
parent
2ab613129a
commit
d57e469018
@ -59,24 +59,18 @@ function _Map(props: MapProps, ref: React.Ref<MapRef>) {
|
||||
throw new Error('Invalid mapLib');
|
||||
}
|
||||
|
||||
// workerUrl & workerClass may change the result of supported()
|
||||
// https://github.com/visgl/react-map-gl/discussions/2027
|
||||
setGlobals(mapboxgl, props);
|
||||
if (!mapboxgl.supported || mapboxgl.supported(props)) {
|
||||
if (props.reuseMaps) {
|
||||
mapbox = Mapbox.reuse(props, containerRef.current);
|
||||
}
|
||||
if (!mapbox) {
|
||||
mapbox = new Mapbox(mapboxgl.Map, props, containerRef.current);
|
||||
}
|
||||
contextValue.map = createRef(mapbox);
|
||||
contextValue.mapLib = mapboxgl;
|
||||
|
||||
setMapInstance(mapbox);
|
||||
mountedMapsContext?.onMapMount(contextValue.map, props.id);
|
||||
} else {
|
||||
throw new Error('Map is not supported by this browser');
|
||||
if (props.reuseMaps) {
|
||||
mapbox = Mapbox.reuse(props, containerRef.current);
|
||||
}
|
||||
if (!mapbox) {
|
||||
mapbox = new Mapbox(mapboxgl.Map, props, containerRef.current);
|
||||
}
|
||||
contextValue.map = createRef(mapbox);
|
||||
contextValue.mapLib = mapboxgl;
|
||||
|
||||
setMapInstance(mapbox);
|
||||
mountedMapsContext?.onMapMount(contextValue.map, props.id);
|
||||
})
|
||||
.catch(error => {
|
||||
const {onError} = props;
|
||||
|
||||
@ -59,24 +59,18 @@ function _Map(props: MapProps, ref: React.Ref<MapRef>) {
|
||||
throw new Error('Invalid mapLib');
|
||||
}
|
||||
|
||||
// workerUrl & workerClass may change the result of supported()
|
||||
// https://github.com/visgl/react-map-gl/discussions/2027
|
||||
setGlobals(mapboxgl, props);
|
||||
if (!mapboxgl.supported || mapboxgl.supported(props)) {
|
||||
if (props.reuseMaps) {
|
||||
mapbox = Mapbox.reuse(props, containerRef.current);
|
||||
}
|
||||
if (!mapbox) {
|
||||
mapbox = new Mapbox(mapboxgl.Map, props, containerRef.current);
|
||||
}
|
||||
contextValue.map = createRef(mapbox);
|
||||
contextValue.mapLib = mapboxgl;
|
||||
|
||||
setMapInstance(mapbox);
|
||||
mountedMapsContext?.onMapMount(contextValue.map, props.id);
|
||||
} else {
|
||||
throw new Error('Map is not supported by this browser');
|
||||
if (props.reuseMaps) {
|
||||
mapbox = Mapbox.reuse(props, containerRef.current);
|
||||
}
|
||||
if (!mapbox) {
|
||||
mapbox = new Mapbox(mapboxgl.Map, props, containerRef.current);
|
||||
}
|
||||
contextValue.map = createRef(mapbox);
|
||||
contextValue.mapLib = mapboxgl;
|
||||
|
||||
setMapInstance(mapbox);
|
||||
mountedMapsContext?.onMapMount(contextValue.map, props.id);
|
||||
})
|
||||
.catch(error => {
|
||||
const {onError} = props;
|
||||
|
||||
@ -59,24 +59,18 @@ function _Map(props: MapProps, ref: React.Ref<MapRef>) {
|
||||
throw new Error('Invalid mapLib');
|
||||
}
|
||||
|
||||
// workerUrl & workerClass may change the result of supported()
|
||||
// https://github.com/visgl/react-map-gl/discussions/2027
|
||||
setGlobals(mapboxgl, props);
|
||||
if (!mapboxgl.supported || mapboxgl.supported(props)) {
|
||||
if (props.reuseMaps) {
|
||||
maplibre = Maplibre.reuse(props, containerRef.current);
|
||||
}
|
||||
if (!maplibre) {
|
||||
maplibre = new Maplibre(mapboxgl.Map, props, containerRef.current);
|
||||
}
|
||||
contextValue.map = createRef(maplibre);
|
||||
contextValue.mapLib = mapboxgl;
|
||||
|
||||
setMapInstance(maplibre);
|
||||
mountedMapsContext?.onMapMount(contextValue.map, props.id);
|
||||
} else {
|
||||
throw new Error('Map is not supported by this browser');
|
||||
if (props.reuseMaps) {
|
||||
maplibre = Maplibre.reuse(props, containerRef.current);
|
||||
}
|
||||
if (!maplibre) {
|
||||
maplibre = new Maplibre(mapboxgl.Map, props, containerRef.current);
|
||||
}
|
||||
contextValue.map = createRef(maplibre);
|
||||
contextValue.mapLib = mapboxgl;
|
||||
|
||||
setMapInstance(maplibre);
|
||||
mountedMapsContext?.onMapMount(contextValue.map, props.id);
|
||||
})
|
||||
.catch(error => {
|
||||
const {onError} = props;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user