[Feat] Give map instance as input
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.5k
- Forks
- 1.4k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 3
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the main Map component and MapContext, especially how the existing map and mapLib values are provided to Layer and Source. Determine the API and lifecycle requirements for accepting an external map instance, then verify that an existing non-React map can be extended with the React components without breaking normal Map usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100