Coder Social home page Coder Social logo

Comments (10)

SamSamskies avatar SamSamskies commented on June 12, 2024

Oops, sorry looks like I made a bad decision to import the CSS in this component. I was trying to make peoples lives easier and didn't consider that not everyone will have a build system setup to make this work. I'm going to need to do a major version upgrade and remove the CSS import and have users import it themselves as react-map-gl does.

In the meantime, it looks like you might be able to use this library to get things working with Next.js. https://github.com/zeit/next-plugins/tree/master/packages/next-css

from react-map-gl-geocoder.

SamSamskies avatar SamSamskies commented on June 12, 2024

@kjkurtz how are you loading the CSS for react-map-gl?

from react-map-gl-geocoder.

kjkurtz avatar kjkurtz commented on June 12, 2024

I was letting this library do it and used that next-css plugin in my nextjs config. Iā€™m not in front of my computer at the moment but can give it another try later and give you more detail. Using that next-css plugin though should allow css imports, but maybe not for stuff in node_modules? Not sure right off hand.

from react-map-gl-geocoder.

SamSamskies avatar SamSamskies commented on June 12, 2024

A temporary work around for you could be to copy and paste my code (it's only one file) into your code base and load the CSS the same way that you load the react-map-gl CSS.

I plan to remove the CSS import and have users bring it in themselves, but not sure when I'll push that up.

from react-map-gl-geocoder.

kjkurtz avatar kjkurtz commented on June 12, 2024

Cool, I did that and it worked at least for styling. I was able to bring it in using the same import statement you did for CSS but within my own component versus a library component. I'm guessing NextJS treats them differently.

I still have one goofy thing where because I am using onClick in ReactMapGL to zoom to polygon bounds, if you click in the Geocoder text box, it zooms to the bounds underneath it.

from react-map-gl-geocoder.

SamSamskies avatar SamSamskies commented on June 12, 2024

This click event propagating through to the map is a known issue that I haven't decided on how to fix yet #22. I describe a current work around in the issue.

from react-map-gl-geocoder.

SamSamskies avatar SamSamskies commented on June 12, 2024

@kjkurtz I just published v2 which removes the CSS import if you wanna switch back to importing this component as a dependency to take advantage of updates. See release notes here https://github.com/SamSamskies/react-map-gl-geocoder/releases. Let me know if you still need help with fixing the click event propagation problem.

from react-map-gl-geocoder.

kjkurtz avatar kjkurtz commented on June 12, 2024

Great, thanks! I'll give it a try. I've also been experimenting with the slightly different mapbox-gl wrapper found here: https://github.com/alex3165/react-mapbox-gl. I've felt it's a little easier to integrate custom components into that one vs Uber's, but I do miss the integration of the viewport with state that the Uber library has. Have you compared them at all?

from react-map-gl-geocoder.

SamSamskies avatar SamSamskies commented on June 12, 2024

I checked out that library a long time ago, but ended up going with Uber's react-map-gl for projects that I've worked on. I haven't explored other options much because react-map-gl + deck.gl has been easy to work with.

from react-map-gl-geocoder.

kjkurtz avatar kjkurtz commented on June 12, 2024

Gotcha. deck.gl looks pretty awesome, I haven't tried it yet. At this point trying to build out some basic custom features on top of MapboxGL. Thanks again for getting the update out!

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.