Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cjinghong/react-native-jiggle-delete-view
https://github.com/cjinghong/react-native-jiggle-delete-view
Last synced: 30 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cjinghong/react-native-jiggle-delete-view
- Owner: cjinghong
- License: mit
- Created: 2021-02-19T17:45:55.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-02-20T07:33:21.000Z (over 3 years ago)
- Last Synced: 2024-09-14T11:14:22.452Z (2 months ago)
- Language: TypeScript
- Size: 4.89 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-jiggle-delete-view
Long press on a view to enter jiggle and delete mode, similar to deleting iOS apps
## Demo
## Installation
```sh
npm install react-native-jiggle-delete-view
```
or
```sh
yarn add react-native-jiggle-delete-view
```## Usage
First import with`import JiggleDeleteView from "react-native-jiggle-delete-view";`
Then, wrap the views that you want to enable jiggle delete with `JiggleDeleteView`, and provide the props `showDeleteJiggle` and `onDelete`.
```js
{
// Delete item
}}
>
// ...
```
A common usage is to wrap `JiggleDeleteView` with a `TouchableOpacity` that sets `showDeleteJiggle` to true on long press. Check the example app for usage inside a `FlatList`.
```js
import JiggleDeleteView from "react-native-jiggle-delete-view";// ...
const [showDeleteJiggle, setShowDeleteJiggle] = React.useState(false);// ...
{
setDeleting(!showDeleteJiggle);
}}
>
{
deleteItem(index);
}}
>
{item.name}
```
## Properties
| **Prop** | **Description** | **Default** | **Required** |
|------------|-------------|--------------|---|
| `children` | Any nested views. This is required. | *None* | Required |
| `showDeleteJiggle` | A boolean that determines if the view is being deleted. When sets to true, `JiggleDeleteView` will start jiggling, and a delete button will show. | `false` | Optional |
| `onDelete` | A function that gets triggered when the delete button is pressed. | *None* | Required |
| `showDeletingAnimation` | A boolean that determines whether to show zoom out animation when delete button is pressed. | `false` | Optional |## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT