Skip to content

Commit

Permalink
From github nonmerged PR : root-two#239
Browse files Browse the repository at this point in the history
  • Loading branch information
Magalie Caouette committed Oct 3, 2017
1 parent 19a917e commit 1750d19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ This module supports a wide range of drawer styles, and hence has *a lot* of pro
- `panThreshold` (Number) `.25` - Ratio of screen width that must be travelled to trigger a drawer open/close.
- `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)`.
- `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)`.
- `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.
- `initializeOpen` (Boolean) `false` - Initialize with drawer open?
- `side` (String left|right|top|bottom) `left` - which side the drawer should be on.
- `useInteractionManager` (Boolean) `false` - if true will run InteractionManager for open/close animations.
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default class Drawer extends Component {
tweenHandler: PropTypes.func,
type: PropTypes.oneOf(['overlay', 'static', 'displace']),
useInteractionManager: PropTypes.bool,
gestureMarginTop: PropTypes.number,

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

tweenHandler: null,
tweenDuration: 250,
Expand Down Expand Up @@ -357,6 +359,7 @@ export default class Drawer extends Component {

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

Expand Down

0 comments on commit 1750d19

Please sign in to comment.