Giter Site home page Giter Site logo

jinxianglin / react-native-drag-sort Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mochixuan/react-native-drag-sort

0.0 0.0 0.0 17.39 MB

🔥🔥🔥Drag and drop sort control for react-native

License: Apache License 2.0

JavaScript 95.66% Java 0.87% Objective-C 2.41% Starlark 1.06%

react-native-drag-sort's Introduction

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)

AutomaticSlidingOnePage AutomaticSlidingThreePage
ScrollFixedAddPage DragDeletePage
dragdelete.gif
SortAndFixedPage OneRowsPage
ezgif.com-resize.gif one-line.gif

API

AutoDragSortableView、DragSortableView
  • 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

  • fixedItems:PropTypes.array //no remove

  • keyExtractor: keyExtractor: PropTypes.func //(item,index) => key

  • delayLongPress: PropTypes.number,

  • isDragFreely: PropTypes.bool, // Whether to limit the drag space

  • onDragging: PropTypes.func

  • maxScale: PropTypes.number;

  • minOpacity: PropTypes.number;

The following attributes belong only to AutoDragSortableView
  • scaleDuration: PropTypes.number;
  • slideDuration: PropTypes.number;
  • autoThrottle: PropTypes.number;
  • autoThrottleDuration: PropTypes.number;
  • renderHeaderView: PropTypes.element,
  • headerViewHeight: PropTypes.number,
  • renderBottomView: PropTypes.element,
  • bottomViewHeight: PropTypes.number,

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)
    }}
/>

react-native-drag-sort's People

Contributors

apgsn avatar fallenner avatar mochixuan avatar sevellion avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.