修改弹窗
This commit is contained in:
@@ -21,12 +21,13 @@ const TitleTextarea: React.FC<TitleTextareaProps> = ({
|
||||
onFocus,
|
||||
onBlur
|
||||
}) => {
|
||||
const isOverflow = value.length > maxLength
|
||||
const handleChange = useCallback((values) => {
|
||||
if (values.length > maxLength ) {
|
||||
const newValues = values.slice(0, maxLength)
|
||||
onChange(newValues)
|
||||
return;
|
||||
}
|
||||
// if (values.length > maxLength ) {
|
||||
// const newValues = values.slice(0, maxLength)
|
||||
// onChange(newValues)
|
||||
// return;
|
||||
// }
|
||||
onChange(values)
|
||||
}, [])
|
||||
return (
|
||||
@@ -42,7 +43,9 @@ const TitleTextarea: React.FC<TitleTextareaProps> = ({
|
||||
onFocus={onFocus}
|
||||
onBlur={onBlur}
|
||||
/>
|
||||
<View className='char-count'>{value.length}/{maxLength}</View>
|
||||
<View className={`char-count${isOverflow ? ' char-count--error' : ''}`}>
|
||||
{value.length}/{maxLength}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user