Skip to content

Commit

Permalink
fix: reset overlay content when Reveal composable is disposed (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenjacobs authored Jan 19, 2025
1 parent 4433dd4 commit 8acfdec
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -158,6 +159,14 @@ public fun Reveal(
}
}
}

// When the Reveal composable is disposed we need to reset overlayContent or else the effect
// might remain on the screen (issue #196).
DisposableEffect(Unit) {
onDispose {
revealCanvasState.overlayContent = null
}
}
}

public typealias OnClickListener = (key: Key) -> Unit
Expand Down

0 comments on commit 8acfdec

Please sign in to comment.