Visgl from React-map-gl Repository

Other

Closed
[Bug] React Portal is not working with NavigationControl #1975

Issue Opened
Adriangonzalezrodrigo Opened Issue On Sep 6th 2022, 2:25

Adriangonzalezrodrigo

Description

I need to put NavigationControl component in other div of the application. I'm trying to use React Portal to do that but it is not working. In older versions I can have that behaviour but in react-map-gl: 7.0.19 is not working

Expected Behavior

React Portal should work with NavigationControl

Steps to Reproduce

Example of the code (it is not the full code):

<DeckGL
.....someProps
>
   <ReactMapGL
     ...moreProps>
            React.createPortal(<NavigationControl />, container) => this does not work

   </ReactMapGL>
</<DeckGL> 

Environment

  • Framework version: 7.0.19 and deck.gl 8.8.9
  • Map library: maplibre 2.4.0
  • Browser: Chrome 105
  • OS: Windows 10

Logs

No response

Comment
Pessimistress commented on 2 months ago

Pessimistress

This is expected. v7 no longer renders controls in React. The components are simply wrappers of the official controls and they don't return any React nodes.

As the upgrade guide notes, if you want to use the control components as children of DeckGL, you need to use v5 or v6.

About Repository

React friendly API wrapper around MapboxGL JS
Language: TypeScript
Star: 6880
Fork: 1250
Watchers: 6880
Open Issues: 28
https://github.com/visgl/react-map-gl
Other
Last updated: 05 Dec 2022
Tropics: