-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Comments
I'm having the same issue here as well |
@afaayerhan Actually I fixed it by following the fix here: Not sure if that's what you were doing but hopefully it's the same issue for you! |
@jwyuen thanks bro, your reply got me discover the problem. would be closing this issue now. for those wondering what the problem is. 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>
)
} |
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. |
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
The text was updated successfully, but these errors were encountered: