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.
- Add an optional inputID prop.
- Add an optional shouldSaveDraft prop that defaults to false.
- Make the value prop optional.
- Change any onChange prop, e.g. onTextChange to onChange.
- In the input’s onBlur method, call props.onBlur().
- In the input’s onChange method, call props.onChange() .
- Remove the hasError prop.
- Update the error message to display if errorText is truthy.
- Make sure that props.ref is attached to the appropriate DOM node. This could involve forwarding the ref to a child component.
- Make sure the ref is exposing both value and focus().
- Add an optional maxLength prop to text inputs and UI to display the current character count out of the limit.
- Add a hint prop and display the text under the input if there is no existing error.
- 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 errorslink 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)
@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.jsbut 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.
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.
Yes. We will start with AddressForm, then IdentityForm, and then RequestorStep. Then eventually
ACHContractStep.