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

Field custom component cannot be an inline lambda #182

Closed
julienvincent opened this issue Sep 27, 2017 · 1 comment
Closed

Field custom component cannot be an inline lambda #182

julienvincent opened this issue Sep 27, 2017 · 1 comment

Comments

@julienvincent
Copy link
Contributor

julienvincent commented Sep 27, 2017

I am wanting to use <Field /> with the following pattern:

<Field
  name="details.longName"
  component={({field, form}) => {
    return (
      <CustomInput
        {...field}
        onTextChange={value => form.setFieldValue(field.name, value)}
      />
    )
  }}
/>

However after each key-press within the input component, focus is lost. If I pull the wrapping ({field, form}) => { ... } out and make it a constant then everything works as expected.

Note the onTextChange prop in my example might make it seem like this is a react native component, I am experiencing this on web.

@julienvincent
Copy link
Contributor Author

Taking a look at the source, it seems it can be easily remedied. I will submit a PR proposal.

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