Comments (15)
That is because your latitude and longitude are incorrect. So it is not a real place you have set.
from react-map-gl-geocoder.
Good news is that your demo code works fine on my environment... so I guess I'll start replacing stuff line by line until I find the culprit...
I'll let you know what I find, and thanks again for your help
from react-map-gl-geocoder.
@jlubeck could you provide more info so that I can try to replicate this issue? Some things that may help is your search query that is causing it to crash, what browser you are using, etc. If you could provide an example using an online code editor like Code Sandbox http://codesandbox.io, that would be even more helpful.
from react-map-gl-geocoder.
Ok, this is weird...
Here is my code: https://codesandbox.io/s/7v21m7yxq
That exact code works on codesandbox but not on my site...
Any ideas how can I get to the bottom of this?
I'm running on Google Chrome. Search Query is "Teatro Colon"
from react-map-gl-geocoder.
Ok... progress... I figured out why it was crashing. When clicking on one of the results, the onClick event from the Map was being called as well but without coordinates. Why without coordinates? Because the map is disappearing after selecting a result.
The DOM for the Map is still there, but the style has a width and height of 0px. So strange.... Specially that it doesn't happen on the codesandbox
from react-map-gl-geocoder.
Not sure. You could make your click handler more robust by checking if the coordinates exist before doing anything.
Having a width and height of 0px for the map will probably cause things to explode when using my Geocoder component. I'll look into adding code to prevent that from happening.
from react-map-gl-geocoder.
The thing is that it only happens when selecting an option from your Geocoder... not when clicking elsewhere on the map...
I'm trying to get to the bottom of this, but now Chrome is not stopping on my breakpoints... grrrrr
from react-map-gl-geocoder.
I can look into stopping the result click from bubbling up to the map, but I'm not sure when I'll get around to it.
For now, I don't see a downside to checking if the coordinates exist in your click handler. I'm guessing that will fix your problem.
from react-map-gl-geocoder.
The downside is that my map is turning blank :D
I already tried removing the click handler altogether, and the map is turning blank after selecting a result from the Geocoder
from react-map-gl-geocoder.
BTW, thank you for responding so quickly!
from react-map-gl-geocoder.
When I go to your Code Sandbox example, the map is blank before I even enter a search query. There may be a bug with your state management. It's even blank if I remove the Geocoder component. The state of your Map component is intermittently undefined when I console log it in the render function.
from react-map-gl-geocoder.
That's weird. I don't see it blank and I see the logs on the render function just fine:
from react-map-gl-geocoder.
Disregard my comment about the state being undefined intermittently in your Code Sandbox example. It was actually a console.log that was in the componentDidUpdate function that was printing undefined. I got the map to show up by removing your mapStyle. Maybe I don't have permissions to access the mapStyle that you're using.
from react-map-gl-geocoder.
Well... you can mark this one as glitch... no other words for it... I started with your example code. Replacing line by line. I finished... Everything is working fine... Don't know wether to be happy or outraged haha
Sorry for wasting your time. Looks like a great library! I'll make sure to double check more thoroughly next time.
Thanks!
from react-map-gl-geocoder.
No problem. Let me know if any issues pop up.
from react-map-gl-geocoder.
Related Issues (20)
- GeoCoder Marker's Styling Not Working HOT 2
- Search Results Not closing, and marker not dropping HOT 9
- Geocoder doesn't appear in Next.js app HOT 1
- Console error passing object to marker prop
- Suggestions are displayed after setting a default input HOT 3
- External geocoder HOT 1
- React 17? HOT 1
- how to active draggable after search HOT 1
- mapbox-gl neccessary dependency? HOT 1
- How to get the current value? HOT 3
- Typescript import issue HOT 1
- Supporting stand-alone Geocoder without map ? HOT 1
- react-map-gl 7 support HOT 7
- Multiple input options in react app HOT 1
- export 'FlyToInterpolator' (imported as 'r') was not found in 'react-map-gl' HOT 2
- Request to upgrade transitive dependency `http-cache-semantics` in `react-map-gl-geocoder` HOT 1
- Menu stays open HOT 2
- Upon passing Marker="true" into geocoder, no point appears HOT 4
- TypeError: Cannot read property 'remove' of undefined __ Cannot read property 'addControl' of null - HOT 6
- Can Not Use react.map.gl.gecoder with Typescript HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-map-gl-geocoder.