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

https://github.com/ashrithks/react-native-selectable-flatlist

Single/Multi Select Flatlist
https://github.com/ashrithks/react-native-selectable-flatlist

flatlist multi-selection multiselect react-native selectable single-select single-selection

Last synced: 9 days ago
JSON representation

Single/Multi Select Flatlist

Awesome Lists containing this project

README

          

# react-native-selectable-flatlist
Single/Multi Select Flatlist

## Getting started

`$ npm install react-native-selectable-flatlist --save`

## DEMO



## Usage
```javascript
import React, { Component } from 'react';
import { View, Text,StyleSheet } from 'react-native';
import SelectableFlatlist, { STATE } from 'react-native-selectable-flatlist';

class Example extends Component {

itemsSelected = (selectedItem) => {
console.log(selectedItem);
}

rowItem = (item) => (

{item.test}

)

render(){
return(

{ this.itemsSelected(selectedItem); }}
initialSelectedIndex={[0]}
cellItemComponent={(item, otherProps) => this.rowItem(item)}
/>

)
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 40
}
});

export default Example;
```

## Props

| name | required | default | description |
| ------------------------- | -------- | -------------- | ------------|
| data | yes | [] | data is just a plain array. |
| state | yes | STATE.EDIT | STATE.DEFAULT, without selection. STATE.EDIT with selection. |
| cellItemComponent | yes | | Child row component to render next check/uncheck componenet. |
| touchStyles | no | | Styles for touch wrapper. |
| renderCheck | no | | Custom Component to render when a row is checked. |
| checkUncheckContainerStyle| no | | Container style of check/uncheck default component. |
| checkColor | no | #00FF00 | Default Color of check icon. |
| checkUncheckSize | no | 30 | Size(Number) of check/uncheck icon. |
| checkIcon | no | | Custom check icon. |
| renderUncheck | no | | Custom Component to render when a row is unchecked. |
| uncheckColor | no | #dfdfdf | Default Color of uncheck icon. |
| uncheckIcon | no | | Custom uncheck icon. |
| initialSelectedIndex | yes | | Array of initially selected item index(Eg:- [0] or [] or [0,1,6]). |
| itemsSelected | yes | | Callback function when an item checked/unchecked which returns selected items array. |
| multiSelect | yes | false | Boolean, single/multi select, true refers to multiselect. |