From 08b7a343ee331a3d18a0415bbf3bd768c5dce5f0 Mon Sep 17 00:00:00 2001 From: Stephanie Yang Date: Sat, 10 Aug 2024 19:37:04 -0500 Subject: [PATCH] rename ref to inputRef to avoid breaking change --- src/form/Textarea/Textarea.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/form/Textarea/Textarea.tsx b/src/form/Textarea/Textarea.tsx index 66e2bb2c..3440d4b6 100644 --- a/src/form/Textarea/Textarea.tsx +++ b/src/form/Textarea/Textarea.tsx @@ -73,22 +73,22 @@ export const Textarea = forwardRef( theme: customTheme, ...rest }, - ref + inputRef ) => { const containerRef = useRef(null); - const inputRef = useRef(null); + const textareaRef = useRef(null); - useImperativeHandle(ref, () => ({ - inputRef, + useImperativeHandle(inputRef, () => ({ + textareaRef, containerRef, - blur: () => inputRef.current?.blur(), - focus: () => inputRef.current?.focus() + blur: () => textareaRef.current?.blur(), + focus: () => textareaRef.current?.focus() })); useLayoutEffect(() => { if (autoFocus) { // Small timeout for page loading - requestAnimationFrame(() => inputRef.current?.focus()); + requestAnimationFrame(() => textareaRef.current?.focus()); } }, [autoFocus]); @@ -105,7 +105,7 @@ export const Textarea = forwardRef( ref={containerRef} >