Skip to content

Commit 1750d19

Browse files
author
Magalie Caouette
committed
From github nonmerged PR : root-two#239
1 parent 19a917e commit 1750d19

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ This module supports a wide range of drawer styles, and hence has *a lot* of pro
112112
- `panThreshold` (Number) `.25` - Ratio of screen width that must be travelled to trigger a drawer open/close.
113113
- `panOpenMask` (Number) `null` - Ratio of screen width that is valid for the start of a pan open action. If null -> defaults to `max(.05, closedDrawerOffset)`.
114114
- `panCloseMask` (Number) `null` - Ratio of screen width that is valid for the start of a pan close action. If null -> defaults to `max(.05, openDrawerOffset)`.
115+
- `gestureMarginTop` (Number) `0` - Sets the height in dp of top part of the screen where drawer won't capture pan gestures. For example when you have menu button in the top-left corner, you want your gestures to trigger that button, and not the drawer.
115116
- `initializeOpen` (Boolean) `false` - Initialize with drawer open?
116117
- `side` (String left|right|top|bottom) `left` - which side the drawer should be on.
117118
- `useInteractionManager` (Boolean) `false` - if true will run InteractionManager for open/close animations.

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default class Drawer extends Component {
6565
tweenHandler: PropTypes.func,
6666
type: PropTypes.oneOf(['overlay', 'static', 'displace']),
6767
useInteractionManager: PropTypes.bool,
68+
gestureMarginTop: PropTypes.number,
6869

6970
// deprecated
7071
panStartCompensation: PropTypes.bool,
@@ -81,6 +82,7 @@ export default class Drawer extends Component {
8182
panThreshold: 0.25, // @TODO consider rename to panThreshold
8283
panOpenMask: null, // defaults to closedDrawerOffset
8384
panCloseMask: null, // defaults to openDrawerOffset
85+
gestureMarginTop: 0,
8486

8587
tweenHandler: null,
8688
tweenDuration: 250,
@@ -357,6 +359,7 @@ export default class Drawer extends Component {
357359

358360
// Disable if parent or child drawer exist and are open
359361
// @TODO make cleaner, generalize to work with 3+ drawers, prop to disable/configure
362+
if ( e.nativeEvent.pageY < this.props.gestureMarginTop ) return false
360363
if (this.context.drawer && this.context.drawer._open) return false
361364
if (this._childDrawer && this._childDrawer._open) return false
362365

0 commit comments

Comments
 (0)