Skip to content

Commit 2019c8e

Browse files
author
Balaji Sridharan
committed
♻️ Simplify the focus and blur call with modern ES6 feature
1 parent d07308d commit 2019c8e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,17 +454,13 @@ export default class DatePicker extends Component<
454454

455455
safeFocus = () => {
456456
setTimeout(() => {
457-
if (this.input && this.input.focus) {
458-
this.input.focus({ preventScroll: true });
459-
}
457+
this.input?.focus?.({ preventScroll: true });
460458
}, 0);
461459
};
462460

463461
safeBlur = () => {
464462
setTimeout(() => {
465-
if (this.input && this.input.blur) {
466-
this.input.blur();
467-
}
463+
this.input?.blur?.();
468464
}, 0);
469465
};
470466

0 commit comments

Comments
 (0)