fix(identity): stop a leaving surface from taking back

This commit is contained in:
2026-10-16 14:55:36 +02:00
parent a1d36ba1f0
commit 44ab9cd966
@@ -87,7 +87,8 @@ fun Modifier.animateContentSizeMotion(reduceMotion: Boolean = rememberReduceMoti
* the surface leaves and dropped the moment it is shown again, so reopening it
* mid-exit never starts from the shrunk state; a back that leaves it visible
* settles back. Null when the caller doesn't track it: the preview is then held
* for a fixed time before settling back.
* for a fixed time before settling back. A surface that is leaving no longer
* takes back, so a second press reaches the screen underneath.
*/
@Composable
fun Modifier.predictiveBack(
@@ -104,7 +105,7 @@ fun Modifier.predictiveBack(
if (visible == true) progress.snapTo(0f)
}
PredictiveBackHandler(enabled = enabled) { events ->
PredictiveBackHandler(enabled = enabled && visible != false) { events ->
try {
events.collect { event ->
fromLeftEdge = event.swipeEdge == BackEventCompat.EDGE_LEFT