stream-chat-swiftui icon indicating copy to clipboard operation
stream-chat-swiftui copied to clipboard

Allow opting-out of NavigationView embed for ChatChannelListView

Open Sam-Spencer opened this issue 2 years ago โ€ข 0 comments

๐Ÿ”— Issue Link

GitHub Issue #219

๐ŸŽฏ Goal

Allow for more flexible presentation of the ChatChannelListView. In its current form, the messages list view can only be displayed as a root view (e.g. sidebar or tab item) or via a modal-presentation (e.g. sheet or fullScreenCover). Currently, if you attempt to push the ChatChannelListView onto an existing navigation stack you'll wind up with two navigation bars layered vertically on the screen. This isn't right.

The goal of this PR is to preserve the usability and ease-of-use for existing and recommended implementations, while providing flexibility to present in the way that makes the most sense for an application.

๐Ÿ›  Implementation

To achieve this, I've added a flag to the MessageListConfig object: embedInNavigationView. The new value defaults to true, ensuring no breaking changes to existing behavior. However, when set to false the ChatChannelListView will be presented without an enclosing NavigationView. In that case, any presenting view should then take the responsibility of wrapping it in an appropriate navigation mechanism.

๐Ÿงช Testing

Testing is easy! Run as is to ensure the project still behaves as expected. You can run the Demo app to verify as well as UI and Unit tests.

๐ŸŽจ Changes

โ˜‘๏ธ Checklist

  • [x] I have signed the Stream CLA (required)
  • [x] Changelog is updated with client-facing changes
  • [x] New code is covered by unit tests -- Nothing to change
  • [x] Affected documentation updated (docusaurus, tutorial, CMS (task created)) -- I think I did this properly

Sam-Spencer avatar Oct 17 '22 23:10 Sam-Spencer