@@ -55,6 +55,7 @@ type Props = ViewProps & {
55
55
close : TransitionSpec ;
56
56
} ;
57
57
styleInterpolator : StackCardStyleInterpolator ;
58
+ gestureVelocityImpact : number ;
58
59
containerStyle ?: StyleProp < ViewStyle > ;
59
60
contentStyle ?: StyleProp < ViewStyle > ;
60
61
} ;
@@ -88,7 +89,7 @@ const MINUS_ONE_NODE = UNSET_NODE;
88
89
const DIRECTION_VERTICAL = - 1 ;
89
90
const DIRECTION_HORIZONTAL = 1 ;
90
91
91
- const SWIPE_VELOCITY_IMPACT = 0.3 ;
92
+ const GESTURE_VELOCITY_IMPACT = 0.3 ;
92
93
93
94
/**
94
95
* The distance of touch start from the edge of the screen where the gesture will be recognized
@@ -230,10 +231,16 @@ export default class Card extends React.Component<Props> {
230
231
overlayEnabled : Platform . OS !== 'ios' ,
231
232
shadowEnabled : true ,
232
233
gestureEnabled : true ,
234
+ gestureVelocityImpact : GESTURE_VELOCITY_IMPACT ,
233
235
} ;
234
236
235
237
componentDidUpdate ( prevProps : Props ) {
236
- const { layout, gestureDirection, closing } = this . props ;
238
+ const {
239
+ layout,
240
+ gestureDirection,
241
+ closing,
242
+ gestureVelocityImpact,
243
+ } = this . props ;
237
244
const { width, height } = layout ;
238
245
239
246
if ( width !== prevProps . layout . width ) {
@@ -244,6 +251,10 @@ export default class Card extends React.Component<Props> {
244
251
this . layout . height . setValue ( height ) ;
245
252
}
246
253
254
+ if ( gestureVelocityImpact !== prevProps . gestureVelocityImpact ) {
255
+ this . gestureVelocityImpact . setValue ( gestureVelocityImpact ) ;
256
+ }
257
+
247
258
if ( gestureDirection !== prevProps . gestureDirection ) {
248
259
this . direction . setValue (
249
260
gestureDirection === 'vertical'
@@ -279,6 +290,9 @@ export default class Card extends React.Component<Props> {
279
290
}
280
291
281
292
private isVisible = new Value < Binary > ( TRUE ) ;
293
+ private gestureVelocityImpact = new Value < number > (
294
+ this . props . gestureVelocityImpact
295
+ ) ;
282
296
private isVisibleValue : Binary = TRUE ;
283
297
private nextIsVisible = new Value < Binary | - 1 > ( UNSET ) ;
284
298
@@ -474,7 +488,7 @@ export default class Card extends React.Component<Props> {
474
488
475
489
private extrapolatedPosition = add (
476
490
this . gesture ,
477
- multiply ( this . velocity , SWIPE_VELOCITY_IMPACT )
491
+ multiply ( this . velocity , this . gestureVelocityImpact )
478
492
) ;
479
493
480
494
private exec = [
0 commit comments