Skip to content

Commit f8c54de

Browse files
committed
fix: input hover focus issue
1 parent d57f0c2 commit f8c54de

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/components/primitives/TextArea/index.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,34 @@ export interface ITextAreaProps
1919
}
2020

2121
const TextArea = (
22-
{ wrapperRef, isDisabled, isInvalid, isReadOnly, ...props }: ITextAreaProps,
22+
{
23+
wrapperRef,
24+
isDisabled,
25+
isInvalid,
26+
isReadOnly,
27+
isFocused: isFocusedProp,
28+
isHovered: isHoveredProp,
29+
...props
30+
}: ITextAreaProps,
2331
ref: any
2432
) => {
2533
const _ref = React.useRef(null);
2634
const { isHovered } = useHover({}, _ref);
27-
const [isFocused, setIsFocused] = React.useState(false);
35+
const [isFocused, setIsFocused] = React.useState(isFocusedProp);
2836
const handleFocus = (focusState: boolean, callback: any) => {
2937
setIsFocused(focusState);
3038
callback();
3139
};
3240
const { totalLines, onFocus, onBlur, ...newProps } = usePropsResolution(
3341
'TextArea',
3442
props,
35-
{ isHovered, isDisabled, isFocused, isInvalid, isReadOnly },
43+
{
44+
isHovered: isHoveredProp || isHovered,
45+
isDisabled,
46+
isFocused,
47+
isInvalid,
48+
isReadOnly,
49+
},
3650
{ extendTheme: ['Input'] }
3751
);
3852
//TODO: refactor for responsive prop

0 commit comments

Comments
 (0)