From e306ac9cd87b19e03e7d0a22d2942ff4b62aecef Mon Sep 17 00:00:00 2001 From: Haixing <65376724+HaixingOoO@users.noreply.github.com> Date: Thu, 4 Apr 2024 11:06:51 +0800 Subject: [PATCH] fix(input): fix input stopPropagation of React16 (#2833) --- src/input/Input.tsx | 2 ++ src/range-input/RangeInput.tsx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/input/Input.tsx b/src/input/Input.tsx index 1b38a8882d..f3d5f367ae 100644 --- a/src/input/Input.tsx +++ b/src/input/Input.tsx @@ -301,6 +301,8 @@ const Input = forwardRefWithStatics( // https://github.com/Tencent/tdesign-react/issues/2320 function handleMouseDown(e: React.MouseEvent) { e.stopPropagation(); + // 兼容React16 + e.nativeEvent.stopImmediatePropagation(); } function handleClear(e: React.MouseEvent) { onChange?.('', { e, trigger: 'clear' }); diff --git a/src/range-input/RangeInput.tsx b/src/range-input/RangeInput.tsx index 4f4d141d6c..dc5eb76632 100644 --- a/src/range-input/RangeInput.tsx +++ b/src/range-input/RangeInput.tsx @@ -104,6 +104,8 @@ const RangeInput = React.forwardRef) { e.stopPropagation(); + // 兼容React16 + e.nativeEvent.stopImmediatePropagation(); } function handleClear(e: React.MouseEvent) {