Skip to content

Commit

Permalink
Replace Compose AnchoredDraggable with internal version
Browse files Browse the repository at this point in the history
Fixes: #44
  • Loading branch information
alexstyl committed Dec 1, 2024
1 parent 2b142ab commit 4fff2c1
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 77 deletions.
9 changes: 5 additions & 4 deletions core/src/commonMain/kotlin/BottomSheet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.*
import com.composables.core.androidx.compose.foundation.gestures.*
import kotlin.jvm.JvmName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -163,7 +164,7 @@ public class BottomSheetState internal constructor(

internal var fullContentHeight = Float.NaN

internal val anchoredDraggableState = AnchoredDraggableState(
internal val anchoredDraggableState = UnstyledAnchoredDraggableState(
initialValue = initialDetent,
positionalThreshold = positionalThreshold,
velocityThreshold = velocityThreshold,
Expand Down Expand Up @@ -259,7 +260,7 @@ public fun BottomSheet(
it.onSizeChanged { sheetSize ->
val sheetHeight = with(density) { sheetSize.height.toDp() }
state.fullContentHeight = sheetSize.height.toFloat()
val anchors = DraggableAnchors {
val anchors = UnstyledDraggableAnchors {
with(density) {
state.closestDentToTop = Float.NaN

Expand Down Expand Up @@ -326,7 +327,7 @@ public fun BottomSheet(
})
} else Modifier
)
.anchoredDraggable(
.unstyledAnchoredDraggable(
state = state.anchoredDraggableState,
orientation = Orientation.Vertical,
enabled = scope.enabled
Expand All @@ -342,7 +343,7 @@ public fun BottomSheet(
}

internal fun ConsumeSwipeWithinBottomSheetBoundsNestedScrollConnection(
sheetState: AnchoredDraggableState<SheetDetent>,
sheetState: UnstyledAnchoredDraggableState<SheetDetent>,
orientation: Orientation,
onFling: (velocity: Float) -> Unit
): NestedScrollConnection =
Expand Down
Loading

0 comments on commit 4fff2c1

Please sign in to comment.