fix(iOS): useHeaderHeight does not report correct value after cancelling search #2817
Merged
maciekstosio merged 5 commits intomainfrom Apr 1, 2025
Merged
fix(iOS): useHeaderHeight does not report correct value after cancelling search #2817maciekstosio merged 5 commits intomainfrom
useHeaderHeight does not report correct value after cancelling search #2817maciekstosio merged 5 commits intomainfrom
Conversation
kkafar
requested changes
Mar 31, 2025
Comment on lines
+78
to
+81
| BOOL isNotDismissingModal = screenController.presentedViewController == nil || | ||
| (screenController.presentedViewController != nil && | ||
| ![screenController.presentedViewController isBeingDismissed]); | ||
| ![screenController.presentedViewController isBeingDismissed]) || | ||
| ([screenController.presentedViewController isKindOfClass:[UISearchController class]]); |
Member
There was a problem hiding this comment.
The condition is ok, but naming is misleading.
Either rename the variable to isNotDismissingModalOrPresentingSearchController or
split this condition - leave isNotDismissingModal as is and add new variable isNotPresentingSearchController and use it below.
Contributor
Author
There was a problem hiding this comment.
Hmmm, I think the naming is correct, although it's unnecessarily (?) complicated.
BOOL isDismissingModal = (screenController.presentedViewController != nil && [screenController.presentedViewController isBeingDismissed]);
and then
if (![screenController hasNestedStack] && !isDismissingModal) {
useHeaderHeight does not report correct value after cancelling search
Co-authored-by: Kacper Kafara <kacper.kafara@swmansion.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes #2611.
After this changes the hook will provide header height values after focusing search bar.
Changes
It seems that we have a logic, that disables
useHeaderHeightupdates when the modal is being closed. The condition assumes that only if there is a presentedViewController, this is a modal. But it looks like it can also be aUISearchController, so we exclude that from the condition.Screenshots / GIFs
before.mov
after.mov
Checklist