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

OnBlur doesn't work #24

Open
AbhayShiro opened this issue Aug 4, 2020 · 1 comment
Open

OnBlur doesn't work #24

AbhayShiro opened this issue Aug 4, 2020 · 1 comment

Comments

@AbhayShiro
Copy link

What is the current behavior?

https://codesandbox.io/s/52q597j2p

Try OnBlur event here. It doesnt fire the children function when element loses focus.

`
const WhenFieldChanges = ({ field, becomes, set, to }) => (

{(
// No subscription. We only use Field to get to the change function
{ input: { onChange } }
) => (

{({ form }) => (
<React.Fragment>

      <OnChange name={field}>
        {value => {
          if (value === becomes) {
            onChange(to);
          }
        }}
      </OnChange>
      <OnBlur  name={field}>
        {
          () => {
            console.info("got blurred sdhfghjdsgfhdsgfsdfdsjh")
          }
        }
      </OnBlur>
      </React.Fragment>
    )}
  </FormSpy>
)}
);`

It would be nice if u provide a working example.

@abrad45
Copy link

abrad45 commented Aug 27, 2020

OnBlur works fine when the element called by WhenFieldChanges is blurred.

https://codesandbox.io/s/react-final-form-declarative-form-rules-forked-z67ux?file=/src/index.js

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