@@ -77,7 +77,7 @@ type Props = {
7777 onOpen : ( ) => void ;
7878 onClose : ( ) => void ;
7979 onGestureRef ?: ( ref : PanGestureHandler | null ) => void ;
80- locked : boolean ;
80+ gestureEnabled : boolean ;
8181 drawerPosition : 'left' | 'right' ;
8282 drawerType : 'front' | 'back' | 'slide' ;
8383 keyboardDismissMode : 'none' | 'on-drag' ;
@@ -94,9 +94,9 @@ type Props = {
9494 gestureHandlerProps ?: React . ComponentProps < typeof PanGestureHandler > ;
9595} ;
9696
97- export default class DrawerView extends React . PureComponent < Props > {
97+ export default class Drawer extends React . PureComponent < Props > {
9898 static defaultProps = {
99- locked : false ,
99+ gestureEnabled : true ,
100100 drawerPostion : I18nManager . isRTL ? 'left' : 'right' ,
101101 drawerType : 'front' ,
102102 swipeEdgeWidth : 32 ,
@@ -111,16 +111,11 @@ export default class DrawerView extends React.PureComponent<Props> {
111111 open,
112112 drawerPosition,
113113 drawerType,
114- locked,
115114 swipeDistanceThreshold,
116115 swipeVelocityThreshold,
117116 hideStatusBar,
118117 } = this . props ;
119118
120- if ( prevProps . locked !== locked ) {
121- this . isLocked . setValue ( locked ? TRUE : FALSE ) ;
122- }
123-
124119 if (
125120 // If we're not in the middle of a transition, sync the drawer's open state
126121 typeof this . pendingOpenValue !== 'boolean' ||
@@ -167,7 +162,6 @@ export default class DrawerView extends React.PureComponent<Props> {
167162 private isDrawerTypeFront = new Value < Binary > (
168163 this . props . drawerType === 'front' ? TRUE : FALSE
169164 ) ;
170- private isLocked = new Value ( this . props . locked ? TRUE : FALSE ) ;
171165
172166 private isOpen = new Value < Binary > ( this . props . open ? TRUE : FALSE ) ;
173167 private nextIsOpen = new Value < Binary | - 1 > ( UNSET ) ;
@@ -444,10 +438,7 @@ export default class DrawerView extends React.PureComponent<Props> {
444438 {
445439 nativeEvent : {
446440 oldState : ( s : Animated . Value < number > ) =>
447- cond (
448- and ( eq ( s , State . ACTIVE ) , eq ( this . isLocked , FALSE ) ) ,
449- set ( this . manuallyTriggerSpring , TRUE )
450- ) ,
441+ cond ( eq ( s , State . ACTIVE ) , set ( this . manuallyTriggerSpring , TRUE ) ) ,
451442 } ,
452443 } ,
453444 ] ) ;
@@ -462,7 +453,9 @@ export default class DrawerView extends React.PureComponent<Props> {
462453 // Until layout is available, drawer is hidden with opacity: 0 by default
463454 // Show it in the next frame when layout is available
464455 // If we don't delay it until the next frame, there's a visible flicker
465- requestAnimationFrame ( ( ) => this . drawerOpacity . setValue ( 1 ) ) ;
456+ requestAnimationFrame ( ( ) =>
457+ requestAnimationFrame ( ( ) => this . drawerOpacity . setValue ( 1 ) )
458+ ) ;
466459 } ;
467460
468461 private toggleDrawer = ( open : boolean ) => {
@@ -487,7 +480,7 @@ export default class DrawerView extends React.PureComponent<Props> {
487480 render ( ) {
488481 const {
489482 open,
490- locked ,
483+ gestureEnabled ,
491484 drawerPosition,
492485 drawerType,
493486 swipeEdgeWidth,
@@ -529,7 +522,7 @@ export default class DrawerView extends React.PureComponent<Props> {
529522 onGestureEvent = { this . handleGestureEvent }
530523 onHandlerStateChange = { this . handleGestureStateChange }
531524 hitSlop = { hitSlop }
532- enabled = { ! locked }
525+ enabled = { gestureEnabled }
533526 { ...gestureHandlerProps }
534527 >
535528 < Animated . View
@@ -548,6 +541,7 @@ export default class DrawerView extends React.PureComponent<Props> {
548541 >
549542 { renderSceneContent ( { progress : this . progress } ) }
550543 < TapGestureHandler
544+ enabled = { gestureEnabled }
551545 onHandlerStateChange = { this . handleTapStateChange }
552546 >
553547 < Animated . View
0 commit comments