Skip to content

Commit bcb9b47

Browse files
author
rt2zz
committed
add tapToClose prop
1 parent ed1cba1 commit bcb9b47

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var drawer = React.createClass({
3333
acceptDoubleTap: React.PropTypes.bool,
3434
acceptTap: React.PropTypes.bool,
3535
acceptPan: React.PropTypes.bool,
36+
tapToClose: React.PropTypes.bool,
3637
styles: React.PropTypes.object,
3738
onOpen: React.PropTypes.func,
3839
onClose: React.PropTypes.func,
@@ -58,6 +59,7 @@ var drawer = React.createClass({
5859
acceptDoubleTap: false,
5960
acceptTap: false,
6061
acceptPan: true,
62+
tapToClose: false,
6163
styles: {},
6264
onOpen: () => {},
6365
onClose: () => {},
@@ -261,10 +263,9 @@ var drawer = React.createClass({
261263
},
262264

263265
processTapGestures () {
264-
if(this.props.acceptTap){
265-
this._open ? this.close() : this.open()
266-
}
267-
else if(this.props.acceptDoubleTap){
266+
if (this.props.acceptTap) this._open ? this.close() : this.open()
267+
if (this.props.tapToClose && this._open) this.close()
268+
if (this.props.acceptDoubleTap) {
268269
var now = new Date().getTime()
269270
if(now - this._lastPress < 500){
270271
this._open ? this.close() : this.open()

0 commit comments

Comments
 (0)