Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyboardController.dismiss stays pending until the keyboard is dismissed for the first time #854

Closed
liao02x opened this issue Mar 13, 2025 · 1 comment · Fixed by #857
Closed
Assignees
Labels
🐛 bug Something isn't working

Comments

@liao02x
Copy link

liao02x commented Mar 13, 2025

Describe the bug
KeyboardController.dismiss stays pending until the first time the keyboard is dismissed, resolves right after the first time the keyboard is dismissed, then after that it would work as expected (when it's called, it dismisses the keyboard if it's shown, then resolves).

Code snippet

import { Alert } from 'react-native';
import { KeyboardController } from 'react-native-keyboard-controller';

// inside the component call this and pay attention to when alert shows
KeyboardController.dismiss().then(() => Alert.alert('Dismissed'))

Repo for reproducing
https://github.com/liao02x/react-native-keyboard-controller_keyboard-dismiss-issue-repro

To Reproduce

* It's also in repo readme

  1. when the app is started, press on the TouchableOpacity to dismiss the keyboard
  2. notice that the callback is not called (Alert is not shown)
  3. press on the TextInput to focus it
  4. press out of the TextInput to blur it and dismiss the keyboard
  5. notice that the callback is called (Alert is shown)
  6. now press on the TouchableOpacity to dismiss the keyboard, notice that the callback is called (Alert is shown) no matter if the keyboard is shown or not

Expected behavior
when KeyboardController.dismiss is called, it dismisses the keyboard if it's shown, then resolves, not depending on if the keyboard was dismissed before or not

Screenshots

Simulator.Screen.Recording.-.iPhone.12.mini.-.2025-03-12.at.22.15.47.mp4

Smartphone (please complete the following information):

  • Desktop OS: MacOS 15.3.1
  • Device: iPhone12 mini
  • OS: 18.2
  • RN version: 0.76.6 (expo 52.0.38)
  • RN architecture: new
  • JS engine: Hermes
  • Library version: 1.16.7
@kirillzyusko
Copy link
Owner

Thank you for crafting reproduction example and detailed description! The issue is fixed in #857

Will be published under 1.16.8 next week 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
2 participants