App: [$500] IdentityForm

Coming from the New Expensify Forms design doc, we should refactor the inputs within the IdentityForm to be compatible with the new Form component, following the guidelines below:

Here’s an example of a Form refactor: https://github.com/Expensify/App/pull/9056 Here is a component that had its inputs refactored to be compatible with Form.js.

Guidelines

Contributors should first read FORMS.md. The refactored inputs should be functional when wrapped by Form.js and when not.

  1. Add an optional inputID prop.
  2. Add an optional shouldSaveDraft prop that defaults to false.
  3. Make the value prop optional.
  4. Change any onChange prop, e.g. onTextChange to onChange.
  5. In the input’s onBlur method, call props.onBlur().
  6. In the input’s onChange method, call props.onChange() .
  7. Remove the hasError prop.
  8. Update the error message to display if errorText is truthy.
  9. Make sure that props.ref is attached to the appropriate DOM node. This could involve forwarding the ref to a child component.
  10. Make sure the ref is exposing both value and focus().
  11. Add an optional maxLength prop to text inputs and UI to display the current character count out of the limit.
  12. Add a hint prop and display the text under the input if there is no existing error.
  13. Remove any unused code.

Testing

Verify that:

  • UI looks as it did before the refactor
  • Values can be added and edited
  • Errors are highlighted correctly (input border)
  • Error messages show up correctly
  • Draft values are saved properly
  • Form alerts are displayed correctly
  • Clicking the fix the errors link focuses the first input with error
  • No duplicate submission of the form occurs (when it’s already submitting)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 69 (26 by maintainers)

Most upvoted comments

@luacmartins @Santhosh-Sellavel mind prioritizing a review of the linked PR? Thank you!

I could create a storybook component for IdentityForm that use the Form.js but holding this until https://github.com/Expensify/App/issues/9581 passed is a good idea.

Oops sorry! Edited my comment. @mollfpr good to go with your proposal here

You tagged wrongly @luacmartins then we are good to go with @mollfpr proposal.

@mollfpr what about this focus-and-tab-behavior

But there isn’t any implementation done for this, like described in the doc.

Will wait for @luacmartins to confirm.

Also for clarity, a bunch of time has passed since we originally created the Upwork job, so it’s automatically closed in the meantime. I will create a fresh one just as soon as we have a proposal agreed upon.

@neil-marcellini Got it! I’m on my way to send the proposal for AddressForm.

deployed before refactoring ACHContractStep and RequestStep?

Yes. We will start with AddressForm, then IdentityForm, and then RequestorStep. Then eventually ACHContractStep.