jvmusin
02/18/2021, 6:41 PMreact-tooltip
to my project. https://www.npmjs.com/package/react-tooltip
It has some static methods like ReactTooltip.show(element)
How can I add these methods with the new IR compiler?
I used a workaround to avoid problems with default
described here: https://github.com/anton-bannykh/web-app-react-kotlin-js-gradle/blob/IR-fixes/src/main/kotlin/ReactPlayer.kt
This thread is related: https://github.com/JetBrains/kotlin-wrappers/issues/361
And this is my code for ReactTooltip:
import react.RClass
import react.RProps
@JsModule("react-tooltip")
@JsNonModule
external object ReactTooltip {
val default: RClass<ReactTooltipProps>
}
external interface ReactTooltipProps : RProps {
var id: String
var type: String
}
I tried to add this method as an instance method on object ReactTooltip
, but JS says it's not a function.
I also tried to add it like val show: (target: Element) -> Any = definedExternally
, but it doesn't seem to work too.
Any suggestions?jvmusin
02/18/2021, 6:57 PMturansky
02/18/2021, 7:19 PMjvmusin
02/18/2021, 7:26 PMWrong body of external declaration. Must be either ' = definedExternally' or { definedExternally }
and Inline external declaration
. The second error can be fixed by removing inline
, but what about the first one?jvmusin
02/18/2021, 7:26 PMdefault
, thanks!turansky
02/18/2021, 7:29 PM@file:Suppress("INLINE_EXTERNAL_DECLARATION")
turansky
02/18/2021, 7:29 PMturansky
02/18/2021, 7:31 PMjvmusin
02/18/2021, 7:38 PMturansky
02/18/2021, 7:47 PMturansky
02/18/2021, 7:48 PM