[Feature] Helper to dismiss keyboard
See original GitHub issueCurrently, as far as I can tell, you have to have a reference to a TextField or similar in order to call the dismissSoftInput method. This feels hacky when, for instance, you want to dismiss the keyboard when a certain action is taken by a user in order to show more of the screen.
This is the only way that I know of to dismiss the keyboard, whether or not the field is focused:
const field = <TextField>this.page.getViewById('first-name');
field.dismissSoftInput();
I don’t think that this code clearly expresses the intent of the developer, and could be more concise with something such as:
this.page.dismissSoftInput();
If something similar to this approach is already possible, please let me know.
<bountysource-plugin>Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Best way to dismiss Keyboard in a View Controller iOS (Swift)
First way: Implement UITextFieldDelegate's textFieldShouldReturn method and dismiss current keyboard. this solution seems good enough but not ...
Read more >Close iOS Keyboard by touching anywhere using Swift
An answer to your question on how to dismiss the keyboard in Xcode 6.1 using Swift below: import UIKit class ItemViewController: UIViewController, ...
Read more >How to dismiss iOS keyboard programatically (Swift 5)
This is the quickest way to implement keyboard dismissal. Just set a Tap gesture on the main View and hook that gesture with...
Read more >Dismiss Keyboard SwitUI | Apple Developer Forums
Is there a way to dismiss a decimal Keyboard by tapping (anywhere) on the screen (without putting .onTapGesture {hideKeyboard()} on the NavigationView)
Read more >Swift iOS Dismiss Keyboard - YouTube
In this Swift iOS tutorial, we will go over 3 ways to dismiss the keyboard on an iOS device.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@bearoutthere thank you so much for that code for ios!
Just want to note that there is a typo, which took me awhile to figure out. The single quote is in the wrong place. Don’t copy and paste without reading, folks!
if nativescript can provide extra event binding support like ‘focus’ and ‘blur’ than it will be great to have it.