react-google-places-autocomplete icon indicating copy to clipboard operation
react-google-places-autocomplete copied to clipboard

Injecting custom options in dropdown

Open aconrad opened this issue 3 years ago • 5 comments

Thanks for this great tool!

Sometimes the user will enter an address that doesn't exist in Google Maps and it will either return no results or results that aren't relevant. We'd still want the user to be able to enter their address in plain text, for example if it's a PO Box which Google Maps doesn't support. We could offer their text in the dropdown suggestion for them to select.

What do you think? Are there any ways to achieve that today? And suggestions if we were to support this feature?

aconrad avatar Nov 18 '22 18:11 aconrad

That should actually be pretty easy to implement as react-select has an AsyncCreatableSelect select component.

As of now, it's not supported to use a select component that isn't AsyncSelect, but it should be enough to add a creatable prop to this component and use either AsyncSelect or AsyncCreatableSelect depending on it 🤔

Sadly, I don't have enough time to do this changes probably until we are on mid December or so, but I'll gladly review a PR 😄

Tintef avatar Nov 19 '22 13:11 Tintef

Thanks! I don't know if I'll have time for a PR but if I do I'll submit something.

aconrad avatar Nov 19 '22 17:11 aconrad

Just made a PR for this https://github.com/Tintef/react-google-places-autocomplete/pull/312

uffou avatar Dec 12 '22 08:12 uffou

@uffou I made some changes to the repo and your code is old now -- I also think it missed some stuff around docs/types, that's why I didn't merge before my refactor --.

Can you update?

Tintef avatar Apr 16 '23 16:04 Tintef

@uffou @Tintef I've came across this today in my project. What is needed for this feature to be merged?

SpajicM avatar Feb 05 '24 13:02 SpajicM