Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 4a0755e

Browse files
committed
updating DragDropContext docs
1 parent c8c8660 commit 4a0755e

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

docs/api/drag-drop-context.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ In order to use drag and drop, you need to have the part of your `React` tree th
77
```js
88
type Responders = {|
99
// optional
10+
onBeforeCapture?: OnBeforeCaptureResponder
1011
onBeforeDragStart?: OnBeforeDragStartResponder,
1112
onDragStart?: OnDragStartResponder,
1213
onDragUpdate?: OnDragUpdateResponder,
@@ -30,12 +31,11 @@ type Props = {|
3031
|};
3132
```
3233
33-
- `liftInstruction`: What is read out to screen reader users when a *drag handle* is given browser focus. See our [screen reader guide](/docs/guides/screen-reader.md)
34+
- `liftInstruction`: What is read out to screen reader users when a _drag handle_ is given browser focus. See our [screen reader guide](/docs/guides/screen-reader.md)
3435
- `nonce`: Used for strict content security policy setups. See our [content security policy guide](/docs/guides/content-security-policy.md)
3536
- `sensors`: Used to pass in your own `sensor`s for a `<DragDropContext />`. See our [sensor api documentation](/docs/sensors/sensor-api.md)
3637
- `enableDefaultSensors`: Whether or not the default sensors ([mouse](/docs/sensors/mouse.md), [keyboard](/docs/sensors/keyboard.md), and [touch](/docs/sensors/touch.md)) are enabled. See our [sensor api documentation](/docs/sensors/sensor-api.md)
3738
38-
3939
> See our [type guide](/docs/guides/types.md) for more details
4040
4141
## Basic usage
@@ -47,6 +47,10 @@ import React from 'react';
4747
import { DragDropContext } from 'react-beautiful-dnd';
4848

4949
class App extends React.Component {
50+
onBeforeCapture = () => {
51+
/*...*/
52+
};
53+
5054
onBeforeDragStart = () => {
5155
/*...*/
5256
};
@@ -64,6 +68,7 @@ class App extends React.Component {
6468
render() {
6569
return (
6670
<DragDropContext
71+
onBeforeCapture={this.onBeforeCapture}
6772
onBeforeDragStart={this.onBeforeDragStart}
6873
onDragStart={this.onDragStart}
6974
onDragUpdate={this.onDragUpdate}
@@ -83,10 +88,13 @@ import React from 'react';
8388
import { DragDropContext } from 'react-beautiful-dnd';
8489

8590
function App() {
91+
// using useCallback is optional
92+
const onBeforeCapture = useCallback(() => {
93+
/*...*/
94+
}, []);
8695
const onBeforeDragStart = useCallback(() => {
8796
/*...*/
8897
}, []);
89-
9098
const onDragStart = useCallback(() => {
9199
/*...*/
92100
}, []);
@@ -99,6 +107,7 @@ function App() {
99107

100108
return (
101109
<DragDropContext
110+
onBeforeCapture={onBeforeCapture}
102111
onBeforeDragStart={onBeforeDragStart}
103112
onDragStart={onDragStart}
104113
onDragUpdate={onDragUpdate}

0 commit comments

Comments
 (0)