Improve the mapbox-gl support detection for older browsers
This commit is contained in:
parent
56e9834389
commit
d18bc1c421
4 changed files with 93 additions and 191 deletions
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import ReactMapboxGl, { ZoomControl, GeoJSONLayer } from 'react-mapbox-gl';
|
||||
import { LngLatBounds } from 'mapbox-gl';
|
||||
import mapboxgl, { LngLatBounds } from 'mapbox-gl';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Map = ReactMapboxGl({});
|
||||
|
@ -78,6 +78,16 @@ const MapReader = ({ geoData }) => {
|
|||
];
|
||||
const boundData = [swCoords, neCoords];
|
||||
|
||||
if (!mapboxgl.supported()) {
|
||||
return (
|
||||
<p>
|
||||
Nous ne pouvons pas afficher la carte car elle est imcompatible avec
|
||||
votre navigateur. Nous vous conseillons de le mettre à jour ou utiliser
|
||||
les dernières versions de Chrome, Firefox ou Safari
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Map
|
||||
fitBounds={boundData}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue