Add snippets for Wear Navigation 3#904
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces Wear OS Navigation3 support by updating project dependencies and adding a sample implementation. The changes include defining serializable destinations and setting up a NavDisplay with a swipe-to-dismiss strategy. Feedback focuses on ensuring the rememberSwipeDismissableSceneStrategy correctly handles back navigation via an onDismiss lambda and recommending the use of a SaveableStateHolder decorator to preserve UI state across transitions.
| @Composable | ||
| fun WearAppWithViewModel() { | ||
| val backStack = rememberNavBackStack(Screen.Home) | ||
| val strategy = rememberSwipeDismissableSceneStrategy<NavKey>() |
There was a problem hiding this comment.
The rememberSwipeDismissableSceneStrategy function requires an onDismiss lambda to handle the back navigation when a swipe gesture is completed. Without this, the swipe-to-dismiss gesture will not update the back stack.
| val strategy = rememberSwipeDismissableSceneStrategy<NavKey>() | |
| val strategy = rememberSwipeDismissableSceneStrategy<NavKey> { | |
| backStack.removeLast() | |
| } |
No description provided.