Ovsyannikov Alexey
03/14/2022, 12:06 PMComposable
function inside of an interface and realize this function in realizations if that interface. I have tried to use some @Composable
callback getters (val renderer: @Composable () -> Unit
), common functions (@Composable fun render()
) and several other ways, but I got errors in rendering fun (IllegalStateException {message: 'Function TextArea should have been replaced by compiler.', cause: undefined, name: 'IllegalStateException', stack: 'IllegalStateException: Function TextArea should ha…://127.0.0.1:8080/postssystem.client.js:1:2202661'}
error, TextArea
here is external @Composable
top-level function) or event getting an error java.lang.AssertionError: No such value argument slot in IrCallImpl: 0 (total=0).
. Could somebody help me with this?hfhbd
03/14/2022, 12:22 PMTextArea
is external? This: @Composable external fun TextArea()
? This won't workOvsyannikov Alexey
03/14/2022, 1:07 PMinterface Renderer {
fun render()
class Default {
@Composable
override fun render()
}
}
That construction do not lead to any error in compile time but lead to errors in runtime in case of calling @Composable
fun, but if I will mark render
as @Composable
in interface, it will throw java.lang.AssertionError: No such value argument slot in IrCallImpl: 0 (total=0).
in compile timeOvsyannikov Alexey
03/14/2022, 1:08 PMhfhbd
03/14/2022, 1:13 PMimport androidx.compose.runtime.*
import org.jetbrains.compose.web.*
import org.jetbrains.compose.web.dom.*
fun main() {
renderComposableInBody {
A.Default.render()
A.B().render()
}
}
interface A {
@Composable
fun render()
companion object Default: A {
@Composable
override fun render() {
Text("Default")
}
}
class B: A {
@Composable
override fun render() {
Text("B")
}
}
}
Same with TextAreaOvsyannikov Alexey
03/14/2022, 1:21 PMOvsyannikov Alexey
03/14/2022, 1:21 PMhfhbd
03/14/2022, 1:28 PMhfhbd
03/14/2022, 1:29 PMhfhbd
03/14/2022, 1:32 PMOvsyannikov Alexey
03/14/2022, 2:24 PMOvsyannikov Alexey
03/15/2022, 7:14 AMhfhbd
03/15/2022, 9:49 AMshikasd
03/15/2022, 5:11 PMOvsyannikov Alexey
03/17/2022, 5:05 PMOvsyannikov Alexey
03/17/2022, 5:07 PM