From 087cbdb2f71679a0d2c5b3a57caa257582d7417c Mon Sep 17 00:00:00 2001 From: Kanitkorn Sujautra Date: Wed, 13 Mar 2019 02:45:51 +0900 Subject: [PATCH] [react-beautiful-dnd] Update type for react-beautiful-dnd 10.1 (#33791) Release note: https://github.com/atlassian/react-beautiful-dnd/releases/tag/v10.1.0 --- types/react-beautiful-dnd/index.d.ts | 5 ++++- .../react-beautiful-dnd/react-beautiful-dnd-tests.tsx | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts index a743ce6f78..926a8f7e9f 100644 --- a/types/react-beautiful-dnd/index.d.ts +++ b/types/react-beautiful-dnd/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-beautiful-dnd 10.0 +// Type definitions for react-beautiful-dnd 10.1 // Project: https://github.com/atlassian/react-beautiful-dnd // Definitions by: varHarrie // Bradley Ayers @@ -6,6 +6,7 @@ // Mark Nelissen // Enrico Boccadifuoco // Taeheon Kim +// Kanitkorn Sujautra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -111,6 +112,7 @@ export interface DroppableProvided { export interface DroppableStateSnapshot { isDraggingOver: boolean; draggingOverWith?: DraggableId; + draggingFromThisWith?: DraggableId; } export interface DroppableProps { @@ -205,6 +207,7 @@ export interface DraggableProps { disableInteractiveElementBlocking?: boolean; children(provided: DraggableProvided, snapshot: DraggableStateSnapshot): React.ReactElement; type?: TypeId; + shouldRespectForceTouch?: boolean; } export class Draggable extends React.Component { } diff --git a/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx b/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx index ceb6757992..c169d8631a 100644 --- a/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx +++ b/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { DragDropContext, Draggable, Droppable, DropResult, DragStart, DragUpdate, ResponderProvided } from 'react-beautiful-dnd'; +import { DragDropContext, Draggable, Droppable, DropResult, DragStart, DragUpdate, ResponderProvided, DroppableStateSnapshot } from 'react-beautiful-dnd'; interface Item { id: string; @@ -30,8 +30,8 @@ const getItemStyle = (isDragging: boolean, draggableStyle: any) => ({ ...draggableStyle }); -const getListStyle = (isDraggingOver: any) => ({ - background: isDraggingOver ? 'lightblue' : 'lightgrey', +const getListStyle = (snapshot: DroppableStateSnapshot) => ({ + background: snapshot.draggingFromThisWith ? 'lightpink' : snapshot.isDraggingOver ? 'lightblue' : 'lightgrey', width: 250 }); @@ -87,9 +87,9 @@ class App extends React.Component<{}, AppState> { {(provided, snapshot) => ( -
+
{this.state.items.map((item, index) => ( - + {(provided, snapshot) => (