Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
saket committed Feb 1, 2024
1 parent b8465ac commit 8194cad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test_and_release_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Run tests and publish snapshot

on:
push:
branches: [ trunk ]
pull_request:

jobs:
Expand Down
21 changes: 11 additions & 10 deletions library/src/commonMain/kotlin/me/saket/swipe/SwipeableActionsBox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.absoluteOffset
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -60,14 +59,16 @@ fun SwipeableActionsBox(
}
}

val backgroundColor: Color by animateColorAsState(
when {
state.swipedAction != null -> state.swipedAction!!.value.background
!state.hasCrossedSwipeThreshold() -> backgroundUntilSwipeThreshold
state.visibleAction != null -> state.visibleAction!!.value.background
else -> Color.Transparent
}
)
val backgroundColor = when {
state.swipedAction != null -> state.swipedAction!!.value.background
!state.hasCrossedSwipeThreshold() -> backgroundUntilSwipeThreshold
state.visibleAction != null -> state.visibleAction!!.value.background
else -> Color.Transparent
}
val animatedBackgroundColor: Color = when (state.layoutWidth) {
0 -> backgroundColor
else -> animateColorAsState(backgroundColor).value
}

val scope = rememberCoroutineScope()
Box(
Expand All @@ -93,7 +94,7 @@ fun SwipeableActionsBox(
modifier = Modifier.matchParentSize(),
action = action,
offset = state.offset.value,
backgroundColor = backgroundColor,
backgroundColor = animatedBackgroundColor,
content = { action.value.icon() }
)
}
Expand Down

0 comments on commit 8194cad

Please sign in to comment.