Navigation in Sendbird UIKit for Jetpack Compose controls the transition between screens. This document explains how to use UIKit for Jetpack Compose's navigation.
Integrate with your screen
UIKit for Jetpack Compose provides Nested navigation graph to insert UIKit for Jetpack Compose screens in the middle of your screen transition.
To use it, initialize navigation using NavHost
and insert the screens you've created with UIKit for Jetpack Compose through sendbirdGroupChannelNavGraph
.
How to change the starting screen
To change the starting screen of UIKit for Jetpack Compose, change startDestination
. The starting screen of the UIKit is SendbirdNavigationRoute.Channels
, which displays a list of channels. In this example, the starting screen is changed to SendbirdNavigationRoute.Channel
.
How to customize a screen in UIKit
To customize a specific screen in UIKit for Jetpack Compose, use sendbirdGroupChannelNavGraph
to insert the screen and customize it. This example customizes ChannelScreen
. For further customization, refer to the Messages guide.
Routes
UIKit for Jetpack Compose provides the following Route
s:
Route | Description |
---|---|
SendbirdNavigation.GroupChannel | Sendbird GroupChannel Navigation graph route |
SendbirdNavigationRoute.Channel | Sendbird Channel screen route |
SendbirdNavigationRoute.Channels | Sendbird Channels screen route |
SendbirdNavigationRoute.ChannelCreation | Sendbird Create Channel screen route |
SendbirdNavigationRoute.UserInvitation | Sendbird Invite Users screen route |
SendbirdNavigationRoute.Members | Sendbird Member List screen route |
SendbirdNavigationRoute.ChannelSettings | Sendbird Channel Settings screen route |
Extension functions
To use UIKit for Jetpack Compose's Route
s in your code, you can use the following extension functions:
Extension function | Description |
---|---|
NavGraphBuilder.sendbirdGroupChannelNavGraph() | Add Sendbird GroupChannel Navigation graph |
NavController.navigateToChannel(channelUrl: String) | Move to Sendbird Channel screen |
NavController.navigateToChannels() | Move to Sendbird Channels screen |
NavController.navigateToChannelCreation() | Move to Sendbird Channel creation screen |
NavController.navigateToUserInvitation(channelUrl: String) | Move to Sendbird Invite users screen |
NavController.navigateToMembers(channelUrl: String) | Move to Sendbird Members screen |
NavController.navigateToChannelSettings(channelUrl: String) | Move to Sendbird Channel settings screen |
Migrate UIKit for Jetpack Compose in Views
To use UIKit for Jetpack Compose screens in your Activity
or Fragment
, you need to wrap the UIKit's Nested navigation graph with Activity or Fragment and initialize the screens through it.
The following codes show how to migrate the UIKit's screen into Activity
and Fragment
.