Lucas
06/21/2022, 2:33 PMBig Chungus
06/22/2022, 2:40 PMSebastien Leclerc Lavallee
06/23/2022, 7:09 PMScott Kruse
06/27/2022, 5:06 PMCLOVIS
06/27/2022, 8:37 PMErik
06/29/2022, 1:12 PMErik
07/01/2022, 2:03 PMTextInput
or NumberInput
? I hoped that adding this would work:
addEventListener("submit") {
onSubmit()
it.preventDefault()
}
And I also tried the "onkeyup"
event, but I can't seem to trigger a callback.
Must I use a Form
for this, or can it be done without one?Ayfri
07/01/2022, 9:34 PMCLOVIS
07/02/2022, 1:50 PMCLOVIS
07/02/2022, 2:09 PMAyfri
07/02/2022, 3:17 PMmargin
and padding
methods doesn't work in styling ?Tunji Dahunsi
07/04/2022, 2:17 PMonLoad
event
• Resize the HTML5 canvas element compose for web renders on
• Call onWasmReady {}
Before rendering my Compose app?
The examples declare a fixed window size in the samples. Using dom listeners just seem to stretch the canvas, I’m wondering if anyone has dealt with this already.Slackbot
07/05/2022, 5:59 PMAyfri
07/05/2022, 9:09 PMmutableState<Boolean>
? For now I have this but it's very ugly I guess 👀
data class Tab(val name: String, val link: String, val selected: MutableState<Boolean> = mutableStateOf(false))
@Composable
fun Tab(tab: Tab) {
NavLink(tab.link, {
if (tab.selected.value) {
ref { htmlAnchorElement ->
htmlAnchorElement.classList.add("selected")
onDispose {}
}
} else {
ref { htmlAnchorElement ->
htmlAnchorElement.classList.remove("selected")
onDispose {}
}
}
}) {
Text(tab.name)
}
}
Tunji Dahunsi
07/06/2022, 4:02 AMfun Font(
identity: String,
data: ByteArray,
weight: FontWeight = FontWeight.Normal,
style: FontStyle = FontStyle.Normal
): Font = LoadedFont(identity, data, weight, style)
However I’m unsure how to create the the ByteArray
for the data
argument. The required .tff
file is in resources, but I’m not sure what API to use to actually read it in js for the browser.Ayfri
07/07/2022, 4:37 PMCedrick Cooke
07/07/2022, 4:38 PMArjan van Wieringen
07/08/2022, 6:44 AMvar editMode by remember { mutableStateOf(false) }
DisposableEffect(Unit) {
val handler : EventListener = object : EventListener {
override fun handleEvent(event: Event) {
if (event.target != null) {
//editMode = false <- compiler error when I uncomment this
}
}
}
document.body?.addEventListener("click", handler)
onDispose {
document.body?.removeEventListener("click", handler)
}
}
And the last part of the stack-trace:
java.lang.IllegalStateException: Validation failed in file Components.kt
at org.jetbrains.kotlin.backend.common.IrValidator.error(IrValidator.kt:83)
at org.jetbrains.kotlin.backend.common.IrValidator.access$error(IrValidator.kt:61)
EDIT: It appears to work when using a lambda function as argument to the eventListener and not an object.Arjan van Wieringen
07/09/2022, 6:23 AMInput
which on recomposition doesn't update the UI with the latest value, but it is visible in the DOM tree. The code is a bit like this
@Composable fun EditableTitle(value: String, onInputChange: (String) -> Unit = {}) {
var editMode by remember { mutableStateOf(false) }
val nativeElement = remember { mutableStateOf<HTMLInputElement?>(null) }
// I need to use this as a hack to overwrite the value so that it works
LaunchedEffect(value) {
nativeElement.value?.value = value
}
LaunchedEffect(editMode, nativeElement.value) {
when {
editMode -> nativeElement.value?.select()
!editMode && nativeElement.value != null -> {
nativeElement.value?.value?.also(onInputChange)
nativeElement.value?.blur()
}
}
}
Input(InputType.Text) {
placeholder("Enter list name...")
defaultValue(value) // when I use value(value) it blocks my UI
refState(nativeElement) // this one uses DisposableEffect to fetch the nativeElement
if (editMode && evt.key == "Enter") {
editMode = false
}
}
}
I do some stuff with some other state variables to make it more UI friendly. The value
parameter can be updated externally as well and when it has been modified at least once in the above Composable, the UI doesn't update if the input value into the composable is changed. When I use the LaunchedEffect(value)
it works. Is this logical?Big Chungus
07/15/2022, 9:30 AMspierce7
07/17/2022, 2:24 AMMrPowerGamerBR
07/23/2022, 2:49 PMtasks.withType<org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile> {
kotlinOptions {
// Jetpack Compose doesn't support Kotlin 1.7.10 yet, but the latest version seems to compile just fine under Kotlin 1.7.10
freeCompilerArgs += listOf("-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true")
}
}
The project compiles and runs fine after disabling the check, using 1.2.0-alpha01-dev750
:)Ayfri
07/24/2022, 2:26 PMorangy
07/28/2022, 6:19 PMAyfri
07/28/2022, 11:11 PMtransitions
lambda set the default values for each ^^
And all
just apply the transition to the properties given, and has an optional lambda argument to have a specific transition for them, for the last part the name is good but just to apply the default values to these properties I didn't come up with a good name, if anyone has an idea I'll listen to it !zt
07/29/2022, 5:05 AM--continuous
option for the jsBrowserRun
task but its not reloading in the browser. When I save, it shows the logs that its sending the data but the site is the same.zt
07/29/2022, 5:22 AMkotlin-js-store
to my .gitignore
file?hfhbd
07/31/2022, 9:47 AMAyfri
07/31/2022, 2:42 PM@import
CSS rule ?Greg Steckman
08/01/2022, 3:22 AMGreg Steckman
08/01/2022, 3:22 AM