1.0.6 • Published 5 years ago

react-native-dragsortable v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

react-native-dragsortable

Drag and drop sort control for react-native

GitHub license npm

Performance

Installation

yarn add react-native-dragsortable
or
npm i react-native-dragsortable --save 

Example

import DragSortableView from 'DragSortableView';
this.state = {
	list:[]
}

const { list } = this.state;
<DragSortableView
	columnCount={4}
    onStartMove={() => {
		console.log("onStartMove");
	}}
	onDragStart={() => {
		console.log("onDragStart")
	}}
	onEndDrag={(items) => {
		console.log("onEndDrag", items)
		this.setState({
			list: items
		});
	}}
	renderItem={(item) => {
		// return item component
	}}
	data={list} />

API

  • data: PropTypes.array.isRequired :
  • maxSize: PropTypes.number.isRequired //item width/height
  • columnCount: PropTypes.number.isRequired, //default row item count,if the totalWidth/columnCount(totalWidth=Dimensions.get('window').width) larger than maxSize,this columnCount value will be Math.floor(totalWidth/maxSize)
  • sortable: PropTypes.bool, //default allow
  • onStartMove: PropTypes.func, //click
  • onDragStart: PropTypes.func,
  • onDragEnd : PropTypes.func,
  • renderItem : PropTypes.func.isRequired, //render item view

Thanks

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago