dx-platform icon indicating copy to clipboard operation
dx-platform copied to clipboard

react-kit: DateInput. Fix mouse event callbacks signature

Open sutarmin opened this issue 5 years ago • 1 comments

We have wrong types for the following DateInput props: onFocus, onBlur, onMouseEnter and onMouseLeave. Currently, their inferred type is (((event: React.MouseEvent<HTMLElement>) => void) & (() => void)) | undefined which doesn't allow us to pass a callback that requires MouseEvent (because of () => void part).

The reason is that this props declared twice: on the TFullInputProps (with correct signature) and on TDateInputOwnProps itself (wrong one). The solution here is to simply remove these props from TDateInputOwnProps and let them be inferred from TFullInputProps.

sutarmin avatar Apr 24 '19 11:04 sutarmin

Be careful because these handlers may be throttled and this may conflict with event pooling done by React under the hood.

raveclassic avatar Apr 24 '19 12:04 raveclassic