visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.35k forks source link

[Bug] When I zoom in and out of the map, the <Maker> image jerks up and down after upgrading to version 7.1.x from 7.0.x #2241

Closed color-me closed 1 year ago

color-me commented 1 year ago

Description

I'm using react-map-gl in my app, and on version 7.0.x the Maker stays in the correct position when I manually scale the map, but after upgrading to 7.1.x the Maker labels jerk up and down

https://github.com/visgl/react-map-gl/assets/40147739/6dc10168-4ea2-4a31-96c4-d7e4d2b6a4a2

Expected Behavior

labels don't jerk up and down on 7.1.x ### Steps to Reproduce ```js import React, { useState, useRef } from 'react'; import ReactMapGL, { MapRef, Marker, ViewStateChangeEvent, } from 'react-map-gl'; import 'mapbox-gl/dist/mapbox-gl.css'; const VehicleMap = () => { const { vehicleIds, } = useVehicleIdsModel(); const mapRef = useRef(null); const [currentZoomWidth, setCurrentZoomWidth] = useState(14); // ... const renderMarker = () => { return vehicleIds?.map((item: string, index: number) => { const gps = item?.gps || []; return ( ); }); }; const onZoomChange = (event: ViewStateChangeEvent) => { setCurrent(event.target.getZoom()); setCurrentZoomWidth(getZoomWidth(event.target.getZoom())); }; return (
{renderMarker()}
); }; ``` ### Environment - Framework version: react-map-gl @7.1.2 - Map library: mapbox-gl @2.11.1 - Browser: Chrome 114.0.5735.198 - OS: Mac OS 13.4.1 ### Logs _No response_
Pessimistress commented 1 year ago

Please create a Code Sandbox that reproduces your issue.

color-me commented 1 year ago

Please create a Code Sandbox that reproduces your issue.

https://codesandbox.io/s/naughty-liskov-4hy26d?file=/src/App.js

Pessimistress commented 1 year ago

Can you try the latest release?