@@ -243,6 +243,8 @@ export default class DrawerView extends React.PureComponent<Props> {
243
243
244
244
private isStatusBarHidden : boolean = false ;
245
245
246
+ private isSpringManuallyTriggered = new Value < Binary > ( FALSE ) ;
247
+
246
248
private transitionTo = ( isOpen : number | Animated . Node < number > ) => {
247
249
const toValue = new Value ( 0 ) ;
248
250
const frameTime = new Value ( 0 ) ;
@@ -347,6 +349,7 @@ export default class DrawerView extends React.PureComponent<Props> {
347
349
cond (
348
350
eq ( this . gestureState , State . ACTIVE ) ,
349
351
[
352
+ set ( this . isSpringManuallyTriggered , FALSE ) ,
350
353
cond ( this . isSwiping , NOOP , [
351
354
// We weren't dragging before, set it to true
352
355
set ( this . isSwiping , TRUE ) ,
@@ -366,27 +369,31 @@ export default class DrawerView extends React.PureComponent<Props> {
366
369
set ( this . touchX , 0 ) ,
367
370
this . transitionTo (
368
371
cond (
369
- or (
370
- and (
371
- greaterThan ( abs ( this . gestureX ) , SWIPE_DISTANCE_MINIMUM ) ,
372
- greaterThan ( abs ( this . velocityX ) , this . swipeVelocityThreshold )
373
- ) ,
374
- greaterThan ( abs ( this . gestureX ) , this . swipeDistanceThreshold )
375
- ) ,
372
+ this . isSpringManuallyTriggered ,
373
+ this . isOpen ,
376
374
cond (
377
- eq ( this . drawerPosition , DIRECTION_LEFT ) ,
378
- // If swiped to right, open the drawer, otherwise close it
379
- greaterThan (
380
- cond ( eq ( this . velocityX , 0 ) , this . gestureX , this . velocityX ) ,
381
- 0
375
+ or (
376
+ and (
377
+ greaterThan ( abs ( this . gestureX ) , SWIPE_DISTANCE_MINIMUM ) ,
378
+ greaterThan ( abs ( this . velocityX ) , this . swipeVelocityThreshold )
379
+ ) ,
380
+ greaterThan ( abs ( this . gestureX ) , this . swipeDistanceThreshold )
381
+ ) ,
382
+ cond (
383
+ eq ( this . drawerPosition , DIRECTION_LEFT ) ,
384
+ // If swiped to right, open the drawer, otherwise close it
385
+ greaterThan (
386
+ cond ( eq ( this . velocityX , 0 ) , this . gestureX , this . velocityX ) ,
387
+ 0
388
+ ) ,
389
+ // If swiped to left, open the drawer, otherwise close it
390
+ lessThan (
391
+ cond ( eq ( this . velocityX , 0 ) , this . gestureX , this . velocityX ) ,
392
+ 0
393
+ )
382
394
) ,
383
- // If swiped to left, open the drawer, otherwise close it
384
- lessThan (
385
- cond ( eq ( this . velocityX , 0 ) , this . gestureX , this . velocityX ) ,
386
- 0
387
- )
388
- ) ,
389
- this . isOpen
395
+ this . isOpen
396
+ )
390
397
)
391
398
) ,
392
399
]
@@ -441,6 +448,7 @@ export default class DrawerView extends React.PureComponent<Props> {
441
448
442
449
private toggleDrawer = ( open : boolean ) => {
443
450
this . nextIsOpen . setValue ( open ? TRUE : FALSE ) ;
451
+ this . isSpringManuallyTriggered . setValue ( TRUE ) ;
444
452
445
453
// This value will also be set shortly after as changing this.nextIsOpen changes this.isOpen
446
454
// However, there's a race condition on Android, so we need to set a bit earlier
0 commit comments