From 0d49586013577155d4730d8ce13a5d19dbeadf4f Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Fri, 15 Sep 2017 09:54:30 +1000 Subject: [PATCH] add DragDropContextProvider --- types/react-dnd/index.d.ts | 8 +++++ ...react-dnd-tests.ts => react-dnd-tests.tsx} | 33 ++++++++++++++----- types/react-dnd/tsconfig.json | 5 +-- 3 files changed, 35 insertions(+), 11 deletions(-) rename types/react-dnd/{react-dnd-tests.ts => react-dnd-tests.tsx} (92%) diff --git a/types/react-dnd/index.d.ts b/types/react-dnd/index.d.ts index 13402d440f..fe7d3c18f8 100644 --- a/types/react-dnd/index.d.ts +++ b/types/react-dnd/index.d.ts @@ -52,6 +52,14 @@ declare module __ReactDnd { backend: Backend ):

(componentClass: React.ComponentClass

| React.StatelessComponent

) => ContextComponentClass

; + interface DragDropContextProviderProps { + backend: Backend, + window?: Window, + } + + export class DragDropContextProvider extends React.Component { + } + export function DragLayer

( collect: DragLayerCollector, options?: DndOptions

diff --git a/types/react-dnd/react-dnd-tests.ts b/types/react-dnd/react-dnd-tests.tsx similarity index 92% rename from types/react-dnd/react-dnd-tests.ts rename to types/react-dnd/react-dnd-tests.tsx index 127f4c9904..929d64b1f5 100644 --- a/types/react-dnd/react-dnd-tests.ts +++ b/types/react-dnd/react-dnd-tests.tsx @@ -10,17 +10,18 @@ import DragSource = ReactDnd.DragSource; import DropTarget = ReactDnd.DropTarget; import DragLayer = ReactDnd.DragLayer; import DragDropContext = ReactDnd.DragDropContext; +import DragDropContextProvider = ReactDnd.DragDropContextProvider; import HTML5Backend, { getEmptyImage, NativeTypes } from "react-dnd-html5-backend"; declare class TestBackend { - setup(): void; - teardown(): void; - connectDragSource(): void; - connectDropTarget(): void; - simulateBeginDrag(sourceIds: __ReactDnd.Identifier[], options?: {}): void; - simulatePublishDragSource(): void; - simulateHover(targetIds: __ReactDnd.Identifier[], options?: {}): void; - simulateDrop(): void; - simulateEndDrag(): void; + setup(): void; + teardown(): void; + connectDragSource(): void; + connectDropTarget(): void; + simulateBeginDrag(sourceIds: __ReactDnd.Identifier[], options?: {}): void; + simulatePublishDragSource(): void; + simulateHover(targetIds: __ReactDnd.Identifier[], options?: {}): void; + simulateDrop(): void; + simulateEndDrag(): void; } // Game Component @@ -307,3 +308,17 @@ Board.createWithHTMLBackend({ Board.createWithTestBackend({ knightPosition: [0, 0] }); + + +// DragAndDropContextProvider +// ---------------------------------------------------------------------- + +export default class YourApp { + render() { + return ( + + /* ... */ + + ); + }; +} diff --git a/types/react-dnd/tsconfig.json b/types/react-dnd/tsconfig.json index 835b3264e5..43dc8dc5f1 100644 --- a/types/react-dnd/tsconfig.json +++ b/types/react-dnd/tsconfig.json @@ -9,6 +9,7 @@ "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", + "jsx": "react", "typeRoots": [ "../" ], @@ -18,6 +19,6 @@ }, "files": [ "index.d.ts", - "react-dnd-tests.ts" + "react-dnd-tests.tsx" ] -} \ No newline at end of file +}