Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-drag-sort

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-drag-sort - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

9

DragSortableView.js

@@ -8,2 +8,3 @@ import React, {Component} from 'react'

const sortRefs = new Map()
const animMaps = new Map()
const measureDelay = 100

@@ -128,4 +129,2 @@ const defaultZIndex = 8

}
}

@@ -206,2 +205,6 @@

nextItem = this.state.dataSource[index]
} else if ((this.touchCurItem.index-moveToIndex > 0 && moveToIndex == index+1) ||
(this.touchCurItem.index-moveToIndex < 0 && moveToIndex == index-1)) {
nextItem = this.state.dataSource[index]
}

@@ -399,3 +402,3 @@

if (this.props.onClickItem) {
this.props.onClickItem(item.data,index)
this.props.onClickItem(this.getOriginalData(),item.data,index)
}

@@ -402,0 +405,0 @@ }}>

{
"name": "react-native-drag-sort",
"version": "1.0.0",
"version": "1.0.1",
"description": "Drag and drop sort control for react-native",

@@ -5,0 +5,0 @@ "main": "index.js",

# react-native-drag-sort
Drag and drop sort control for react-native
![GitHub license](https://img.shields.io/badge/license-MIT-green.svg)
[![npm](https://img.shields.io/npm/v/react-native-drag-sort.svg?style=flat)](https://npmjs.com/package/react-native-drag-sort)
### Performance
### Installation
```bash
yarn add react-native-drag-sort
or
npm i react-native-drag-sort --save
```
### Example
- [ScrollView](https://github.com/mochixuan/react-native-drag-sort/blob/master/Example/app/container/ScrollPage.js)
- [View](https://github.com/mochixuan/react-native-drag-sort/blob/master/Example/app/container/NonScrollPage.js)
- [Fixed Rows](https://github.com/mochixuan/react-native-drag-sort/blob/master/Example/app/container/FixedRowsPage.js)
``` react
<DragSortableView
dataSource={this.state.data}
parentWidth={parentWidth}
childrenWidth= {childrenWidth}
childrenHeight={childrenHeight}
marginChildrenTop={marginChildrenTop}
onDataChange = {(data)=>{
// delete or add data to refresh
if (data.length != this.state.data.length) {
this.setState({
data: data
})
}
}}
onClickItem={(data,item,index)=>{}}
renderItem={(item,index)=>{
return this.renderItem(item,index)
}}/>
```
### API
- **dataSource**: PropTypes.array.isRequired :
- **parentWidth**: PropTypes.number //parent width
- **childrenHeight**: PropTypes.number.isRequired, //Each item height
- **childrenWidth**: PropTypes.number.isRequired,//Each item width
- **marginChildrenTop**: PropTypes.number, //So the item's outermost view adds margin, you can only use this method.
- **marginChildrenBottom**: PropTypes.number,
- **marginChildrenLeft** : PropTypes.number,
- **marginChildrenRight** : PropTypes.number,
- **sortable**: PropTypes.bool, //Do not allow dragging
- **onClickItem**: PropTypes.func, //click
- **onDragStart**: PropTypes.func,
- **onDragEnd** : PropTypes.func,
- **onDataChange** : PropTypes.func, //This method is called every time the data changes.
- **renderItem** : PropTypes.func.isRequired, //render item view

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc