From fc04808d09a022b91d951043bb84e64a9fdeb031 Mon Sep 17 00:00:00 2001 From: Soon Wang Date: Tue, 10 Mar 2026 11:44:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(input):=20=E4=BF=AE=E5=A4=8D=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=A1=86=E7=89=B9=E5=AE=9A=E5=A4=B1=E7=84=A6=E5=9C=BA?= =?UTF-8?q?=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/runtime/components/react/mpx-input.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/webpack-plugin/lib/runtime/components/react/mpx-input.tsx b/packages/webpack-plugin/lib/runtime/components/react/mpx-input.tsx index 66405eb60a..1e106735c5 100644 --- a/packages/webpack-plugin/lib/runtime/components/react/mpx-input.tsx +++ b/packages/webpack-plugin/lib/runtime/components/react/mpx-input.tsx @@ -285,7 +285,10 @@ const Input = forwardRef, FinalInputProps const setKeyboardAvoidContext = () => { if (keyboardAvoid) { - keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard, readyToShow: true } + // readyToShow 仅在从另一个输入框切换聚焦时为 true(ref 不同), + // 避免同一个输入框重复调用(onTouchStart + useEffect)或单次聚焦时误设为 true 导致无法正常失焦 + const readyToShow = !!(keyboardAvoid.current && keyboardAvoid.current.ref !== nodeRef) + keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard, readyToShow } } }