From 8d5b303f50cc233c7a4a75d0147b2e84c67f2b43 Mon Sep 17 00:00:00 2001 From: Kim Ying <15070078+kimprice@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:28:27 -0700 Subject: [PATCH] use 'filter' instead of 'pattern' --- react-common/components/controls/Input.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/react-common/components/controls/Input.tsx b/react-common/components/controls/Input.tsx index 89019f2b22b..12a560320e9 100644 --- a/react-common/components/controls/Input.tsx +++ b/react-common/components/controls/Input.tsx @@ -60,13 +60,12 @@ export const Input = (props: InputProps) => { onOptionSelected, handleInputRef, preserveValueOnBlur, - options, - filter + options } = props; const [value, setValue] = React.useState(initialValue || ""); const [expanded, setExpanded] = React.useState(false); - const [pattern, setPattern] = React.useState(filter ? new RegExp(filter) : undefined); + const [filter] = React.useState(props.filter ? new RegExp(props.filter) : undefined); let container: HTMLDivElement; @@ -87,8 +86,8 @@ export const Input = (props: InputProps) => { const changeHandler = (e: React.ChangeEvent) => { let newValue = (e.target as any).value; - if (newValue && pattern) { - newValue = newValue.match(pattern)?.join("") || ""; + if (newValue && filter) { + newValue = newValue.match(filter)?.join("") || ""; } if (!readOnly && (value !== newValue)) { setValue(newValue);