MCPcopy Create free account
hub / github.com/react-dnd/react-dnd / DragDropContext

Function DragDropContext

packages/react-dnd/src/DragDropContext.js:30–78  ·  view source on GitHub ↗
(backendOrModule)

Source from the content-addressed store, hash-verified

28};
29
30export default function DragDropContext(backendOrModule) {
31 checkDecoratorArguments('DragDropContext', 'backend', ...arguments); // eslint-disable-line prefer-rest-params
32
33 const backend = unpackBackendForEs5Users(backendOrModule);
34 const childContext = createChildContext(backend);
35
36 return function decorateContext(DecoratedComponent) {
37 const displayName =
38 DecoratedComponent.displayName ||
39 DecoratedComponent.name ||
40 'Component';
41
42 class DragDropContextContainer extends Component {
43 static DecoratedComponent = DecoratedComponent;
44
45 static displayName = `DragDropContext(${displayName})`;
46
47 static childContextTypes = CHILD_CONTEXT_TYPES;
48
49 getDecoratedComponentInstance() {
50 invariant(
51 this.child,
52 'In order to access an instance of the decorated component it can ' +
53 'not be a stateless component.',
54 );
55 return this.child;
56 }
57
58 getManager() {
59 return childContext.dragDropManager;
60 }
61
62 getChildContext() {
63 return childContext;
64 }
65
66 render() {
67 return (
68 <DecoratedComponent
69 {...this.props}
70 ref={child => (this.child = child)}
71 />
72 );
73 }
74 }
75
76 return hoistStatics(DragDropContextContainer, DecoratedComponent);
77 };
78}

Callers 14

Container.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90
Board.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90
Container.jsFile · 0.90

Calls 3

checkDecoratorArgumentsFunction · 0.85
unpackBackendForEs5UsersFunction · 0.85
createChildContextFunction · 0.85

Tested by

no test coverage detected