Skip to content

Commit

Permalink
fix lifecycle not handled in js targets
Browse files Browse the repository at this point in the history
  • Loading branch information
kkalisz committed Sep 19, 2024
1 parent 8a57eb5 commit 7d71820
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.window.CanvasBasedWindow
import moe.tlaster.precompose.lifecycle.Lifecycle
import moe.tlaster.precompose.lifecycle.LifecycleOwner
import moe.tlaster.precompose.lifecycle.LifecycleRegistry
import moe.tlaster.precompose.lifecycle.LocalLifecycleOwner
Expand Down Expand Up @@ -74,4 +75,8 @@ class PreComposeWindowHolder : LifecycleOwner, BackDispatcherOwner {
override val backDispatcher by lazy {
BackDispatcher()
}

init {
lifecycle.updateState(Lifecycle.State.Active)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package moe.tlaster.precompose
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import moe.tlaster.precompose.lifecycle.Lifecycle
import moe.tlaster.precompose.lifecycle.LifecycleOwner
import moe.tlaster.precompose.lifecycle.LifecycleRegistry
import moe.tlaster.precompose.lifecycle.LocalLifecycleOwner
Expand Down Expand Up @@ -47,4 +48,8 @@ class PreComposeWindowHolder : LifecycleOwner, BackDispatcherOwner {
override val backDispatcher by lazy {
BackDispatcher()
}

init {
lifecycle.updateState(Lifecycle.State.Active)
}
}

0 comments on commit 7d71820

Please sign in to comment.