@@ -5,6 +5,7 @@ import type { CommonInputProps } from '@rc-component/input/lib/interface';
5
5
import type { TextAreaProps , TextAreaRef } from '@rc-component/textarea' ;
6
6
import TextArea from '@rc-component/textarea' ;
7
7
import toArray from '@rc-component/util/lib/Children/toArray' ;
8
+ import useControlledState from '@rc-component/util/lib/hooks/useControlledState' ;
8
9
import KeyCode from '@rc-component/util/lib/KeyCode' ;
9
10
import React , {
10
11
forwardRef ,
@@ -29,7 +30,6 @@ import {
29
30
setInputSelection ,
30
31
} from './util' ;
31
32
import { UnstableContext } from './context' ;
32
- import { useMergedState } from '@rc-component/util' ;
33
33
34
34
type BaseTextareaAttrs = Omit <
35
35
TextAreaProps ,
@@ -171,10 +171,10 @@ const InternalMentions = forwardRef<MentionsRef, MentionsProps>(
171
171
const [ isFocus , setIsFocus ] = useState ( false ) ;
172
172
173
173
// ============================== Value ===============================
174
- const [ mergedValue , setMergedValue ] = useMergedState ( '' , {
175
- defaultValue,
176
- value : value ,
177
- } ) ;
174
+ const [ mergedValue , setMergedValue ] = useControlledState (
175
+ defaultValue || '' ,
176
+ value ,
177
+ ) ;
178
178
179
179
// =============================== Open ===============================
180
180
const { open } = useContext ( UnstableContext ) ;
@@ -564,10 +564,10 @@ const Mentions = forwardRef<MentionsRef, MentionsProps>(
564
564
} ) ) ;
565
565
566
566
// ============================== Value ===============================
567
- const [ mergedValue , setMergedValue ] = useMergedState ( '' , {
568
- defaultValue,
569
- value : customValue ,
570
- } ) ;
567
+ const [ mergedValue , setMergedValue ] = useControlledState (
568
+ defaultValue || '' ,
569
+ customValue ,
570
+ ) ;
571
571
572
572
// ============================== Change ==============================
573
573
const triggerChange = ( currentValue : string ) => {
0 commit comments