fix(keyboard): dismiss native (non-RN) keyboards to unblock Dialog on Send (OK-42598)#11217
Merged
originalix merged 1 commit intoxfrom Apr 15, 2026
Merged
fix(keyboard): dismiss native (non-RN) keyboards to unblock Dialog on Send (OK-42598)#11217originalix merged 1 commit intoxfrom
originalix merged 1 commit intoxfrom
Conversation
… (OK-42598) RN's `Keyboard.dismiss()` is implemented as `TextInputState.blurTextInput(TextInputState.currentlyFocusedInput())` (see react-native/Libraries/Utilities/dismissKeyboard.js) — it only blurs RN-managed TextInputs. Keyboards raised by native inputs outside RN's tracking (e.g. UITextField inside @onekeyfe/react-native-auto-size- input's Nitro HybridView, used by Send amount input) are untouched, so Dialog/Popover/ActionList/Toast.show/etc. kept firing while the system keyboard was still on screen. On iOS that let the keyboard physically cover the Dialog Sheet, leaving only the \$bgBackdrop overlay visible. Switch dismissKeyboard/dismissKeyboardWithDelay to `KeyboardController.dismiss()` from react-native-keyboard-controller, which is a true global dismiss on both platforms: - iOS: `UIResponder.current?.resignFirstResponder()` - Android: `InputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)` Also drop the `Keyboard.isVisible()` guard — it only reflected RN's own tracking and silently skipped dismiss whenever the focused input was a native one.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
limichange
approved these changes
Apr 15, 2026
originalix
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象 (OK-42598)
iOS 上当 Send 输入金额页(键盘展开)出现「队列中有太多待处理的交易」toast,点击 toast 上的「清除处理中的交易」按钮后,屏幕只出现 $bgBackdrop 灰色蒙层,
Dialog本体完全不可见,清理流程也无法继续。根因链路
Dialog.show在挂 Sheet 之前调用Keyboard.dismissWithDelay尝试关键盘。Keyboard.dismiss()。但 RN 的实现是:TextInput,对其他来源的键盘完全无效。@onekeyfe/react-native-auto-size-input(Nitro HybridView)。它内部是原生UITextField/EditText,通过becomeFirstResponder()直接拉起系统键盘,不走 RN 的键盘追踪。因此Keyboard.dismiss()在这个场景下等于空操作。UIRemoteKeyboardWindow的windowLevel高于FullWindowOverlay,所以 Dialog 的 Sheet.Frame 虽然渲染在屏幕底部,但被仍然展开的系统键盘物理覆盖——用户只看到 Sheet.Overlay(灰蒙层)。if (Keyboard.isVisible()) { ... }guard 更让人误以为 dismiss 被正确调用——实际上isVisible()只反映 RN 追踪的那份可见性,Nitro 键盘下返回 false,直接被跳过。修复
把
packages/shared/src/keyboard/index.native.ts里dismissKeyboard/dismissKeyboardWithDelay的底层从 RNKeyboard.dismiss()换成react-native-keyboard-controller的KeyboardController.dismiss(),这是真正的全局 dismiss:两端都和输入框来源无关,只要是 first responder / focused view 就能收掉。顺便去掉
Keyboard.isVisible()的 guard——它只反映 RN 自己追踪的可见性,Nitro 键盘下会误判 false 导致 dismiss 被跳过。影响面:所有复用
dismissKeyboard/dismissKeyboardWithDelay的入口(Dialog / Popover / ActionList / Toast.show / Carousel / Select / OTPInput 等 30+ 处)都会从此可靠收起 Nitro UITextField 拉起的键盘。Test plan
ErrorToast自测)→ 点 toast 的「清除处理中的交易」→ 键盘收起、Dialog 正常弹出、确认后流程正常。