Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markers wiggle on React 18 #1010

Open
agusterodin opened this issue Jul 9, 2022 · 6 comments
Open

Markers wiggle on React 18 #1010

agusterodin opened this issue Jul 9, 2022 · 6 comments

Comments

@agusterodin
Copy link

Reproducible by upgrading React version of website example to version 18

Before (React 17):

Screen.Recording.2022-07-09.at.6.38.32.PM.mov

After (React 18):

Screen.Recording.2022-07-09.at.6.41.12.PM.mov
@mcgrealife
Copy link

+1 to this. Thanks for the videos.

@tranthaison1231
Copy link

tranthaison1231 commented Dec 12, 2022

+1 to this, any one know how to fix this issue?

@tranthaison1231
Copy link

@agusterodin Have you fixed this prolem?

@lduchuy2002
Copy link

lduchuy2002 commented Dec 15, 2022

Because React 18 events are auto batching state update when the map is moving, you guys can fork this repo and put flushSync to map 'move' event in ProjectedLayer component, hope this helps you
image

@nickpolet
Copy link

nickpolet commented Nov 8, 2023

Is there any interest in making this part of the repo here instead of having to fork and go that way?

@lduchuy2002
Copy link

lduchuy2002 commented Dec 20, 2023

Hi @nickpolet . I created 2 files and use the Marker component instead of forking
image

Note: inside ProjectLayer component which i copied from this library
image

So somewhere in my app
import Marker from 'lib/react-mapbox-gl/Marker'

<Marker ...your props />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants