-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for 'no results found' case #74
Comments
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. |
@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:
This option would enable the library to provide for input when there are other issues with Google libraries. What do you think? |
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:
Does that make sense? |
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 -
Wondering if the interaction should only be bound to |
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… |
I'm using 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 👍 |
That message could be a custom string formed from the input itself. +1 to @iam4x volunteering for the PR!
|
@iam4x If you like to add a PR that would be great! :) |
Any progress on this? |
I needed a similar functionality too, so here's my PR: |
This is awesome, thanks @dimafeldman! |
The PR #167 got merged. |
@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 ( 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 I was thinking something along the lines of |
Hi @ro-ka! Another n00b question:
How do you suggest we handle the case where no result is found in the auto-suggest? Is it possible for the input field to just take the string inputted and pass that as a value (or is that already being done?)
The text was updated successfully, but these errors were encountered: