Comments (13)
No problem, there are no n00b questions. ;)
It doesn’t return the entered string – the purpose is to always get a geocoded place from the library to use. When using only the inputted string in the geocoding, the chances of a successful geocode are very low as Google already suggests the known stuff.
Or do you have examples of places that don’t get suggested but can be geocoded by Google?
Related to #72.
from react-geosuggest.
@ro-ka thanks for the response!
I was coming from it more from a UX point of view, where the following three cases might happen and that I would still like to save the input:
- Mis-spellings.
- Places not in Google - this is mainly a problem internationally, where either address or place name doesn't show up in Google. From my personal experience, half the places I look up in India might not show up accurately but people around know the place (and hence important to store the place name).
- New places, or ones which have psuedo names that they might want to use (again known and understood to the relevant groups even if they can't be geo-coded).
This option would enable the library to provide for input when there are other issues with Google libraries.
What do you think?
from react-geosuggest.
I understand the case. The main purpose is to return a geocoded place to work with. I’m not sure how to integrate the non-geocoding found case.
Possibilities:
- Default is a strict mode that will only return geocoded places.
- A non-strict mode could do this:
- Geocode the input string on
enter
when nothing is selected. - Return geocoded result if something got found.
- Return without non-geocoded place in case nothing could be geocoded.
- Geocode the input string on
Does that make sense?
from react-geosuggest.
Yes, I think that would work well as it keeps it backward-compatible but provides options to those in need :)
The only question that I have -
Geocode the input string on enter when nothing is selected.
Wondering if the interaction should only be bound to enter
. What would you think of having the last row always be the address or a label like "Custom Address" and clicking on that gives you the input string as well?
from react-geosuggest.
Hm, good question. As there was the request for a submit button in #72, which is the same thing we are talking about here, I’m not sure what to prefer.
A submit button seems to be more standard, but can be confusing. When selecting a suggestion from the dropdown, the submit button is irritating as it doesn’t have any extra functionality. But custom address can be irritation, too.
Will think about that…
from react-geosuggest.
I'm using react-geosuggest
to validate complete street_address, here's my code:
const filterResults = ({ types }) => !types.includes('street_address')
function SearchLocation(props: Props) {
const { placeholder, onChange, initialValue, children, precise } = props
return (
<div className='search-location'>
<Geosuggest
placeholder={ placeholder }
onSuggestSelect={ (value) => handleChange(value, onChange) }
initialValue={ initialValue || emptyString }
types={ precise ? [ 'address' ] : [] }
skipSuggest={ precise ? filterResults : noop } />
{ children }
</div>
)
}
The filter is pretty aggressive and the user must enter an address starting with a number, would be great to display a message when there's no suggestions 👍
Right now, I've wrapped the component to do it myself. If you are ready for a PR @ro-ka I can do it 👍
from react-geosuggest.
The filter is pretty aggressive and the user must enter an address starting with a number, would be great to display a message when there's no suggestions
That message could be a custom string formed from the input itself.
+1 to @iam4x volunteering for the PR!
But custom address can be irritation, too.
@ro-ka Increasingly, I see this behavior in a lot of places which have address auto-complete since there will always be inputs not on google.
from react-geosuggest.
@iam4x If you like to add a PR that would be great! :)
from react-geosuggest.
Any progress on this?
from react-geosuggest.
I needed a similar functionality too, so here's my PR:
added support for providing a callback when no results found, by simply passing the onSuggestNoResults prop
#167
from react-geosuggest.
This is awesome, thanks @dimafeldman!
from react-geosuggest.
The PR #167 got merged.
from react-geosuggest.
@ro-ka Revisiting this, as I was testing some old code and realized that the #167 by @dimafeldman (thank you for that!) only solves part of the issue. That PR allows the developer to get the string entered through the callback function (onSuggestNoResults
).
But the other part of this issue was what I think @iam4x, @amanofscience (in #72) and I were also referring to: some way to have a custom label/message in the dropdown which can say "Add [user-input]", clicking on which would fire the callback to onSuggestNoResults
added by @dimafeldman.
I was thinking something along the lines of getSuggestLabel
, like getSuggestLabelForNoResult
? Or do you think we can somehow use that method in this case?
from react-geosuggest.
Related Issues (20)
- Expose TypeScript type definitions
- Warning: Prop `aria-owns` did not match. HOT 1
- selectSuggest doesn't trigger onSelectSuggests HOT 3
- Inconsitent suggest.gmaps property received in onSuggestSelect HOT 2
- Test `react-geosuggest` with puppeteer HOT 1
- utc_offset is deprecated as of November 2019 and will beturned off in November 2020. Use utc_offset_minutes instead. HOT 3
- How to allow current location ? and get address based on current location coordinates ? HOT 1
- ul role=listbox should define an aria-label or aria-labelledby HOT 2
- Support React 17 HOT 2
- Selected suggestion didn't apply properly, when searching in Argentina region HOT 1
- Type is invalid - expected a string or a class/function (for composite components) but got: undefined. Check the render method of `Input`. HOT 7
- Google maps API was not found in the page. HOT 2
- Handle the errors returned by the geocoder API
- Label "for" and input "id" do not match
- 'Avnei Hefetz' is an israli settlement city which is not coming in country 'IL' suggestions whereas 'Einav' is also an israli settlement city which is coming in country 'IL' suggestions. HOT 1
- How to detach geocomplete event?
- Using bounds not filtering suggests HOT 1
- Bounds, location, and radius are deprecated
- Support and document loading Maps API via Bootstrap Loader
- Rendering suggest items with matching substrings raises react unique "key" prop warning
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-geosuggest.