Skip to content

Commit 5e70f0b

Browse files
authored
fix: auto focus (#48)
1 parent cf142cc commit 5e70f0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>((props, ref) =>
3636
React.useEffect(() => {
3737
const { autoFocus, disabled } = props;
3838
if (autoFocus && !disabled) {
39-
focus();
39+
(mergedRef.current as any).focus();
4040
}
41-
}, [props.autoFocus, props.disabled]);
41+
}, [props.autoFocus]);
4242

4343
React.useEffect(() => {
4444
if ('checked' in props) {

0 commit comments

Comments
 (0)