diff --git a/src/packages/textarea/textarea.taro.tsx b/src/packages/textarea/textarea.taro.tsx index 4526774273..663fd214ab 100644 --- a/src/packages/textarea/textarea.taro.tsx +++ b/src/packages/textarea/textarea.taro.tsx @@ -57,7 +57,7 @@ export const TextArea: FunctionComponent> = (props) => { const compositionRef = useRef(false) const format = (value: string) => { - if (maxLength !== undefined && value.length > maxLength) { + if (maxLength !== -1 && value.length > maxLength) { return value.substring(0, maxLength) } return value diff --git a/src/packages/textarea/textarea.tsx b/src/packages/textarea/textarea.tsx index 3a643f28b7..a640575e98 100644 --- a/src/packages/textarea/textarea.tsx +++ b/src/packages/textarea/textarea.tsx @@ -62,7 +62,7 @@ export const TextArea: FunctionComponent< const compositionRef = useRef(false) const format = (value: string) => { - if (maxLength !== undefined && value.length > maxLength) { + if (maxLength !== -1 && value.length > maxLength) { return value.substring(0, maxLength) } return value