@@ -3,21 +3,21 @@ import React, {PureComponent} from 'react';
3
3
import { Animated , LayoutChangeEvent , StyleProp , ViewStyle } from 'react-native' ;
4
4
import { Constants } from '../../helpers' ;
5
5
import asPanViewConsumer from './asPanViewConsumer' ;
6
- import PanningProvider , { PanningDirections , PanAmountsProps , PanDirectionsProps } from './panningProvider' ;
6
+ import PanningProvider , { PanningDirections , PanningProviderDirection , PanAmountsProps , PanDirectionsProps } from './panningProvider' ;
7
7
8
8
export interface DismissibleAnimationPropTypes {
9
9
/**
10
10
* The return animation speed (default is 20)
11
11
*/
12
- speed : number ;
12
+ speed ? : number ;
13
13
/**
14
14
* The return animation bounciness (default is 6)
15
15
*/
16
- bounciness : number ;
16
+ bounciness ? : number ;
17
17
/**
18
18
* The dismiss animation duration (default is 280)
19
19
*/
20
- duration : number ;
20
+ duration ? : number ;
21
21
}
22
22
23
23
export interface PanDismissibleViewPropTypes {
@@ -29,7 +29,7 @@ export interface PanDismissibleViewPropTypes {
29
29
* The directions of the allowed pan (default allows all directions)
30
30
* Types: UP, DOWN, LEFT and RIGHT (using PanningProvider.Directions.###)
31
31
*/
32
- directions ?: PanningDirections [ ] ;
32
+ directions ?: PanningDirections [ ] | PanningProviderDirection [ ] ;
33
33
/**
34
34
* onDismiss callback
35
35
*/
@@ -40,7 +40,7 @@ export interface PanDismissibleViewPropTypes {
40
40
* bounciness - the animation bounciness (default is 6)
41
41
* duration - the dismiss animation duration (default is 280)
42
42
*/
43
- animationOptions : DismissibleAnimationPropTypes ;
43
+ animationOptions ? : DismissibleAnimationPropTypes ;
44
44
/**
45
45
* Override the default threshold (height/2 and width/2) with different values.
46
46
*/
@@ -224,7 +224,8 @@ class PanDismissibleView extends PureComponent<Props, State> {
224
224
} ;
225
225
226
226
resetPosition = ( ) => {
227
- const { speed, bounciness} = this . props . animationOptions ;
227
+ const { animationOptions} = this . props ;
228
+ const { speed, bounciness} = animationOptions || DEFAULT_ANIMATION_OPTIONS ;
228
229
const toX = - this . left ;
229
230
const toY = - this . top ;
230
231
const animations : Animated . CompositeAnimation [ ] = [ ] ;
@@ -333,7 +334,8 @@ class PanDismissibleView extends PureComponent<Props, State> {
333
334
} ;
334
335
335
336
_animateDismiss = ( isRight ?: boolean , isDown ?: boolean ) => {
336
- const { duration} = this . props . animationOptions ;
337
+ const { animationOptions} = this . props ;
338
+ const { duration} = animationOptions || DEFAULT_ANIMATION_OPTIONS ;
337
339
const animations : Animated . CompositeAnimation [ ] = [ ] ;
338
340
let toX ;
339
341
let toY ;
0 commit comments