react-google-autocomplete
react-google-autocomplete copied to clipboard
Future changes and things you'd change or add.
Hi. Here is a list of changes we are going to make eventually. Feel free to comment on anything you have in your mind.
- ~~Passing a config object as a props to the component(@chexxor).~~ https://github.com/ErrorPro/react-google-autocomplete/issues/12 Done in v2.0.0
- ~~Remove event listeners from the component when it gets unmounted .~~ Done.
- ~~Try to add google place service itself. As separated export.~~ Done
Thanks for maintaining! That one is still on my to-do list. I've got other, higher priority things right now, though. :(
Adding à value field which can be changed (i mean giving the possibility to manually set the value of the component)
I've been trying to implement enter press in the search field to select the first result if there is one, but I have not been able to achieve it.
@ErrorPro Can we please add debouncing capabilities here?
Not sure if adding the onChange event listener would be feasible? Would help tremendously with manual input and client side form validation
Is it possible to add type definitions to avoid adding declare module 'react-google-autocomplete'
to declaration file in Typescript projects?
Debouncing with ms as prop would be great. Can i make a PR for this feature?
@KoderMAL Please! Feel free to submit your PR and we can merge it
@rkyslyy Added TS annotations in v2 but thinking on rewriting the whole lib with TS later, also added TS info in the readme, please have a look!
Hey! I just published a new version(v2.1.0) which has denounce in it. Check it out and let me know your thoughts, thanks
Hey @ErrorPro, It would be super awesome and great if you add 'minChar'(minLengthAutocomplete) prop for <Autocomplete />
component, to reduce the amount of requests.
@nalezhytyi Hey! It's already built in the lib and provided by a hook called usePlacesAutocompleteService
which has debounce in it. Let me know if that's something you are looking for, thanks!
First off: Thank you for a useful library!
I am working on an app that requires internationalization. Is it true to say the "Enter a location" language comes via the fact the Google Autocomplete Service is being used? If possible, having a means to pass through this language would be great.
Hi @ErrorPro, I'm working on trying to use the sessionToken inside usePlacesAutocompleteService.
I took a quick look at the code and couldn't figure out if it would update the session token at some point, because I believe a fresh session token is needed after each call to placesService.getDetails
It would be helpful to expose a refreshSessionToken() function or something if we need to do that ourselves.
Thanks!
First off: Thank you for a useful library!
I am working on an app that requires internationalization. Is it true to say the "Enter a location" language comes via the fact the Google Autocomplete Service is being used? If possible, having a means to pass through this language would be great.
Hey, AFAIK google uses the current user's language by default to translate the texts but you can pass a language setting to it, let me know if that's something you can use
Hi @ErrorPro, I'm working on trying to use the sessionToken inside usePlacesAutocompleteService.
I took a quick look at the code and couldn't figure out if it would update the session token at some point, because I believe a fresh session token is needed after each call to placesService.getDetails
It would be helpful to expose a refreshSessionToken() function or something if we need to do that ourselves.
Thanks!
Hey, you are right regarding the use of session token, that would be indeed a good option to update the sessionToken
value. I will provide a way to update it, I have two options in mind:
- Add an overwrite(proxy) method for
placesService.getDetails
which would not only get the details but will also refresh the session token. Pros: done automatically ifsessionToken
prop presents, cons: you wouldn't have an option to do it yourself. - Add a method
refreshSessionToken
as you suggest which will re-generate the sessionToken whenever you call it. Pros: more flexible and gives more control over it, cons: you have to do it manually.
I am more inclined towards the first approach as it's more automatic and doesn't require knowledge about what/how/when refreshing the token. Any thoughts friends?
I just release v.2.6.0 with an additional method to refresh the session token, check the readme for more info
@ErrorPro plausible feature? #154
Adding onChange would be really helpful to type an address that is not found by google.