Skip to content
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

How can I pass the default value? #10

Closed
webdevyriy opened this issue Nov 8, 2022 · 18 comments
Closed

How can I pass the default value? #10

webdevyriy opened this issue Nov 8, 2022 · 18 comments

Comments

@webdevyriy
Copy link

webdevyriy commented Nov 8, 2022

When I try to remove the default value using the backspace button, I see this error

   <AddressSearchAutocomplete
      {...props}
      label='Address'
      value='Test'

image
image

@webdevyriy
Copy link
Author

This is video

@Zenoo
Copy link
Owner

Zenoo commented Nov 8, 2022

The issue probably comes from your end, I created a demo, and everything works as it should.

Simply replace the API Key by yours.

@webdevyriy
Copy link
Author

Try this

image

@webdevyriy
Copy link
Author

image

@webdevyriy
Copy link
Author

Same problem

@webdevyriy
Copy link
Author

I want to insert data that was saved and then deleted using the button backspace

@Zenoo
Copy link
Owner

Zenoo commented Nov 8, 2022

The value should never be a string. Check the README, it is either null or an AddressAutocompleteValue

@webdevyriy
Copy link
Author

How can you save data?

@webdevyriy
Copy link
Author

If you need to insert the data that you store?

@Zenoo
Copy link
Owner

Zenoo commented Nov 8, 2022

It's up to you to save the placeId, and use it again later like so:

{
	place_id: 'the placeid',
	description: 'the name'
}

@webdevyriy
Copy link
Author

Could you show how it works in the sandbox?

@Zenoo
Copy link
Owner

Zenoo commented Nov 8, 2022

I updated the demo with a preselected address

https://codesandbox.io/s/jolly-breeze-0sidgc?file=/src/App.js

@webdevyriy
Copy link
Author

If you select everything and delete it, then there is no problem, but if you delete it gradually, then it appears again

video

@webdevyriy
Copy link
Author

@webdevyriy
Copy link
Author

Your option
video

@Zenoo
Copy link
Owner

Zenoo commented Nov 8, 2022

I updated the sandbox, you can create a more complex object that more accurately matches the real one:

https://codesandbox.io/s/jolly-breeze-0sidgc?file=/src/App.js

  {
    place_id: "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
    description: "Paris, France",
    components: {},
    structured_formatting: {
      main_text: "Paris",
      secondary_text: "France",
      main_text_matched_substrings: []
    }
  }

@webdevyriy
Copy link
Author

Now everything works. Thanks

@Zenoo Zenoo closed this as completed Nov 8, 2022
@webdevyriy
Copy link
Author

I think this can be added to the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants