Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jolanrensen/react-list-kotlin-js-react-wrapper

This simple repo allows you to use react-list (https://www.npmjs.com/package/react-list) from your Kotlin/JS/React project.
https://github.com/jolanrensen/react-list-kotlin-js-react-wrapper

Last synced: 26 days ago
JSON representation

This simple repo allows you to use react-list (https://www.npmjs.com/package/react-list) from your Kotlin/JS/React project.

Awesome Lists containing this project

README

        

# react-list Kotlin/JS/React wrapper
This simple repo allows you to use react-list (https://www.npmjs.com/package/react-list) from your Kotlin/JS/React project.

Feel free to turn it into a library, as I'm not sure how (plus, I'm kinda busy).

Example:
```kotlin
var list: ReactListRef? = null

private val renderRow: (Int, String) -> ReactElement? = { index: Int, key: String ->
buildElement {
// Build your list item here based on the index given and give it the key
}
}

override fun RBuilder.render() {
styledReactList {
css {
width = 320.px
}
attrs {
length = yourItems
itemRenderer = renderRow
type = "variable"
ref {
list = it
}
}
}
}

fun scrollToTop() {
list?.scrollTo(0)
}```