@@ -55,6 +55,7 @@ type Props = ViewProps & {
5555 close : TransitionSpec ;
5656 } ;
5757 styleInterpolator : StackCardStyleInterpolator ;
58+ gestureVelocityImpact : number ;
5859 containerStyle ?: StyleProp < ViewStyle > ;
5960 contentStyle ?: StyleProp < ViewStyle > ;
6061} ;
@@ -88,7 +89,7 @@ const MINUS_ONE_NODE = UNSET_NODE;
8889const DIRECTION_VERTICAL = - 1 ;
8990const DIRECTION_HORIZONTAL = 1 ;
9091
91- const SWIPE_VELOCITY_IMPACT = 0.3 ;
92+ const GESTURE_VELOCITY_IMPACT = 0.3 ;
9293
9394/**
9495 * 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> {
230231 overlayEnabled : Platform . OS !== 'ios' ,
231232 shadowEnabled : true ,
232233 gestureEnabled : true ,
234+ gestureVelocityImpact : GESTURE_VELOCITY_IMPACT ,
233235 } ;
234236
235237 componentDidUpdate ( prevProps : Props ) {
236- const { layout, gestureDirection, closing } = this . props ;
238+ const {
239+ layout,
240+ gestureDirection,
241+ closing,
242+ gestureVelocityImpact,
243+ } = this . props ;
237244 const { width, height } = layout ;
238245
239246 if ( width !== prevProps . layout . width ) {
@@ -244,6 +251,10 @@ export default class Card extends React.Component<Props> {
244251 this . layout . height . setValue ( height ) ;
245252 }
246253
254+ if ( gestureVelocityImpact !== prevProps . gestureVelocityImpact ) {
255+ this . gestureVelocityImpact . setValue ( gestureVelocityImpact ) ;
256+ }
257+
247258 if ( gestureDirection !== prevProps . gestureDirection ) {
248259 this . direction . setValue (
249260 gestureDirection === 'vertical'
@@ -279,6 +290,9 @@ export default class Card extends React.Component<Props> {
279290 }
280291
281292 private isVisible = new Value < Binary > ( TRUE ) ;
293+ private gestureVelocityImpact = new Value < number > (
294+ this . props . gestureVelocityImpact
295+ ) ;
282296 private isVisibleValue : Binary = TRUE ;
283297 private nextIsVisible = new Value < Binary | - 1 > ( UNSET ) ;
284298
@@ -474,7 +488,7 @@ export default class Card extends React.Component<Props> {
474488
475489 private extrapolatedPosition = add (
476490 this . gesture ,
477- multiply ( this . velocity , SWIPE_VELOCITY_IMPACT )
491+ multiply ( this . velocity , this . gestureVelocityImpact )
478492 ) ;
479493
480494 private exec = [
0 commit comments