The rest of the react works fine, i just cant figure out how to use @JsModule(“react-map-gl”) and then use the mapping Component… Do i have to write bindings?
Ii have used the Module import successfully, ex:
@JsModule("react-quill")
external val reactQuill: RClass<ReactQuillProps>
when i do the same with this library i get “React.createElement: type is invalid – expected a string (for built-in components) or a class/function (for composite components) but got: object.”
Any help would greatly be appreciated… I am at wits end…
I think the problem is the instantiation because you “call” reactQuill with a closure as argument. I suppose the most simple way is to go over the RBuilder.
Maybe (Not tested):
In one file:
@file:JsModule("react-quill")
package ....
@JsName("ReactQuill")
external class ReactQuill : Component<ReactQuillProps,RState>()
external interface ReactQuillProps : RProps {
var ....
}
In another file:
fun RBuilder.reactQuill(handler: RHandler<ReactQuillProps>) = child(ReactQuill::class, handler)
@file:JsModule("react-map-gl")
package com.timberlist.app.bindings.mapbox
import react.*
@JsName("default")
external val ReactMapboxGl : RClass<ReactMapboxGlProps>
external interface ReactMapboxGlProps : RProps {
var mapboxApiAccessToken: String
var mapStyle: String
var width: Int
var height: Int
var latitude: Double
var longitude: Double
var zoom: Int
}