npm.io
1.0.7 • Published 7 years ago

react-indexlist

Licence
MIT
Version
1.0.7
Deps
2
Size
77 kB
Vulns
0
Weekly
0
Stars
3

react-indexlist

Description

Indexlist component based better-scroll for react。

Quick Start

Install
npm install react-indexlist --save

or yarn add react-indexlist
Usage
import IndexList from 'react-indexlist';
import 'react-indexlist/dist/index.css';
handleSelect = (item) => {
    console.log(item);
}

<IndexList data={arr} onSelect={this.handleSelect} className="my-indexlist" />
Example

indexlist

indexlist

indexlist

Prop types
propTypes: {

    // className of component
    className: PropTypes.string,

    // Array of list
    data: PropTypes.array.isRequired, // Default: Array<{ title: string, items: array<{ name: string }> }>

    // render item by self, return ReactNode
    renderItem: PropTypes.func, // function (item)

    // onClick item callback
    onSelect: PropTypes.func, // function (item)
}
License

MIT

Keywords