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
- Host: GitHub
- URL: https://github.com/tomheaton/react-native-checkable-list
- Owner: tomheaton
- License: mit
- Created: 2023-03-13T00:35:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-15T21:16:47.000Z (over 3 years ago)
- Last Synced: 2025-05-16T13:44:54.302Z (about 1 year ago)
- Topics: react-native, typescript
- Language: TypeScript
- Homepage: https://npmjs.com/package/react-native-checkable-list
- Size: 1.79 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
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)