Skip to content

Commit

Permalink
Fix .sheet presentation after recent update to new Compose BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
aabewhite committed Feb 28, 2024
1 parent a11d2f5 commit 9e65c2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Sources/SkipUI/SkipUI/Containers/Navigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public struct NavigationStack<Root> : View where Root: View {
composable(route: Navigator.rootRoute,
exitTransition: { slideOutHorizontally(targetOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) },
popEnterTransition: { slideInHorizontally(initialOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) }) { entry in
navigator.value.syncState()
if let state = navigator.value.state(for: entry) {
let entryContext = context.content(stateSaver: state.stateSaver)
ComposeEntry(navController: navController, destinations: destinations, destinationsDidChange: preferencesDidChange, isRoot: true, context: entryContext) { context in
Expand All @@ -116,6 +117,7 @@ public struct NavigationStack<Root> : View where Root: View {
exitTransition: { slideOutHorizontally(targetOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) },
popEnterTransition: { slideInHorizontally(initialOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) },
popExitTransition: { slideOutHorizontally(targetOffsetX: { $0 * (isRTL ? -1 : 1) }) }) { entry in
navigator.value.syncState()
if let state = navigator.value.state(for: entry), let targetValue = state.targetValue {
let entryContext = context.content(stateSaver: state.stateSaver)
EnvironmentValues.shared.setValues {
Expand Down Expand Up @@ -360,7 +362,8 @@ final class Navigator {
return backStackState[entry.id]
}

@Composable private func syncState() {
/// Sync our back stack state with the nav controller.
@Composable func syncState() {
let entryList = navController.currentBackStack.collectAsState()

// Fill in ID of state we were navigating to if possible
Expand Down
1 change: 0 additions & 1 deletion Sources/SkipUI/SkipUI/Layout/Presentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ let overlayPresentationCornerRadius = 16.0
ModalBottomSheet(
onDismissRequest: { isPresented.set(false) },
sheetState: sheetState,
containerColor: androidx.compose.ui.graphics.Color.Unspecified,
shape: RoundedCornerShape(topStart: overlayPresentationCornerRadius.dp, topEnd: overlayPresentationCornerRadius.dp),
dragHandle: nil,
windowInsets: WindowInsets(0, 0, 0, 0)
Expand Down

0 comments on commit 9e65c2f

Please sign in to comment.