The problem was this missing line in my index.html:

Copy<link href="https://api.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.css" rel="stylesheet">

The documentation tells you nothing about it, had to find it in the source code of this example: https://github.com/visgl/react-map-gl/tree/7.0-release/examples/controls

Answer from Tim MG on Stack Overflow
🌐
Snyk
snyk.io › advisor › react-mapbox-gl › functions › react-mapbox-gl.zoomcontrol
How to use the react-mapbox-gl.ZoomControl function in react-mapbox-gl | Snyk
attivio / suit / src / components / MapFacetContents.js View on Github · render() { const Marker = ReactMapboxGl.Marker; const ZoomControl = ReactMapboxGl.ZoomControl; const { buckets, tooltip } = this.props; if (StringUtils.notEmpty(this.props.mapboxKey)) { const Map = ReactMapboxGl.Map({ accessToken: this.props.mapboxKey, attributionControl: false, }); let locationPointer = ; if (this.props.pointerImageUri) { locationPointer = <img style="{{" alt="location pointer" src="{this.props.pointerImageUri}">; } else if (this.props.pointerGlyph) { locationPointer = ; } const points = this.props.buckets.map((bucket) =&gt; { // Return null if getCoordinatesFromBucket() returns null value const coordinates = MapFacetContents.getCoordinatesFromBucket(bucket);
Discussions

Use max and min Zoom with NavigationControl
Hello, I would like to limit zoom to certain value using NavigationControl. The props exists in interactive map but not in navigation control . Do you know if there is a way to do so? Thank you More on github.com
🌐 github.com
3
February 25, 2019
Need Help With react-map-gl mix and max zoom with the <NavigationControl />
You could enforce it in the arrow function you pass to onViewportChange. More on reddit.com
🌐 r/reactjs
2
1
February 19, 2021
reactjs - Implement custom zooming in React-Mapbox-GL - Stack Overflow
I am trying to achieve custom zoom behavior in React-Mapbox-GL. If user scrolls, the map doesn't zoom, only the web page is scrolling. Only if user "pinch-to-zoom", the map can zoom. I use More on stackoverflow.com
🌐 stackoverflow.com
How to get current zoom level of the map?
What I need to do is to deactivate the highlight function until the users reach a certain higher zoom level. So is there a getZoom() function in this library and how to apply it? I'm confused since every answer on StackOverflow is about react-mapbox-gl but I don't have time to switch the whole ... More on github.com
🌐 github.com
2
July 25, 2021
🌐
GitHub
github.com › alex3165 › react-mapbox-gl › blob › master › src › zoom-control.tsx
react-mapbox-gl/src/zoom-control.tsx at master · alex3165/react-mapbox-gl
A React binding of mapbox-gl-js. Contribute to alex3165/react-mapbox-gl development by creating an account on GitHub.
Author   alex3165
🌐
GitHub
github.com › visgl › react-map-gl › issues › 743
Use max and min Zoom with NavigationControl · Issue #743 · visgl/react-map-gl
February 25, 2019 - Hello, I would like to limit zoom to certain value using NavigationControl. The props exists in interactive map but not in navigation control . Do you know if there is a way to do so? Thank you
Author   altrang
🌐
Reddit
reddit.com › r/reactjs › need help with react-map-gl mix and max zoom with the
r/reactjs on Reddit: Need Help With react-map-gl mix and max zoom with the <NavigationControl />
February 19, 2021 -

Hello There,

I am working with ReactMapGL and NavigationControl. I am able to set max & min zoom using the ReactMapGL component
< ReactMapGL /> but I am having trouble setting the max & min zoom NavigationControl .

I was looking at the Navigation Control documentation https://visgl.github.io/react-map-gl/docs/api-reference/navigation-control, it does not have any properties for minZoom/maxZoom. Only the ReactMapGL has those properties.
Is there any way I can get that functionally working for?

Thanks

🌐
Stack Overflow
stackoverflow.com › questions › 63313699 › implement-custom-zooming-in-react-mapbox-gl
reactjs - Implement custom zooming in React-Mapbox-GL - Stack Overflow
import React, { useState, useCallback } from "react"; import QuickPinchZoom from "react-quick-pinch-zoom"; import ReactDOM from "react-dom"; import ReactMapboxGL from "react-mapbox-gl"; const Map = ReactMapboxGL({ accessToken: "pk.eyJ1IjoiZG9ubm5lLWdyaSIsImEiOiJjanF5eHB1aDMwOG83NDVxcTd4aG0xbTcxIn0.sZBpmFCnFBApzXGsIFXh4A", maxZoom: 18, scrollZoom: false }); const MapContainer = () => { const [mapZoom, setMapZoom] = useState(8); const onUpdate = useCallback( ({ scale }) => { if (scale === 1) { return; } const scaleDiff = (scale - 1) / 12; setMapZoom(scaleDiff + mapZoom); }, [mapZoom] ); return (
🌐
Better Programming
betterprogramming.pub › into-to-react-mapbox-gl-js-b7d827f7d7d6
Intro to React MapBox GL JS. Getting Started with Navigation… | by Dallas Bille | Better Programming
October 7, 2019 - If you’re interested in other ... MapBox GL JS — Using popup component.” · React MapBox has everything for you to make a map with the standard features. A huge part of the user experience with maps is the ability to navigate the map optimally. You notice that Google Maps and most maps generally have buttons to zoom in and out, ...
🌐
React Map GL
visgl.github.io › usecontrol
useControl | react-map-gl
The useControl hook is used to create React wrappers for custom map controls. import MapboxDraw from '@mapbox/mapbox-gl-draw'; import {Map, useControl} from 'react-map-gl/maplibre'; function DrawControl(props: DrawControlProps) { useControl(() => new MapboxDraw(props), { position: props.position }); return null; } function App() { return ( <Map initialViewState={{ longitude: -122.4, latitude: 37.8, zoom: 14 }} mapStyle="https://demotiles.maplibre.org/style.json" > <DrawControl position="top-left" displayControlsDefault={false} controls={{ polygon: true, trash: true }} /> </Map> ); }
Find elsewhere
🌐
React Map GL
visgl.github.io › scalecontrol
ScaleControl | react-map-gl
import * as React from 'react'; import {Map, ScaleControl} from 'react-map-gl/maplibre'; import 'maplibre-gl/dist/maplibre-gl.css'; function App() { return <Map initialViewState={{ longitude: -100, latitude: 40, zoom: 3.5 }} mapStyle="https://demotiles.maplibre.org/style.json" > <ScaleControl /> </Map>; } ... The maximum length of the scale control in pixels.
🌐
GitHub
github.com › urbica › react-map-gl › issues › 337
How to get current zoom level of the map? · Issue #337 · urbica/react-map-gl
July 25, 2021 - So is there a getZoom() function in this library and how to apply it? I'm confused since every answer on StackOverflow is about react-mapbox-gl but I don't have time to switch the whole ...
Author   lymine1996
🌐
Mapbox
docs.mapbox.com › all docs
Display zoom and rotation controls | Mapbox GL JS | Mapbox
Mapbox GL JS · Copy as Markdownchevron-down · View as MarkdownCopy as Markdown · Use addControl to add zoom and rotation controls via NavigationControl to the map. JavaScript · React · JavaScript ·
🌐
Stack Overflow
stackoverflow.com › questions › 57438014 › react-mapbox-gl-accessing-maps-zoom-in-a-stateless-functional-component
React-mapbox gl accessing Map's "zoom" in a stateless functional component
August 10, 2019 - I need to be able to access the current "Zoom" level of the map for dynamically rendering content. Is there a way I can do this in a stateless functional component? I have seen this question, which only applies to a class-component. I've looked at current issue and tried giving the map to props, neither of those solutions seem to work. const Map = ReactMapboxGl({ accessToken: AT }); const MapPortion = (props) => { const [mapOptions, setMapOptions] = useState({zoom: [4]}); const someZoomFunction = () => { // do stuff to setMapOptions({}) } return ( <Map zoom={zoom} containerStyle={{ height: "90%", width: "100%" }} /> ) }
🌐
React Map GL
visgl.github.io › react-map-gl › examples
react-map-gl
Markers, Popups and Controls · Custom Cursor · Draggable Marker · Draw Polygon · Highlight By Filter · Geocoder · GeoJSON Animation · GeoJSON · Heatmap · Limit Map Interaction · Dynamic Styling · Side by Side · Terrain · Camera Transition · Zoom to Bounds ·
🌐
GitHub
github.com › visgl › react-map-gl › issues › 1360
Issue setting mix and max zoom with the <NavigationControl /> · Issue #1360 · visgl/react-map-gl
February 18, 2021 - Hello There, I am working with ReactMapGL and NavigationControl. I am able to set max & min zoom using the ReactMapGL component but I am having trouble setting the max & min zoom NavigationControl . I was looking at the N...
Author   singhamritpal49
🌐
Stack Overflow
stackoverflow.com › questions › 53562337 › rotation-control-in-navigationcontrol-doesnt-work-in-react-map-gl
reactjs - Rotation control in NavigationControl doesn't work in react-map-gl - Stack Overflow
December 1, 2018 - import React, { Component } from 'react'; import ReactMapGL, { NavigationControl } from 'react-map-gl'; import styles from './styles/ViewMap.module.scss' import mapPin from './img/mapPin.png' export default class Map extends Component { constructor(props) { super(props); this.state = { viewport: { width: '100%', height: '100%', latitude: 37.7577, longitude: -122.4376, zoom: 12 }, mapStyle: "streets-v9", style: 'mapbox://styles/mapbox/', }; this.mapStyle_onChange = this.mapStyle_onChange.bind(this); } componentDidMount() { console.log("DIDMOUNT"); } mapStyle_onChange(e) { this.setState({ mapSty