Coder Social home page Coder Social logo

Comments (4)

marek-sed avatar marek-sed commented on June 12, 2024 1

Yeah was thinking about a bit it seems like a new component now. It would require too many if, else blocks and make it hard erto maintain.

Will try to open-source it after I have some more time.

btw thank you for making this library its 💯

from react-map-gl-geocoder.

SamSamskies avatar SamSamskies commented on June 12, 2024

Hi @marek-sed, without the map, nothing will work. This component performs imperative actions using the Mapbox map which is obtained using the imperative getMap function from the react-map-gl Map https://github.com/SamSamskies/react-map-gl-geocoder/blob/master/src/index.js#L114. That's why the render function returns null. https://github.com/SamSamskies/react-map-gl-geocoder/blob/master/src/index.js#L230

from react-map-gl-geocoder.

marek-sed avatar marek-sed commented on June 12, 2024

which imperative actions?

copied your geocoder to our project, geocoding works ;)
https://gist.github.com/marek-sed/7a2f2a086647ad10db282014d6804d57#file-geocoder-js-L85

I am not using map related props. Just need a typeahed with calling service.
It is really nice for placing geocoder outside of map and plays nicely with react-map-gl which extracts the viewport. So I can set mapCenter to global state, and update the viewport.

in my understanding it is sort of the point of using react-map-gl so you can couple pieces in composable manner.

and sry would love to provide codesandbox example but we have crazy tight schedule on project

from react-map-gl-geocoder.

SamSamskies avatar SamSamskies commented on June 12, 2024

The imperative actions I was talking about are the Mapbox map imperative actions such as addControl https://github.com/SamSamskies/react-map-gl-geocoder/blob/master/src/index.js#L93.

When I first started this project, I didn't know you could add the @mapbox/mapbox-gl-geocoder object by appending it to an outside HTML node. I didn't discover this until later when someone raised an issue that they'd like to place the geocoder outside of the map.

At this point, I think most people use this component without the containerRef and I believe the changes that you suggest would require it.

Let me know if you decide to open source your more composable solution and I'll add a link in the README.

from react-map-gl-geocoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.