From 19f666fe82b69dc03827ee255acc6c0791e42421 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 23 Aug 2024 10:27:09 -0700 Subject: [PATCH] expose onInput in component, force lowercase for email input --- Client/src/Components/Inputs/Field/index.jsx | 5 +++++ Client/src/Pages/Auth/Register/Register.jsx | 1 + 2 files changed, 6 insertions(+) diff --git a/Client/src/Components/Inputs/Field/index.jsx b/Client/src/Components/Inputs/Field/index.jsx index 0b2fe56fe..335ed178f 100644 --- a/Client/src/Components/Inputs/Field/index.jsx +++ b/Client/src/Components/Inputs/Field/index.jsx @@ -48,6 +48,7 @@ const Field = forwardRef( placeholder, value, onChange, + onInput, error, disabled, }, @@ -87,6 +88,7 @@ const Field = forwardRef( multiline={type === "description"} rows={type === "description" ? 4 : 1} value={value} + onInput={onInput} onChange={onChange} disabled={disabled} inputRef={ref} @@ -176,6 +178,8 @@ const Field = forwardRef( } ); +Field.displayName = "Field"; + Field.propTypes = { type: PropTypes.oneOf(["text", "password", "url", "email", "description"]), id: PropTypes.string.isRequired, @@ -189,6 +193,7 @@ Field.propTypes = { placeholder: PropTypes.string, value: PropTypes.string.isRequired, onChange: PropTypes.func, + onInput: PropTypes.func, error: PropTypes.string, disabled: PropTypes.bool, }; diff --git a/Client/src/Pages/Auth/Register/Register.jsx b/Client/src/Pages/Auth/Register/Register.jsx index a06075b5a..4680c1821 100644 --- a/Client/src/Pages/Auth/Register/Register.jsx +++ b/Client/src/Pages/Auth/Register/Register.jsx @@ -226,6 +226,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => { placeholder="jordan.ellis@domain.com" autoComplete="email" value={form.email} + onInput={(e) => (e.target.value = e.target.value.toLowerCase())} onChange={onChange} error={errors.email} ref={inputRef}