Skip to content

[Feat] Give map instance as inputΒ #2575

@grillorafael

Description

@grillorafael

Target Use Case

I have an instance of mapbox already being used in my app and when I was on an older version of react-map-gl I was create a context with the map instance and still using the Layer and Source components as normal.

After the upgrade I can't do this anymore so in my case where I have part of my app not written in React and part of it using React, I can't extend my existing map using react-map-gl as I was before.

Example:

<MapContext.Provider
      value={{
        map: {
          getMap: () => map,
        } as any,
        mapLib: mapboxgl as MapboxAsMapLib,
      }}
    >
.....

Where map was a prop of my component.

Proposal

Since I can't override the context anymore, it would be nice if the main Map component could receive an existing external map instance as an option

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions