-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Implement dismissSoftInput() for search-bar #849
Comments
Alright @TobiasHennig, thanks for getting me to look at the android documentation. This seems to do the job.
|
And for completness. As the search-bar inherits from
Footnote: Android seem to set focus on the search-bar when navigating to a page with such on it. iOS does however not. |
Hi, I'd like to know how to implement dismissSoftInput for searchBar and how it works. I've tried the code bellow, but nothing happens on IOS device: exports.pageLoaded = function() {
var searchBarModule = require('ui/search-bar');
var searchBar = page.getViewById('searchid');
searchBar.on(searchBarModule.SearchBar.clearEvent, function(args) {
console.log('-- Cleanned Search for Contacts');
searchBar.dismissSoftInput();
});
}; I also tried: searchBar.on(searchBarModule.SearchBar.clearEvent, function(args) {
if (searchBar.ios) {
console.log('searchBar.ios');
searchBar.ios.endEditing(true);
} else if (searchBar.android) {
searchBar.android.clearFocus();
}
}); My last tried was similar the implementation on editable-text-base.ios.ts: searchBar.on(searchBarModule.SearchBar.clearEvent, function(args) {
if (searchBar.ios) {
console.log('searchBar.ios');
searchBar.ios.resignFirstResponder();
} else if (searchBar.android) {
searchBar.android.clearFocus();
}
});
|
I like that cancel button thingy! For anyone using that: you can also make it appear animated, like this: |
Anyone who have a solution for android? Mine still seems to be behaving very strainge no matter the option I choose from in here. |
Still need for a solution in android. |
I'm facing the same problem with search bar. The focus is unset but then on tab view change it gets focus and sometimes the keyboard pops up.Dont know whats the matter with this. |
Same problem on android. I've tried many different solutions that folks have posted here and on stackoverflow. Some crash my app, others don't work. |
Really want to fix this keyboard action |
I solved the keyboard opening, doing the following: component.html component.ts
|
@dzfweb I'm having problem in case of tab view and pull to refresh. each time i do any of the thing it gets poped up |
@dlucidone I have the same case of you, i have 3 tabs, each with a SearchBar. |
@dzfweb I'll try and see if it works. Thanks |
@dzfweb, your solution seems to work for me. Thanks! |
@dzfweb Thanks, that worked for me as well, although I needed 2 tweaks (on Android 4.4.4) I'd like to share: onSearchBarLoaded(event) {
if (event.object.android) {
setTimeout(() => {
event.object.dismissSoftInput();
event.object.android.clearFocus();
}, 0);
}
}
|
* Include test for issue #849 from nativescirpt-angular * Fix tslint
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature request:
The search-bar has no way of dismissing an open keyboard. This makes the search-bar a quite unusable as the normal user pattern is that the user search for something and then press the item and gets navigated there. On Android (at least on >= 5.x), the open keyboard will continue to stay open, even on the new page. On iOS it will close.
the
editable-text-base
, and therefore thetext-field
, has adismissSoftInput
. Can this be implemented on the search-bar as well?Related, it should probably have the
focus()
method as well.Or am I missing a workaround?
The text was updated successfully, but these errors were encountered: