Skip to content

Commit 8acfdec

Browse files
authored
fix: reset overlay content when Reveal composable is disposed (#197)
1 parent 4433dd4 commit 8acfdec

File tree

1 file changed

+9
-0
lines changed
  • reveal-core/src/commonMain/kotlin/com/svenjacobs/reveal

1 file changed

+9
-0
lines changed

reveal-core/src/commonMain/kotlin/com/svenjacobs/reveal/Reveal.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.compose.foundation.gestures.detectTapGestures
55
import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.fillMaxSize
77
import androidx.compose.runtime.Composable
8+
import androidx.compose.runtime.DisposableEffect
89
import androidx.compose.runtime.LaunchedEffect
910
import androidx.compose.runtime.derivedStateOf
1011
import androidx.compose.runtime.getValue
@@ -158,6 +159,14 @@ public fun Reveal(
158159
}
159160
}
160161
}
162+
163+
// When the Reveal composable is disposed we need to reset overlayContent or else the effect
164+
// might remain on the screen (issue #196).
165+
DisposableEffect(Unit) {
166+
onDispose {
167+
revealCanvasState.overlayContent = null
168+
}
169+
}
161170
}
162171

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

0 commit comments

Comments
 (0)