-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add wide accessory view to ShyHeaderView #2080
Merged
Merged
Conversation
This file contains 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
laminesm
reviewed
Jul 31, 2024
laminesm
reviewed
Jul 31, 2024
laminesm
reviewed
Jul 31, 2024
laminesm
reviewed
Jul 31, 2024
mischreiber
reviewed
Aug 7, 2024
mischreiber
reviewed
Aug 7, 2024
mischreiber
approved these changes
Aug 8, 2024
12 tasks
# for free
to join this conversation on GitHub.
Already have an account?
# 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.
Platforms Impacted
Description of changes
Based on my understanding, the current shy header behavior has 2 limitations:
(1) The accessory view is expected to be a SearchBar
(2) The accessory view has an inset on 4 edges so that the accessory view will always looks like it's part of the shy header. This is very obvious when the shy header has a background color.
Now the issue is sometimes we want to make other views to hide and appear when users scroll as well, but we don't want them to have the header background color.
So to solve this problem, in
ShyHeaderView
I added awideAccessoryView
, which sits at the bottom of theShyHeaderView
. It can be set with or without an accessory view. As a result, on iPhone where there is anaccessoryView
(SearchBar
), both theSearchBar
and thewideAccessoryView
will shy; and on iPad where there is atopAccessoryView
(SearchBar
) then onlywideAccessoryView
will shy. So as to matching the design.Also I make the
wideAccessoryView
such that it doesn't have leading, trailing, and bottom inset. As a result, the client code can set the background color of it to match the content view controller so that it doesn't look like a part of header(otherwise the header could look too massive).Binary change
Small code change, no assets, no SwiftUI added. So I don't think there will be a binary change concern.
Verification
NavigationControllerDemoController
:"Show with collapsible search bar and pill segmented control",
https://github.com/user-attachments/assets/832e4714-c820-474c-b274-23447e809797
Note that now both the search bar and the pill segment control will shy when user scrolls. And when user taps on the search bar, the pill segment control will contract as well.
"Show with top search bar for large screen width with a shy pill segment control"
https://github.com/user-attachments/assets/148ad5f0-a2a5-43b3-a696-57323149c00f
Note that the search bar doesn't shy because it's a
topAccessoryView
notaccessoryView
, and only the pill segment control will shy. And when user taps on the search bar, the pill segment control doesn't appear.accessoryView
is working as expected:https://github.com/user-attachments/assets/202d4cee-36da-40f6-bfed-ac1f5ddf3c2a
Pull request checklist
This PR has considered: