Tlaster / PreCompose

Compose Multiplatform Navigation && State Management

Home Page:https://tlaster.github.io/PreCompose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] spaceToSwipe wasn't changing anything

siftoshka opened this issue · comments

Describe the bug
Seems like spaceToSwipe of SwipeProperties is not doing anything and the swipe area is always the same.

To Reproduce
Steps to reproduce the behavior:

  1. Override SwipeProperties of NavHost
  2. Override spaceToSwipe param of SwipeProperties to anything
  3. Observe that it does not change anything

Expected behavior
Selected spaceToSwipe in dp should be applied to screen.

Minimal reproducible example

NavHost(
    navigator = navigator,
    initialRoute = Route.HomeScreen.route,
    navTransition = DefaultNavTransition,
    swipeProperties = SwipeProperties(spaceToSwipe = 100.dp)
) {
   ...
}

private val DefaultNavTransition = NavTransition(
    createTransition = slideInHorizontally(tween(easing = LinearEasing)) { it },
    destroyTransition = slideOutHorizontally(tween(easing = LinearEasing)) { it },
    pauseTransition = slideOutHorizontally(tween(easing = LinearEasing)) { -it / 2 },
    resumeTransition = slideInHorizontally(tween(easing = LinearEasing)) { -it / 2 },
    exitTargetContentZIndex = 1f
)

I think it is here:

private fun DragSlider(
    state: AnchoredDraggableState<DragAnchors>,
    enabled: Boolean = true,
    spaceToSwipe: Dp = 10.dp,     //the value is always 10.dp
    modifier: Modifier = Modifier,
) {
...
}

And this should be like this in that case:

if (state != null && actualSwipeProperties != null) {
    DragSlider(
        state = state,
        spaceToSwipe = actualSwipeProperties.spaceToSwipe,
        enabled = prevSceneEntry != null,
    )
 }

oops, thanks for pointing that out.

When will this fix be released?

When will this fix be released?

There will be a new release sometime this week or next week which including the fix.