Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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
react-native-jiggle-delete-view

## 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