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

mapFromValue does not work, sends syntheticEvent instead of value #156

Open
atomicleads opened this issue Feb 2, 2019 · 2 comments
Open

Comments

@atomicleads
Copy link

atomicleads commented Feb 2, 2019

Example:

 <Form.Field
                id="eMail"
                name="eMail"
                placeholder="Email"
                className="form-control"
                autoComplete="email"
                errorClass="is-invalid"
                value={model.Email}
                mapFromValue={
                  emailValue => {
                    console.log("email value: ", emailValue);
                    return emailValue;
                  }
                }
              />

mapFromValue does not work as expected and as written in documentation:

<Form.Field
  name='name'
  mapFromValue={fieldValue => fieldValue.first + ' ' + fieldValue.last}
/>

fieldValue in this example is received as syntheticEvent.

email value:  SyntheticEvent {dispatchConfig: {…}, _targetInst: FiberNode, nativeEvent: InputEvent, type: "change", target: input#eMail.form-control, …}
@atomicleads
Copy link
Author

Forgot to add that it releated to version 1.0 and you can easily reproducit it by going to Examples and trying to enter date in appropriate example

@jquense
Copy link
Owner

jquense commented Feb 3, 2019

These docs are a little out of date I think. React formal will automatically extract value from a synthetic event but if you do the mapping yourself you would need to handle it. In other words you whatever the input passed to onChange. In the case of default native input it's the change event

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

1 participant