@@ -33,13 +33,11 @@ class Demo extends Component<any, any> {
33
33
}
34
34
35
35
log = ( type : string , keys ?: string [ ] ) => ( ...args ) => {
36
- this . doTapOrPress ( type , keys , ...args ) ;
36
+ console . log ( type , ...args ) ;
37
+ this . doLog ( type , keys , ...args ) ;
37
38
this . doTransform ( type , ...args ) ;
38
39
}
39
- doTapOrPress = ( type , keys , ...args ) => {
40
- if ( [ 'onTap' , 'onPress' , 'onPressUp' ] . indexOf ( type ) === - 1 ) {
41
- return ;
42
- }
40
+ doLog = ( type , keys , ...args ) => {
43
41
const extInfo = keys ? keys . map ( key => `${ key } = ${ args [ 0 ] [ key ] } ` ) . join ( ', ' ) : '' ;
44
42
const logEl = this . refs . log as any ;
45
43
logEl . innerHTML += `<p>${ type } ${ extInfo } </p>` ;
@@ -55,7 +53,6 @@ class Demo extends Component<any, any> {
55
53
this . _rotation = rotation ;
56
54
}
57
55
let transform : any = [ ] ;
58
- // console.log(type, ...args); let transform: any = [];
59
56
this . _scale && transform . push ( `scale(${ this . _scale } )` ) ;
60
57
this . _rotation && transform . push ( `rotate(${ this . _rotation } deg)` ) ;
61
58
@@ -76,18 +73,16 @@ class Demo extends Component<any, any> {
76
73
onTap = { this . log ( 'onTap' ) }
77
74
onPress = { this . log ( 'onPress' ) }
78
75
onPressUp = { this . log ( 'onPressUp' ) }
79
- onSwipe = { this . log ( 'onSwipe' , [ 'angle' , 'direction' ] ) }
80
- onSwipeLeft = { this . log ( 'onSwipeLeft' , [ 'angle' , 'direction' ] ) }
81
- onSwipeRight = { this . log ( 'onSwipeRight' , [ 'angle' , 'direction' ] ) }
82
- onSwipeUp = { this . log ( 'onSwipeUp' , [ 'angle' , 'direction' ] ) }
83
- onSwipeDown = { this . log ( 'onSwipeDown' , [ 'angle' , 'direction' ] ) }
84
- onPan = { this . log ( 'onPan' ) }
85
- onPanStart = { this . log ( 'onPanStart' ) }
86
- onPinch = { this . log ( 'onPinch' , [ 'pinchLen' , 'scale' ] ) }
87
- onPinchStart = { this . log ( 'onPinchStart' , [ 'pinchLen' , 'scale' ] ) }
88
- onPinchMove = { this . log ( 'onPinchMove' , [ 'pinchLen' , 'scale' ] ) }
89
- onPinchEnd = { this . log ( 'onPinchEnd' , [ 'pinchLen' , 'scale' ] ) }
90
- onPinchCancel = { this . log ( 'onPinchCancel' , [ 'pinchLen' , 'scale' ] ) }
76
+ onSwipe = { this . log ( 'onSwipe' , [ 'direction' ] ) }
77
+ onSwipeLeft = { this . log ( 'onSwipeLeft' , [ 'direction' ] ) }
78
+ onSwipeRight = { this . log ( 'onSwipeRight' , [ 'direction' ] ) }
79
+ onSwipeUp = { this . log ( 'onSwipeUp' , [ 'direction' ] ) }
80
+ onSwipeDown = { this . log ( 'onSwipeDown' , [ 'direction' ] ) }
81
+ onPinch = { this . log ( 'onPinch' , [ 'scale' ] ) }
82
+ onPinchStart = { this . log ( 'onPinchStart' , [ 'scale' ] ) }
83
+ onPinchMove = { this . log ( 'onPinchMove' , [ 'scale' ] ) }
84
+ onPinchEnd = { this . log ( 'onPinchEnd' , [ 'scale' ] ) }
85
+ onPinchCancel = { this . log ( 'onPinchCancel' , [ 'scale' ] ) }
91
86
onRotate = { this . log ( 'onRotate' , [ 'rotation' ] ) }
92
87
onRotateStart = { this . log ( 'onRotateStart' , [ 'rotation' ] ) }
93
88
onRotateMove = { this . log ( 'onRotateMove' , [ 'rotation' ] ) }
0 commit comments