@@ -3,21 +3,21 @@ import React, {PureComponent} from 'react';
33import { Animated , LayoutChangeEvent , StyleProp , ViewStyle } from 'react-native' ;
44import { Constants } from '../../helpers' ;
55import asPanViewConsumer from './asPanViewConsumer' ;
6- import PanningProvider , { PanningDirections , PanAmountsProps , PanDirectionsProps } from './panningProvider' ;
6+ import PanningProvider , { PanningDirections , PanningProviderDirection , PanAmountsProps , PanDirectionsProps } from './panningProvider' ;
77
88export interface DismissibleAnimationPropTypes {
99 /**
1010 * The return animation speed (default is 20)
1111 */
12- speed : number ;
12+ speed ? : number ;
1313 /**
1414 * The return animation bounciness (default is 6)
1515 */
16- bounciness : number ;
16+ bounciness ? : number ;
1717 /**
1818 * The dismiss animation duration (default is 280)
1919 */
20- duration : number ;
20+ duration ? : number ;
2121}
2222
2323export interface PanDismissibleViewPropTypes {
@@ -29,7 +29,7 @@ export interface PanDismissibleViewPropTypes {
2929 * The directions of the allowed pan (default allows all directions)
3030 * Types: UP, DOWN, LEFT and RIGHT (using PanningProvider.Directions.###)
3131 */
32- directions ?: PanningDirections [ ] ;
32+ directions ?: PanningDirections [ ] | PanningProviderDirection [ ] ;
3333 /**
3434 * onDismiss callback
3535 */
@@ -40,7 +40,7 @@ export interface PanDismissibleViewPropTypes {
4040 * bounciness - the animation bounciness (default is 6)
4141 * duration - the dismiss animation duration (default is 280)
4242 */
43- animationOptions : DismissibleAnimationPropTypes ;
43+ animationOptions ? : DismissibleAnimationPropTypes ;
4444 /**
4545 * Override the default threshold (height/2 and width/2) with different values.
4646 */
@@ -224,7 +224,8 @@ class PanDismissibleView extends PureComponent<Props, State> {
224224 } ;
225225
226226 resetPosition = ( ) => {
227- const { speed, bounciness} = this . props . animationOptions ;
227+ const { animationOptions} = this . props ;
228+ const { speed, bounciness} = animationOptions || DEFAULT_ANIMATION_OPTIONS ;
228229 const toX = - this . left ;
229230 const toY = - this . top ;
230231 const animations : Animated . CompositeAnimation [ ] = [ ] ;
@@ -333,7 +334,8 @@ class PanDismissibleView extends PureComponent<Props, State> {
333334 } ;
334335
335336 _animateDismiss = ( isRight ?: boolean , isDown ?: boolean ) => {
336- const { duration} = this . props . animationOptions ;
337+ const { animationOptions} = this . props ;
338+ const { duration} = animationOptions || DEFAULT_ANIMATION_OPTIONS ;
337339 const animations : Animated . CompositeAnimation [ ] = [ ] ;
338340 let toX ;
339341 let toY ;
0 commit comments