rmariuzzo / react-new-window

🔲 Pop new windows in React, using `window.open`.
https://rmariuzzo.github.io/react-new-window/
MIT License
448 stars 110 forks source link

Google Map&Mapbox Issue #58

Open zning opened 5 years ago

zning commented 5 years ago

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

kme211 commented 4 years ago

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.

zning commented 4 years ago

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...

Totalbug92 commented 4 years ago

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

Jip-Hop commented 4 years ago

@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.

rmariuzzo commented 1 year ago

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