Update react-dnd-multi-backend to version 4.0 (#38736)

* Update to version 4.0

* Update backends type+add dependency
This commit is contained in:
Nathan Shively-Sanders 2019-10-01 08:22:13 -07:00 committed by GitHub
parent a21d984ca4
commit 16ec9170ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for react-dnd-multi-backend 3.0
// Type definitions for react-dnd-multi-backend 4.0
// Project: https://github.com/LouisBrunner/react-dnd-multi-backend, https://louisbrunner.github.io/dnd-multi-backend/packages/react-dnd-multi-backend
// Definitions by: Janeene Beeforth <https://github.com/dawnmist>
// Adam Haglund <https://github.com/beeequeue>
@ -53,6 +53,10 @@ export interface BackendDeclaration {
* Backend - e.g. the one provided by react-dnd-html5-backend.
*/
backend: BackendFactory;
/**
* Parameters to the backend
*/
options?: object;
/**
* Flag to indicate that this backend needs to have a custom preview generated. This is mainly
* used for backends such as the react-dnd-touch-backend, where there is no default preview

View File

@ -1,6 +1,7 @@
{
"private": true,
"dependencies": {
"dnd-core": "^4.0.5"
"dnd-core": "^9.3.1",
"react-dnd-touch-backend": "^9.3.1"
}
}

View File

@ -9,7 +9,7 @@ const context = {};
/**
* Most common use case - using the default HTML5 with Touch as a fallback.
*/
const multiDndComponent = createDragDropManager(MultiBackend(HTML5ToTouch), context);
const multiDndComponent = createDragDropManager(MultiBackend(HTML5ToTouch), context, {});
/**
* Creating a custom list of backends, including creating a touch transition.
@ -17,18 +17,19 @@ const multiDndComponent = createDragDropManager(MultiBackend(HTML5ToTouch), cont
const CustomBackends: Backends = {
backends: [
{
backend: TouchBackend({ enableMouseEvents: false }),
backend: TouchBackend,
options: { enableMouseEvents: false },
preview: true,
transition: createTransition('touchstart', (event: TouchEvent) => {
return event.touches != null;
})
},
{
backend: TouchBackend({}),
backend: TouchBackend,
transition: TouchTransition
}]
};
const multiCustomBackendsComponent = createDragDropManager(MultiBackend(CustomBackends), context);
const multiCustomBackendsComponent = createDragDropManager(MultiBackend(CustomBackends), context, {});
/**
* Testing the Preview component.