react-new-window icon indicating copy to clipboard operation
react-new-window copied to clipboard

Google Map&Mapbox Issue

Open zning opened this issue 5 years ago • 5 comments

I'm trying to pop up a new window and put Map inside it. But have some issues:

  1. For Google Map(I'm using @react-google-maps/api package), the onDrag event won't fire after the onDragStart on the popup window until you click back to original window, the onDrag event will fire then. This leads to a weird result: Once you start to drag on the pop up window map, the map will not move at all, you click back to the original window and move around the mouse, the popup window start to move(pan) around.
  2. For Mapbox(I'm using react-mapbox-gl package), won't works due to "mapbox-gl.js:24480 Uncaught Error: Invalid type: 'container' must be a String or HTMLElement."

Any way to make anyone of them works? Thanks a lot

zning avatar Oct 31 '19 21:10 zning

Hey, I have a similar issue to your first issue and this is what I've found out:

Since the content is being rendered in the original window, the global window that's being used by third party libraries is the original window, not the pop up window. Unfortunately, I don't have a fix or workaround besides using libraries where you can pass the window in through a prop.

kme211 avatar Nov 19 '19 20:11 kme211

Hey, I have a similar issue to your first issue and this is what I've found out:

Since the content is being rendered in the original window, the global window that's being used by third party libraries is the original window, not the pop up window. Unfortunately, I don't have a fix or workaround besides using libraries where you can pass the window in through a prop.

Thanks for your reply. Tried 5 different google map libraries and no one perfectly works...

zning avatar Nov 19 '19 20:11 zning

Made a little 'hack' that let me run mapbox and communicate with it in a seperat window using react-routing and broadcastChannel API.

See: https://github.com/Totalbug92/React-New-Window-with-Mapbox-GL

Totalbug92 avatar Dec 23 '19 15:12 Totalbug92

@Totalbug92 did you see issue https://github.com/rmariuzzo/react-new-window/issues/34? I think fixing that that would solve this issue with Google Maps, and any other issue related to the window reference.

Jip-Hop avatar Jan 03 '20 03:01 Jip-Hop

I'm wondering if this issue can be addressed using the new window instance returned by onOpen callback.

rmariuzzo avatar Nov 27 '22 05:11 rmariuzzo