# react-native-drag-drop-grid-library

> A react-native Drag Drop Grid library works animations are similar to android default launcher app

Latest version **1.0.7** (published 2019-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-drag-drop-grid-library
pnpm add react-native-drag-drop-grid-library
yarn add react-native-drag-drop-grid-library
bun add react-native-drag-drop-grid-library
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2019-05-19 |
| First published | 2019-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 456 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Unicorn Coder |
| Maintainers | unicorn_coder |
| Keywords | react-native, drag, drop, Grid, Sortable, Grid |

## Links

- npm: https://www.npmjs.com/package/react-native-drag-drop-grid-library
- Repository: https://github.com/unicorncoderforever/DragDropLibrary
- Homepage: https://github.com/unicorncoderforever/DragDropLibrary#readme
- Issues: https://github.com/unicorncoderforever/DragDropLibrary/issues
- npm.io page: https://npm.io/package/react-native-drag-drop-grid-library

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2019-05-19
- 1.0.6 — 2019-05-19
- 1.0.5 — 2019-05-19
- 1.0.4 — 2019-05-10
- 1.0.3 — 2019-05-10
- 1.0.2 — 2019-05-08
- 1.0.1 — 2019-05-08
- 1.0.0 — 2019-05-08

## README

# DragDropLibrary
A Sample React Native Library for Draggable Sortable Grid , Performs operations like 

 - re-ordering grid items, 
 - deleting animation grid items 
 -  merge animation for grid items


<p align="center">
  <img alt="Issue Stats" width="400" src="https://github.com/unicorncoderforever/DragDropLibrary/blob/master/demo.gif?raw=true">
</p>


## Library Installation

> npm i react-native-drag-drop-grid-library --save

## Sample Implementation
Suppose alphabets is an array of objects

 ```javascript
 
  this.alphabets = ['1','2','3','4','5','6',
    '7','8','9','10','11','12',
    '13','14','15','16','17','18',
    '19','20','21','22','23','24'];
 ```

# Features:
- Sortable(Draggable) Grid feature:
 ```javascript
render(){
 <View style={{ flex: 1 }}>
 <DragDropGrid
      ref={sortGrid => {
        this.sortGrid = sortGrid;
      }}
      blockTransitionDuration={400}
      activeBlockCenteringDuration={200}
      itemsPerRow={4}
      dragActivationTreshold={200}
      onDragRelease   = { (itemOrder) => console.log("Drag was released, the blocks are in the following order: ", itemOrder)       }   
      onDragStart = { (key)          => console.log("Some block is being dragged now!",key) }>
        {
          this.alphabets.map( (letter, index) =>
            <View key={letter} style={[styles.block, { backgroundColor: this.getColor() }]}
            >
            <Text
             style={{color: 'white', fontSize: 50}}>{letter}</Text>
            </View>
          )
        }
     </DragDropGrid>
     </View>
 }
     

```
- Merge on Grid Item Overlap
```javascript

render(){
 <View style={{ flex: 1 }}>
     <DragDropGrid
      ref={sortGrid => {
        this.sortGrid = sortGrid;
      }}
      blockTransitionDuration={400}
      activeBlockCenteringDuration={200}
      itemsPerRow={4}
      dragActivationTreshold={200}
      onDragRelease   = { (itemOrder) => console.log("Drag was released, the blocks are in the following order: ", itemOrder)       }   
      onDragStart = { (key)          => console.log("Some block is being dragged now!",key) }   
      onMerge = {(itemKey,mergeBlockKey) => console.log("item and merge item",itemKey,mergeBlockKey)}
      merge={true}>
        {
          this.alphabets.map( (letter, index) =>
            <View key={letter} style={[styles.block, { backgroundColor: this.getColor() }]}
            >
            <Text
             style={{color: 'white', fontSize: 50}}>{letter}</Text>
            </View>
          )
        }
      </DragDropGrid>
    </View>
  }

```
- Delete Grid Items
```javascript

onRemove(letter){
this.sortGrid.deleteBlockList(letter);
}


render() {
    return (
    <View style={{ flex: 1 }}>
    <DragDropGrid
    ref={sortGrid => {
      this.sortGrid = sortGrid;
    }}
      blockTransitionDuration={400}
      activeBlockCenteringDuration={200}
      itemsPerRow={4}
      dragActivationTreshold={200}
      onDragRelease   = { (itemOrder) => console.log("Drag was released, the blocks are in the following order: ",itemOrder)}       onDragStart = { (key)          => console.log("Some block is being dragged now!",key) }   
      onDeleteItem   = { (item) => console.log("Item was deleted:", item) }>
        {
          this.alphabets.map( (letter, index) =>
            <View key={letter} style={[styles.block, { backgroundColor: this.getColor() }]}
            >
            <Text
             style={{color: 'white', fontSize: 50}}>{letter}</Text>
              <View style={[styles.close]}>
              <TouchableOpacity
              activeOpacity={0.5}
              onPress={()=> this.onRemove(letter)}>
              <View
              style={[
              styles.circle,
              { width: 25, height: 25, backgroundColor: '#1A325E' },
              this.props.style
              ]}
              >
             <Image resizeMode="contain" style={{ height: 19 }} source={require('./assets/close_white.png')} />
            </View>
            </TouchableOpacity>
            </View>
            </View>
          )
        }
      </DragDropGrid>
      </View>
    )
  }
  
  ```

---
_Source: https://npm.io/package/react-native-drag-drop-grid-library · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
