Skip to content

Commit

Permalink
fix(ios): properly dismiss search controller after editing
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews authored and ewanharris committed Jun 23, 2021
1 parent b72d886 commit e2894aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
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

0 comments on commit e2894aa

Please sign in to comment.