0.0.4 • Published 3 years ago

@kkyjh/react-native-drag-sort v0.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@kkyjh Fork Version

react-native-drag-sort

Drag and drop sort control for react-native

GitHub license npm

Version Iteration

Installation

yarn add react-native-drag-sort
or
npm i react-native-drag-sort --save

export { DragSortableView, AutoDragSortableView }

Performance(GIF)

AutomaticSlidingOnePageAutomaticSlidingThreePage
npm.ionpm.io
ScrollFixedAddPageDragDeletePage
npm.iodragdelete.gif
SortAndFixedPageOneRowsPage
ezgif.com-resize.gifone-line.gif

API

AutoDragSortableView、DragSortableView

isRequired if there is a * in the name field

nameProptypesDescription
dataSource *array
parentWidthnumberparent width
parentMarginTopnumberparent margin Top
parentMarginBottomnumberparent margin Bottom
parentMarginLeftnumberparent margin left
parentMarginRightnumberparent margin right
childrenHeight *numberEach item height
childrenWidth *numberEach item width
marginChildrenTopnumberSo the item's outermost view adds margin, you can only use this method.
marginChildrenBottomnumber
marginChildrenLeftnumber
marginChildrenRightnumber
sortableboolDo not allow dragging
onClickItemfuncclick
onDragStartfunc
onDragEndfunc
onDataChangefuncThis method is called every time the data changes.
renderItem *funcrender item view
renderSubItemfuncrender sub item view
fixedItemsarrayno remove
keyExtractorfunc(item,index) => key
delayLongPressnumber
isDragFreelyboolWhether to limit the drag space
onDraggingfunc
maxScalenumber
minOpacitynumber

The following attributes belong only to AutoDragSortableView

nameProptypesDescription
scaleDurationnumber
slideDurationnumber
autoThrottlenumber
autoThrottleDurationnumber
renderHeaderViewelement
headerViewHeightnumber
scrollIndicatorInsets({top:number, left:number, bottom:number, right:number})
renderBottomViewelement
bottomViewHeightnumber
onScrollListener(event: NativeSyntheticEvent) => void
onScrollRef(ref: any) => void

Example

<DragSortableView
    dataSource={this.state.data}
    parentWidth={parentWidth}
    childrenWidth= {childrenWidth}
    childrenHeight={childrenHeight}
    keyExtractor={(item,index)=> item.id}
    renderItem={(item,index)=>{
        return this.renderItem(item,index)
    }}
/>

<AutoDragSortableView
    dataSource={this.state.data}
    parentWidth={parentWidth}
    childrenWidth= {childrenWidth}
    childrenHeight={childrenHeight}
    keyExtractor={(item,index)=> item.id}
    renderItem={(item,index)=>{
        return this.renderItem(item,index)
    }}
/>