Repository navigation
Expand file tree
/
Copy pathglobal-setup.ts
More file actions
63 lines (61 loc) · 1.65 KB
/
Copy pathglobal-setup.ts
File metadata and controls
63 lines (61 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { CoreTypes, TouchManager, View } from "@nativescript/core";
const originalTransform = Symbol('originalTransform');
TouchManager.enableGlobalTapAnimations = true;
TouchManager.animations = {
down: (view: View) => {
if (__APPLE__) {
UIView.animateWithDurationDelayUsingSpringWithDampingInitialSpringVelocityOptionsAnimationsCompletion(
0.3,
0,
0.5,
3,
UIViewAnimationOptions.CurveEaseInOut,
() => {
if (view?.ios) {
view[originalTransform] = view[originalTransform] ?? view.ios.transform;
view.ios.transform = CGAffineTransformConcat(
view[originalTransform],
CGAffineTransformMakeScale(0.97, 0.97)
);
}
},
() => {}
);
} else {
view
?.animate({
scale: { x: 0.97, y: 0.97 },
duration: 120,
curve: CoreTypes.AnimationCurve.easeInOut
})
.then(() => {})
.catch(() => {});
}
},
up: (view: View) => {
if (__APPLE__) {
UIView.animateWithDurationDelayUsingSpringWithDampingInitialSpringVelocityOptionsAnimationsCompletion(
0.3,
0,
0.5,
3,
UIViewAnimationOptions.CurveEaseInOut,
() => {
if (view?.ios) {
view.ios.transform = view[originalTransform] ?? CGAffineTransformMakeScale(1, 1);
}
},
() => {}
);
} else {
view
?.animate({
scale: { x: 1, y: 1 },
duration: 120,
curve: CoreTypes.AnimationCurve.easeInOut
})
.then(() => {})
.catch(() => {});
}
}
};