Skip to content

Commit

Permalink
Fix Web on mobile #3
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Apr 23, 2024
1 parent f54b683 commit 1bbbeac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 7 additions & 1 deletion composeApp/src/commonMain/kotlin/App.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import di.AppModule
import ivy.di.Di
import ivy.di.SharedModule
Expand Down Expand Up @@ -36,5 +39,8 @@ private fun NavGraph() {
// navigate to the initial screen
navigation.navigate(HomeScreen())
}
navigation.NavHost()

Box(modifier = Modifier.fillMaxSize()) {
navigation.NavHost()
}
}
7 changes: 1 addition & 6 deletions composeApp/src/jsMain/kotlin/main.js.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.window.CanvasBasedWindow
import org.jetbrains.skiko.wasm.onWasmReady

@OptIn(ExperimentalComposeUiApi::class)
fun main() {
onWasmReady {
CanvasBasedWindow(canvasElementId = "ComposeTarget") {
Box(Modifier.fillMaxSize()) {
App()
}
App()
}
}
}
2 changes: 1 addition & 1 deletion composeApp/src/jsMain/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</head>
<body>
<div>
<canvas id="ComposeTarget" width="600" height="600"></canvas>
<canvas id="ComposeTarget"></canvas>
</div>
<script src="composeApp.js"></script>
</body>
Expand Down

0 comments on commit 1bbbeac

Please sign in to comment.