Skip to content

Commit

Permalink
fix: auto focus (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
hengkx authored May 18, 2020
1 parent cf142cc commit 5e70f0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>((props, ref) =>
React.useEffect(() => {
const { autoFocus, disabled } = props;
if (autoFocus && !disabled) {
focus();
(mergedRef.current as any).focus();
}
}, [props.autoFocus, props.disabled]);
}, [props.autoFocus]);

React.useEffect(() => {
if ('checked' in props) {
Expand Down

0 comments on commit 5e70f0b

Please sign in to comment.