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

https://github.com/tomheaton/react-native-checkable-list

react native checkable list
https://github.com/tomheaton/react-native-checkable-list

react-native typescript

Last synced: 4 months ago
JSON representation

react native checkable list

Awesome Lists containing this project

README

          

# react-native-checkable-list

react native checkable list



## Installation

```sh
# npm
npm install react-native-checkable-list

# yarn
yarn add react-native-checkable-list
```

## Usage

```jsx
import React from "react";
import { View, Text } from "react-native";
import CheckableList, { useCheckedItems } from 'react-native-checkable-list';

export default function App() {
const [items, setItems] = React.useState<{ name: string; amount: number }[]>([
{ name: 'apple', amount: 1 },
{ name: 'banana', amount: 2 },
{ name: 'orange', amount: 3 },
]);

const { checkedItems, setCheckedItems } = useCheckedItems();

return (

item.name}
renderItem={(item) => (


{item.name} x {item.amount}


)}
onPressItem={(item) => {
console.log('onPressItem', item.name);
}}
canCheckItem={(item) => item.name !== 'banana'}
checkedItems={checkedItems}
setCheckedItems={setCheckedItems}
/>

);
}
```

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)