@@ -144,7 +144,7 @@ class PanDismissibleView extends PureComponent {
144
144
const { directions} = this . props ;
145
145
if ( this . swipe . x || this . swipe . y ) {
146
146
const { isRight, isDown} = this . getDismissAnimationDirection ( ) ;
147
- this . animateDismiss ( isRight , isDown ) ;
147
+ this . _animateDismiss ( isRight , isDown ) ;
148
148
} else {
149
149
const endValue = { x : Math . round ( this . left ) , y : Math . round ( this . top ) } ;
150
150
if (
@@ -154,7 +154,7 @@ class PanDismissibleView extends PureComponent {
154
154
( directions . includes ( PanningProvider . Directions . DOWN ) && endValue . y >= this . thresholdY )
155
155
) {
156
156
const { isRight, isDown} = this . getDismissAnimationDirection ( ) ;
157
- this . animateDismiss ( isRight , isDown ) ;
157
+ this . _animateDismiss ( isRight , isDown ) ;
158
158
} else {
159
159
this . animateToInitialPosition ( ) ;
160
160
}
@@ -226,7 +226,23 @@ class PanDismissibleView extends PureComponent {
226
226
return { isRight, isDown} ;
227
227
} ;
228
228
229
- animateDismiss = ( isRight , isDown ) => {
229
+ // Send undefined to not animate in the horizontal\vertical direction
230
+ // isRight === true --> animate to the right
231
+ // isRight === false --> animate to the left
232
+ // isDown === true --> animate to the bottom
233
+ // isDown === false --> animate to the top
234
+ animateDismiss = ( ) => {
235
+ const { directions = [ ] } = this . props ;
236
+ const hasUp = directions . includes ( PanningProvider . Directions . UP ) ;
237
+ const hasRight = directions . includes ( PanningProvider . Directions . RIGHT ) ;
238
+ const hasLeft = directions . includes ( PanningProvider . Directions . LEFT ) ;
239
+ const hasDown = ! hasUp && ! hasLeft && ! hasRight ; // default
240
+ const verticalDismiss = hasDown ? true : hasUp ? false : undefined ;
241
+ const horizontalDismiss = hasRight ? true : hasLeft ? false : undefined ;
242
+ this . _animateDismiss ( horizontalDismiss , verticalDismiss ) ;
243
+ } ;
244
+
245
+ _animateDismiss = ( isRight , isDown ) => {
230
246
const { animTranslateX, animTranslateY} = this . state ;
231
247
const { duration} = this . props . animationOptions ;
232
248
const animations = [ ] ;
0 commit comments