Skip to content

Jolanrensen/react-list-Kotlin-JS-React-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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:

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)
}```

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages