Skip to content

Commit

Permalink
chore: add deprecation warning to DragDropContext (#1398)
Browse files Browse the repository at this point in the history
  • Loading branch information
darthtrevino committed Jun 17, 2019
1 parent 2dba35a commit ab41381
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/react-dnd/src/decorators/DragDropContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import invariant from 'invariant'
import hoistStatics from 'hoist-non-react-statics'

/**
* @deprecated Use DnDProvider in your JSX tree instead. This will be removed in a future major version.
*
* Wrap the root component of your application with DragDropContext decorator to set up React DnD.
* This lets you specify the backend, and sets up the shared DnD state behind the scenes.
* @param backendFactory The DnD backend factory
Expand Down Expand Up @@ -38,6 +40,13 @@ export function DragDropContext(
implements ContextComponent<any> {
public static DecoratedComponent = DecoratedComponent
public static displayName = `DragDropContext(${displayName})`
public constructor(props: any, context: any) {
super(props, context)
// eslint-disable-next-line no-console
console.warn(
`DragDropContext has been deprecated and will be removed in a future version. Please use DndProvider instead.`,
)
}

private ref: React.RefObject<any> = React.createRef()

Expand Down

0 comments on commit ab41381

Please sign in to comment.