Skip to content
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 6 commits into from
Aug 8, 2024
Merged

Conversation

huanluu
Copy link
Contributor

@huanluu huanluu commented Jul 31, 2024

Platforms Impacted

  • iOS
  • visionOS
  • macOS

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 a wideAccessoryView, which sits at the bottom of the ShyHeaderView. It can be set with or without an accessory view. As a result, on iPhone where there is an accessoryView(SearchBar), both the SearchBar and the wideAccessoryView will shy; and on iPad where there is a topAccessoryView(SearchBar) then only wideAccessoryView 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

"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 not accessoryView, and only the pill segment control will shy. And when user taps on the search bar, the pill segment control doesn't appear.

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • iOS supported versions (all major versions greater than or equal current target deployment version)
  • VoiceOver and Keyboard Accessibility
  • Internationalization and Right to Left layouts
  • Different resolutions (1x, 2x, 3x)
  • Size classes and window sizes (iPhone vs iPad, notched devices, multitasking, different window sizes, etc)
  • iPad Pointer interaction
  • SwiftUI consumption (validation or new demo scenarios needed)
  • Objective-C exposure (provide it only if needed)

@huanluu huanluu requested a review from a team as a code owner July 31, 2024 18:11
@lyzhan7 lyzhan7 merged commit d22f6c2 into microsoft:main Aug 8, 2024
7 checks passed
@harrieshin harrieshin mentioned this pull request Aug 16, 2024
12 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants