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
[TIMOB-25491] : iOS Ti.UI.SearchBar not slide down when set visible a view on top #9622
Conversation
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few review comments that should be addressed before continuing.
iphone/Classes/TiUIListView.m
Outdated
if ([proxy isKindOfClass:[TiWindowProxy class]]) { | ||
searchControllerPresenter = [proxy windowHoldingController]; | ||
} else { | ||
searchControllerPresenter = [[TiApp app] controller]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you ensure this does not get released before closing the window?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed it is just used to push the controller and every time before presenting controller it is calculated again.
iphone/Classes/TiUIListView.m
Outdated
viewController = [[TiApp app] controller]; | ||
BOOL shouldAnimate = YES; | ||
if ([TiUtils isIOS9OrGreater]) { | ||
shouldAnimate = NO; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not BOOL shouldAnimate = ![TiUtils isIOS9OrGreater];
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Done.
iphone/Classes/TiUIListView.m
Outdated
@@ -2328,7 +2372,7 @@ - (void)initSearchController:(id)sender | |||
searchController = [[[UISearchController alloc] initWithSearchResultsController:resultViewController] retain]; | |||
searchController.delegate = self; | |||
searchController.searchResultsUpdater = self; | |||
searchController.hidesNavigationBarDuringPresentation = NO; | |||
searchController.hidesNavigationBarDuringPresentation = YES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to prevent that breaking change, I am pretty sure people will complain later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is default behaviour. Though we can expose this property. Will continue to look in same.
iphone/Classes/TiUITableView.m
Outdated
#if IS_XCODE_9 | ||
if ([TiUtils isIOS11OrGreater]) { | ||
topMargin += self.safeAreaInsets.top; | ||
tableview.frame = CGRectMake(0, self.safeAreaInsets.top, tableview.frame.size.width, tableview.frame.size.height - self.safeAreaInsets.top); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that always be done? I thought only when having the extendSafeArea
property set?
iphone/Classes/TiUITableView.m
Outdated
#endif | ||
UIView *searchSuperView = [searchController.view superview]; | ||
if (!searchSuperView) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When can that happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need of this as
if (![searchController isActive]) {
return;
}
is already checking for same. So removed.
iphone/Classes/TiUITableView.m
Outdated
searchController.view.frame = CGRectMake(convertedOrigin.x, topMargin, self.frame.size.width, self.frame.size.height); | ||
dimmingView.frame = CGRectMake(searchController.view.frame.origin.x, searchController.view.frame.origin.y, self.frame.size.width, self.frame.size.height); | ||
|
||
float width = [searchField view].frame.size.width; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CoreGraphics types, e.g. CGFloat
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
iphone/Classes/TiUITableView.m
Outdated
resultSuperview.frame = CGRectMake(0, view.frame.origin.y + searchController.searchBar.frame.size.height, self.frame.size.width, self.frame.size.height); | ||
resultViewController.tableView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); | ||
|
||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line, please lint everything.
iphone/Classes/TiUITableView.m
Outdated
@@ -1809,7 +1857,7 @@ - (void)initSearhController | |||
resultViewController = [[UITableViewController alloc] init]; | |||
resultViewController.tableView = [self searchTableView]; | |||
searchController = [[[UISearchController alloc] initWithSearchResultsController:resultViewController] retain]; | |||
searchController.hidesNavigationBarDuringPresentation = NO; | |||
searchController.hidesNavigationBarDuringPresentation = YES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, try to prevent or we need to explicitly mark that in the docs.
iphone/Classes/TiUITableView.m
Outdated
#if IS_XCODE_9 | ||
if ([TiUtils isIOS11OrGreater]) { | ||
tableview.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel save with this. What if the table is not positioned full screen? And what about orientation changes? Please add tests for those scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Table's contentOffset should be managed rather table view frame. Otherwise view below to tableview will get visible. So managed contentOffset rather frame.
iphone/Classes/TiUITableView.m
Outdated
BOOL shouldAnimate = YES; | ||
if ([TiUtils isIOS9OrGreater]) { | ||
shouldAnimate = NO; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before, please refactor the assignment to be less if-based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed FR with this environment:
Node Version: 8.9.1
NPM Version: 5.5.1
Mac OS: 10.13.1
Appc CLI: 7.0.0-master.48
Appc CLI NPM: 4.2.11-4
Titanium SDK version: 7.0.0 locally built from this PR
Appcelerator Studio vers 4.10.0
Xcode 9.1/iOS 11.1 iPhone 7 Plus
I tried both test cases that were in the ticket, and the view above the searcher did appear.
@vijaysingh-axway unit tests appear to be failing. Can you please look into those? I'll merge once tests pass. |
@mukherjee2, Unit test failure issue fixed. |
iphone/Classes/TiUITableView.m
Outdated
@@ -2741,9 +2741,9 @@ - (void)presentSearchController:(UISearchController *)controller | |||
proxy = [proxy parent]; | |||
} | |||
if ([proxy isKindOfClass:[TiWindowProxy class]]) { | |||
searchControllerPresenter = [proxy windowHoldingController]; | |||
searchControllerPresenter = [[proxy windowHoldingController] retain]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it did need to retain? :-) Please also run the static analyser to ensure there are no static leaks.
https://jira.appcelerator.org/browse/TIMOB-25491