Skip to content

[bug] ReactSortable MultiDrag/Swap is not a constructor #143

Open
@sriramgroot

Description

@sriramgroot

Describe the bug
Once i install react-sortablejs node module with react app and then proceed with dependency works, I had caught with below mentioned issue

To Reproduce
Steps to reproduce the behavior:

  1. Run npm i react-sortablejs
  2. Run you react app with npm run start
  3. After importing the required dependencies
  4. See error "Uncaught TypeError: _reactSortablejs.MultiDrag is not a constructor" in your console

Expected behavior
Once i import the dependencies for react-sortablejs in a class component it should be working as expected

Information
Below i attached the code block for your reference

import section

import { ReactSortable, Sortable, MultiDrag, Swap } from "react-sortablejs";

After import dependency, but before starting class component

Sortable.mount(new MultiDrag(), new Swap());

Within render method

<ReactSortable
multiDrag // enables mutidrag
// OR
swap // enables swap
>
{qrFormat.map((item, index) => (
<div key={index}>{item}</div>
))}
</ReactSortable>

Browser Information
browser = Chrome Version 81.0.4044.113 (Official Build) (64-bit) / Firefox Version 75.0 (64-bit)

Versions - Look in your package.json for this information:
react-sortable = 2.0.11
react = ^16.10.2

Additional context
This was the first i tried using react-sortablejs and it is throwing me these type of errors

Screenshot from browser console
Screenshot 2020-04-23 at 3 42 53 PM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions