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

input field loses focus on first form input character #1571

Closed
afaayerhan opened this issue Aug 19, 2016 · 4 comments
Closed

input field loses focus on first form input character #1571

afaayerhan opened this issue Aug 19, 2016 · 4 comments

Comments

@afaayerhan
Copy link

afaayerhan commented Aug 19, 2016

redux-form v6.0.0-rc.5 but your examples are working perfect. created a separate app with creact-react-app but still acted the same

@jwyuen
Copy link

jwyuen commented Aug 19, 2016

I'm having the same issue here as well

@jwyuen
Copy link

jwyuen commented Aug 19, 2016

@afaayerhan Actually I fixed it by following the fix here:

#1557

Not sure if that's what you were doing but hopefully it's the same issue for you!

@afaayerhan
Copy link
Author

afaayerhan commented Aug 20, 2016

@jwyuen thanks bro, your reply got me discover the problem. would be closing this issue now. for those wondering what the problem is.
don't do this

import React from 'react';
import { reduxForm, Field } from 'redux-form';

const renderField = (props) => (
  <div className="form-group">
    <label className="col-sm-2">{props.placeholder}</label>
    <div className="col-sm-10">
      <input className="form-control" {...props.input} type="text" />
      {props.meta.touched && props.meta.error && <span>{props.meta.error}</span>}
    </div>
  </div>);
const Register = (props) => {
    return (
        <form>
          <Field
            name="firstName"
            placeholder="First Name"
            component={props => renderField(props)}
          />
          <Field
            name="lastName"
            component={props => renderField(props)}
            type="text"
            placeholder="Last Name"
          />
        </form>
        )
}
export default reduxForm({
    form: 'register',
    pure: true

}) (Register);

instead dod like this

import React from 'react';
import { reduxForm, Field } from 'redux-form';

const renderField = (props) => (
  <div className="form-group">
    <label className="col-sm-2">{props.placeholder}</label>
    <div className="col-sm-10">
      <input className="form-control" {...props.input} type="text" />
      {props.meta.touched && props.meta.error && <span>{props.meta.error}</span>}
    </div>
  </div>);
const Register = (props) => {
    return (
        <form>
          <Field
            name="firstName"
            placeholder="First Name"
            component={renderField}
          />
          <Field
            name="lastName"
            component={renderField}
            type="text"
            placeholder="Last Name"
          />
        </form>
        )
}

@lock
Copy link

lock bot commented Jun 2, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants