All Projects → mohebifar → React Native Easy Dnd

mohebifar / React Native Easy Dnd

Licence: mit
Drag and drop with react-native made simple

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Native Easy Dnd

React Flow Chart
A flexible, stateless, declarative flow chart library for react.
Stars: ✭ 1,051 (+994.79%)
Mutual labels:  drag-and-drop
Vue Smooth Dnd
Vue wrapper components for smooth-dnd
Stars: ✭ 1,121 (+1067.71%)
Mutual labels:  drag-and-drop
React Workspaces
The ultimate react workspace and panel management system.
Stars: ✭ 90 (-6.25%)
Mutual labels:  drag-and-drop
Vuetify Draggable Treeview
Vuetify draggable v-treeview component
Stars: ✭ 51 (-46.87%)
Mutual labels:  drag-and-drop
React Dropzone
Simple HTML5 drag-drop zone with React.js.
Stars: ✭ 8,639 (+8898.96%)
Mutual labels:  drag-and-drop
Wyg
A new WYSIWYG editing experience for the modern web
Stars: ✭ 73 (-23.96%)
Mutual labels:  drag-and-drop
Filepond Boilerplate Php
🔥 A FilePond PHP project starter kit
Stars: ✭ 45 (-53.12%)
Mutual labels:  drag-and-drop
Vue Drag And Drop Kanban
A simple kanban board where the items can be dragged and dropped from the list. This is a hybrid implementation of vue-smooth-dnd.
Stars: ✭ 93 (-3.12%)
Mutual labels:  drag-and-drop
Angular Filepond
🔌 A handy FilePond adapter component for Angular
Stars: ✭ 59 (-38.54%)
Mutual labels:  drag-and-drop
Ennui
An Elegant Neural Network User Interface to build drag-and-drop neural networks, train in the browser, visualize during training, and export to Python.
Stars: ✭ 90 (-6.25%)
Mutual labels:  drag-and-drop
React Movable
🔀 Drag and drop for your React lists and tables. Accessible. Tiny.
Stars: ✭ 1,064 (+1008.33%)
Mutual labels:  drag-and-drop
Dragtodismiss Pangesture
仿微信,微博的大图查看和视频播放 拖拽消失的手势动画。手势单独已抽离出来,可用于任何视图。Simulate Wechat's disappeared gesture animation by dragging when the big picture viewing or video playback . Gestures are separated and can be used in any view
Stars: ✭ 55 (-42.71%)
Mutual labels:  drag-and-drop
Mosaic
A tiling web browser.
Stars: ✭ 74 (-22.92%)
Mutual labels:  drag-and-drop
Flowy
The minimal javascript library to create flowcharts ✨
Stars: ✭ 8,636 (+8895.83%)
Mutual labels:  drag-and-drop
Yii2 Gallery Manager
Stars: ✭ 90 (-6.25%)
Mutual labels:  drag-and-drop
Angular Draggable Mat Tree
Example implementation of drag and drop on Angular Material Tree
Stars: ✭ 47 (-51.04%)
Mutual labels:  drag-and-drop
Web Editor
Web可视化组态编辑器(Angular8)
Stars: ✭ 67 (-30.21%)
Mutual labels:  drag-and-drop
Jquery Sortablejs
A jQuery binding for SortableJS
Stars: ✭ 94 (-2.08%)
Mutual labels:  drag-and-drop
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-4.17%)
Mutual labels:  drag-and-drop
Calenstyle
Responsive Drag-&-Drop Event Calendar Library for Web, Mobile Sites, Android, iOS & Windows Phone
Stars: ✭ 83 (-13.54%)
Mutual labels:  drag-and-drop

Build Status NPM Version MIT license

React native easy DnD Demo

Installation

npm install --save react-native-easy-dnd

# or using yarn

yarn add react-native-easy-dnd

Usage

First, you need to import createDndContext. This function creates the context for storing the data for the draggable and droppable child components.

import { createDndContext } from "react-native-easy-dnd";

const { Provider, Droppable, Draggable } = createDndContext();

Provider

Wrap the part of your application that you want to enable drag and drop for inside Provider.

<Provider>
   <View>
      {/*  */}
   </View>
</Provider>

Draggable

Add a Draggable component with a function as a child. The element that you want to make draggable needs to be Animated.View whose props must extend viewProps passed in by the render prop function.

import {Animated} from 'react-native';

// ...
<Draggable
  onDragStart={() => {
    console.log('Started draggging');
  }}
  onDragEnd={() => {
    console.log('Ended draggging');
  }}
  payload="my-draggable-item"
>
  {({ viewProps }) => {
    return (
      <Animated.View
        {...viewProps}
        style={[viewProps.style, { width: 200, height: 200, backgroundColor: "red" }]}
      >
        <Text style={{ color: "#fff", fontWeight: "bold" }}>
          Drag me
        </Text>
      </Animated.View>
    );
  }}
</Draggable>

Props

Prop Type Description
onDragStart Function Callback that is triggerd when user starts dragging the draggable element
onDragStart Function Callback that is triggerd when user ends dragging the draggable element
payload any An arbitrary value (often) unique to this draggable that can later be used to determine which draggable item was dropped onto a droppable

Droppable

Add a Droppable component with a function as a child. Similarly, the element that you want to make droppable needs to be Animated.View whose props must extend viewProps passed in by the render prop function.

import {Animated} from 'react-native';

// ...

<Droppable
  onEnter={() => {
    console.log('Draggable entered');
  }}
  onLeave={() => {
    console.log('Draggable left');
  }}
  onDrop={({ payload }) => {
    console.log('Draggable with the following payload was dropped', payload);
  }}
>
  {({ active, viewProps }) => {
    return (
      <Animated.View
        {...viewProps}
        style={[
          {
            width: 300,
            height: 200,
            backgroundColor: active
              ? "blue"
              : "green"
          },
          viewProps.style,
        ]}
      >
        <Text style={{ fontWeight: "bold", color: "white" }}>Drop here</Text>
      </Animated.View>
    );
  }}
</Droppable>

Props

Prop Type Description
onEnter Function Callback that is triggerd when a draggable enters the droppable area
onLeave Function Callback that is triggerd when a draggable leaves the droppable area
onDrop Function Callback that is triggerd when a draggable is dropped onto the droppable area

Fun Fact!

I wrote most of the code on a flight from Toronto to St. John's in March 2019. ✈

License

Licensed under the MIT License, Copyright © 2019 Mohamad Mohebifar.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].