stream-chat-swiftui
stream-chat-swiftui copied to clipboard
Allow opting-out of NavigationView embed for ChatChannelListView
๐ 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