1.2.0 • Published 1 year ago

rn-checkbox-list v1.2.0

Weekly downloads
53
License
ISC
Repository
github
Last release
1 year ago

rn-checkbox-list

npm version CodeFactor Coverage Status Codacy Badge

The goal of rn-checkbox-list is to achieve the checkbox list with minimal effort and easy customisation.

Support

rn-checkbox-list versionPlatformRN Version
>= 1.0.0Android, iOS, Windows>=0.62.3
> 0.3Android, iOS, Windows0.61.5
<=0.2Android0.61.5

Setup

This library is available on npm, install it with: npm i @react-native-community/checkbox rn-checkbox-list or yarn add @react-native-community/checkbox rn-checkbox-list

and then run npx pod-install

Usage

  1. Import rn-checkbox-list:
import CheckboxList from 'rn-checkbox-list';
  1. Create data with id and name:
[{ id: 1, name: 'Green Book' }, { id: 2, name: 'Bohemian Rhapsody' }];
  1. Add data to imported component
<CheckboxList headerName="This is header name" listItems={data} />

Sample example

<CheckboxList
  headerName="Movies"
  theme="red"
  listItems={data}
  onChange={({ ids, items }) => console.log('My updated list :: ', ids)}
  listItemStyle={{ borderBottomColor: '#eee', borderBottomWidth: 1 }}
  checkboxProp={{ boxType: 'square' }} // iOS (supported from v0.3.0)
  onLoading={() => <LoaderComponent />}
/>

Check for complete example here.

Available props

NameTypeDefaultDescription
listItemsobject array[]List of checkboxes
selectedListItemsobject array[]List of selected items(subset of listItems)
headerNamestring''Shows header with the given name
listItemStyleobject{}Each check list style
checkboxPropobject{}Custom checkbox style
headerStyleobjectSee hereHeader check list style
onChangefunctionnullFires on each checkbox select or deselect
onLoadingfunctionnullWhen the list is empty and a loader needs to be shown
themestring#1A237ECustom theme color for checkbox
v1.1.0 & above
renderItemfunctionText ComponentCustom render component for each list item

Refer wiki for detailed usecases of the props

Improvements

  • Importing checkbox through updated react-native package (removing warnings)
  • Customisable checkbox colors
  • Provide selected items and selected ids
  • Support for default selected items
  • Support iOS

Pull requests, feedbacks and suggestions are welcome!

1.2.0

1 year ago

1.1.0

3 years ago

1.0.0

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago