Skip to content

Commit

Permalink
fix(textarea): 修复maxlength=-1时无法输入字符的情况 (jdf2e#1910)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong authored Jan 29, 2024
1 parent 7bb76cd commit e94805d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/packages/textarea/textarea.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const TextArea: FunctionComponent<Partial<TextAreaProps>> = (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
Expand Down
2 changes: 1 addition & 1 deletion src/packages/textarea/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e94805d

Please sign in to comment.