You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Composable
fun App() {
val value = remember(LocalDensity.current) {
(1..100).random()
}
println("Density: ${LocalDensity.current}")
println("value is $value")
}
results in the following output:
Density: DensityImpl(density=1.0, fontScale=1.0)
value is 15
Density: DensityImpl(density=3.0, fontScale=1.0)
value is 34
on iOS.
That may have side effects like in the #3766 issue.
We should initialize density to correct value before first composition to eliminate this.
The text was updated successfully, but these errors were encountered:
@dima-avdeev-jb
We need to defer the first recomposition until didMoveToWindow was called with non-nil window. That's when a correct density scale is available.
Fixes: JetBrains/compose-multiplatform#3778
Implemented according to what @elijah-semyonov suggested:
> We need to defer the first recomposition until `didMoveToWindow` was
called with non-nil window. That's when a correct density scale is
available.
---------
Co-authored-by: dima.avdeev <dima.avdeev@jetbrains.com>
Fixes: JetBrains/compose-multiplatform#3778
Implemented according to what @elijah-semyonov suggested:
> We need to defer the first recomposition until `didMoveToWindow` was
called with non-nil window. That's when a correct density scale is
available.
---------
Co-authored-by: dima.avdeev <dima.avdeev@jetbrains.com>
The following code snippet:
results in the following output:
on iOS.
That may have side effects like in the #3766 issue.
We should initialize density to correct value before first composition to eliminate this.
The text was updated successfully, but these errors were encountered: