{"id":18280146,"url":"https://github.com/lowesyang/drag-list-react","last_synced_at":"2025-04-09T04:49:38.106Z","repository":{"id":94817567,"uuid":"99411741","full_name":"lowesyang/Drag-list-react","owner":"lowesyang","description":"A component of Drag\u0026Drop,Touch enabled and Reordering list for React","archived":false,"fork":false,"pushed_at":"2018-03-04T14:23:22.000Z","size":83,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T23:27:44.022Z","etag":null,"topics":["drag-and-drop","react","react-component","reordering"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lowesyang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-05T09:04:19.000Z","updated_at":"2022-05-18T13:07:22.000Z","dependencies_parsed_at":"2023-05-17T06:16:18.764Z","dependency_job_id":null,"html_url":"https://github.com/lowesyang/Drag-list-react","commit_stats":null,"previous_names":["lowesyang/drag-list-react"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowesyang%2FDrag-list-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowesyang%2FDrag-list-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowesyang%2FDrag-list-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowesyang%2FDrag-list-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lowesyang","download_url":"https://codeload.github.com/lowesyang/Drag-list-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980820,"owners_count":21027803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drag-and-drop","react","react-component","reordering"],"created_at":"2024-11-05T12:33:23.774Z","updated_at":"2025-04-09T04:49:38.082Z","avatar_url":"https://github.com/lowesyang.png","language":"JavaScript","readme":"# Drag-list-react\n[![npm](https://img.shields.io/badge/npm-v1.0.5-green.svg)](https://www.npmjs.com/package/drag-list-react)\n[![Build Status](https://travis-ci.org/yyh1102/Drag-list-react.svg?branch=master)](https://travis-ci.org/yyh1102/Drag-list-react)\n[![npm](https://img.shields.io/npm/l/express.svg)](https://opensource.org/licenses/mit-license.php)\n\nA HOC component of Drag\u0026Drop,Touch enabled and Reordering list for React.\n\n[demo](https://yyh1102.github.io/react-drag-list/)\n\n## Install\n```bash\nnpm install drag-list-react --save\n```\n\n## Usage\n```javascript\nimport React from 'react';\nimport DragList from 'drag-list-react';\n\n// Notice: Every item in your data list must contains property 'id'.\n// DragList component uses 'id' as the key of array.\nconst list=[\n  {\n    id:1,\n    name:'Item1'\n  },{\n    id:2,\n    name:'Item2'\n  },{\n    id:3,\n    name:'Item3'\n  },{\n    id:4,\n    name:'Item4'\n  }\n]\n\n// list item\n// Each properties in data list will be passed to the children\nconst listItem=({name})=\u003e(\n  \u003cdiv className={styles.nameTag}\u003e{name}\u003c/div\u003e\n)\n\n// Placeholder when dragging items\n// Props is necessary because placeholder will receive style props from component.\nconst Placeholder=(props)=\u003e(\n  \u003cdiv className={styles.placeholder} {...props}\u003e\u003c/div\u003e  \n)\n\nconst App = () =\u003e {\n  // Use placeholder\n  const List = DragList(listItem,Placeholder);\n  // Or not use placeholder\n  // const List = DragList(listItem);\n  return (\n    \u003cList list={list} /\u003e\n  )\n};\n```\n\n## API\nProperties\n\n| name | type | default | description |\n|------|------|---------|-------------|\n| disabled | Boolean | false | Disabled dragging and dropping |\n| type | String |       | Type of drag list.The list will be horizontal when it is set ```inline```.|\n| isLongPress | Boolean | false | Should dragging be triggered by long pressing or not |\n| delay | Number | 300(ms) | The delay time of long pressing |\n| gutter | Number | 0 | The spacing between two items |\n| onDragBegin | Function(item,index,element) | | Prams: ```item``` is the dragging element of your data array; ```index``` is the index of the dragging item in your data array; ```element``` is the real DOM node of your dragging item.\n| onDragEnd | Function(list) | | Param: ```list``` is the final list when dragging ends. |","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flowesyang%2Fdrag-list-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flowesyang%2Fdrag-list-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flowesyang%2Fdrag-list-react/lists"}