Thanks so much for these tutorials. I'm stuck on part 2 of "Building a Geospatial App."
When I follow the instructions to create a StaticMap, and then open the map in Chrome or Firefox, the horizontal and vertical scrollbars start flickering rapidly on and off. Its as if the browser can't decide whether scroll bars are necessary.
I'm using Create-React-App as the starting point for this project. I've uploaded a demo to Surge.sh:
http://meek-language.surge.sh
Here's a video capture of the problem:
https://1drv.ms/v/s!AueUV7xVm3-qrtRL_oHj0ulmmo7IpA?e=kAXmrO
To reproduce:
-
Create a new application using create-react-app. Delete everything in the /src folder except for Index.js and App.js.
-
Open Index.js and replace its contents with the following:
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
ReactDOM.render(<App />, document.getElementById("root"));
- Open App.js and replace its contents with the following (which comes from Part 2 of the tutorial):
import React, { Component } from "react";
import { StaticMap } from "react-map-gl";
import DeckGL from "deck.gl";
const API_KEY = "...";
const INITIAL_VIEW_STATE = {
longitude: -74,
latitude: 40.7,
zoom: 11,
minZoom: 5,
maxZoom: 16,
pitch: 0,
bearing: 0
};
export default class App extends Component {
render() {
return (
<div>
<DeckGL
mapboxApiAccessToken={API_KEY}
initialViewState={INITIAL_VIEW_STATE}
controller
>
<StaticMap mapboxApiAccessToken={API_KEY} />
</DeckGL>
</div>
);
}
}
-
Npm install react-map-gl and deck.gl.
-
Run "npm start."
When the browser window opens, it will flicker many times per second. The horizontal and vertical scroll bars will appear, then disappear, and then reappear, all in rapid succession. The map center keeps shifting, which causes the map to "jiggle about" rapidly inside of the browser window.
This only happens when my browser window is at certain sizes. For example, it occurs when my browser is set to one-half of my display width, but not when my browser is set to full-width.
Would anyone have any clues about why this is happening or ways to prevent it?