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

Add event onFocusOut for input #2

Closed
artjerom opened this issue Oct 5, 2017 · 3 comments
Closed

Add event onFocusOut for input #2

artjerom opened this issue Oct 5, 2017 · 3 comments

Comments

@artjerom
Copy link

artjerom commented Oct 5, 2017

If an address is selected and we clear the field, then no event occurs. Please correct

@vitalybaev
Copy link
Owner

vitalybaev commented Jan 16, 2019

Do you mean, that when we clear input value we should fire onChange event with an empty address?

@iloveip
Copy link

iloveip commented Sep 8, 2019

I think when the input is cleared, the value should also be cleared. Now it stays (as you can see here).

@vitalybaev
Copy link
Owner

Hello, sorry for the late answer.
I've published new beta version 2.0.0-beta.1, which contains new property, inputProps - it contains all common properties of input tag and passes it to the input in react-dadata.

It allows you to pass your own onChange callback and make some logic:

import { AddressSuggestions } from 'react-dadata';
import 'react-dadata/dist/react-dadata.css';

const [value, setValue] = useState();

const handleInputChange = (event) => {
  // Paste your logic here
}

<AddressSuggestions
  token="API_KEY"
  value={value}
  onChange={setValue}
  inputProps={{
    onChange: handleInputChange,
  }}
/>

Feel free to ask questions you have! Thanks

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

3 participants