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: 4 months 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.
- Host: GitHub
- URL: https://github.com/jolanrensen/react-list-kotlin-js-react-wrapper
- Owner: Jolanrensen
- License: mit
- Created: 2020-01-04T17:08:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-01T14:43:14.000Z (over 5 years ago)
- Last Synced: 2025-01-17T06:46:11.015Z (6 months ago)
- Language: Kotlin
- Size: 8.79 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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? = nullprivate 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)
}```