Fix crash in NearbyDialog due to missing screen height
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package app.klottr.platform
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import platform.UIKit.UIScreen
|
||||
import platform.CoreGraphics.CGRectGetHeight
|
||||
|
||||
@Composable
|
||||
actual fun platformScreenHeightDp(): Dp {
|
||||
// UIKit gives points; convert to Compose dp via LocalDensity for safety.
|
||||
val heightPoints: Double = CGRectGetHeight(UIScreen.mainScreen.bounds)
|
||||
val density = LocalDensity.current
|
||||
// Compose dp ~= iOS points; still convert explicitly.
|
||||
return with(density) { heightPoints.toFloat().dp }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user