@@ -262,9 +262,9 @@ interface InteractableProps {
262
262
animatedValueY ?: any ;
263
263
style ?: StyleProp < ViewStyle > ;
264
264
dragEnabled : boolean ;
265
- onSnap : ( e : { nativeEvent : SnapPoint & { index : number } } ) => void ;
266
- onStop : ( e : { nativeEvent : { x : number , y : number } } ) => void ;
267
- onDrag : ( e : { nativeEvent : { x : number , y : number , state : "start" | "end" } } ) => void ;
265
+ onSnap ? : ( e : { nativeEvent : SnapPoint & { index : number } } ) => void ;
266
+ onStop ? : ( e : { nativeEvent : { x : number , y : number } } ) => void ;
267
+ onDrag ? : ( e : { nativeEvent : { x : number , y : number , state : "start" | "end" } } ) => void ;
268
268
initialPosition : Position ;
269
269
dragToss : number ;
270
270
dragWithSpring ?: { tension : number , damping : number } ;
@@ -396,7 +396,10 @@ export default class Interactable extends React.PureComponent<InteractableProps>
396
396
}
397
397
398
398
const handleStartDrag = props . onDrag
399
- && call ( [ target . x , target . y ] , ( [ x , y ] ) => props . onDrag ( { nativeEvent : { x, y, state : "start" } } ) ) ;
399
+ && call (
400
+ [ target . x , target . y ] ,
401
+ ( [ x , y ] ) => props . onDrag && props . onDrag ( { nativeEvent : { x, y, state : "start" } } ) ,
402
+ ) ;
400
403
401
404
const snapBuckets : [ any [ ] , any [ ] , any [ ] ] = [ [ ] , [ ] , [ ] ] ;
402
405
const snapAnchor = {
@@ -480,10 +483,10 @@ export default class Interactable extends React.PureComponent<InteractableProps>
480
483
) ,
481
484
block ( [
482
485
props . onStop
483
- && cond (
486
+ ? cond (
484
487
clockRunning ( clock ) ,
485
- call ( [ target . x , target . y ] , ( [ x , y ] ) => props . onStop ( { nativeEvent : { x, y } } ) ) ,
486
- ) ,
488
+ call ( [ target . x , target . y ] , ( [ x , y ] ) => props . onStop && props . onStop ( { nativeEvent : { x, y } } ) ) ,
489
+ ) : [ ] ,
487
490
stopClock ( clock ) ,
488
491
] ) ,
489
492
startClock ( clock ) ,
@@ -522,12 +525,12 @@ export default class Interactable extends React.PureComponent<InteractableProps>
522
525
const step = cond (
523
526
eq ( state , State . ACTIVE ) ,
524
527
[
525
- cond ( dragging , 0 , [
526
- handleStartDrag ,
528
+ cond ( dragging , 0 , block ( [
529
+ handleStartDrag || [ ] ,
527
530
startClock ( clock ) ,
528
531
set ( dragging , 1 ) ,
529
532
set ( start , x ) ,
530
- ] ) ,
533
+ ] ) ) ,
531
534
set ( anchor , add ( start , drag ) ) ,
532
535
cond ( dt , dragBehaviors [ axis ] ) ,
533
536
] ,
0 commit comments