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

fix(ios): properly dismiss search controller after editing #12906

Merged
merged 2 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2082,8 +2082,11 @@ - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
if ([searchBar.text length] == 0) {
self.searchString = @"";
[self buildResultsForSearchText];
[self performSelector:@selector(dismissSearchController) withObject:nil afterDelay:.2];
}

// Finished editing, always dismiss search controller.
// Only one search controller can be active at a time.
[self performSelector:@selector(dismissSearchController) withObject:nil afterDelay:.2];
}

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
Expand Down
11 changes: 10 additions & 1 deletion iphone/Classes/TiUITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,13 @@ - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
// Also if a previous search string exists this reload results in blank cells.
}

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
{
// Finished editing, always dismiss search controller.
// Only one search controller can be active at a time.
[self performSelector:@selector(dismissSearchController) withObject:nil afterDelay:.2];
}

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
// called when keyboard search button pressed
Expand Down Expand Up @@ -2446,7 +2453,9 @@ - (void)hideDimmingView

- (void)dismissSearchController
{
[searchController setActive:NO];
if (searchController.isActive) {
[searchController setActive:NO];
}
}

- (void)keyboardWillChangeFrame:(NSNotification *)notification
Expand Down