forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-native-screens+3.34.0+004+ios-custom-animations-native-transitions.patch
138 lines (132 loc) · 7.94 KB
/
react-native-screens+3.34.0+004+ios-custom-animations-native-transitions.patch
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
diff --git a/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm b/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm
index abb2cf6..c21b3e9 100644
--- a/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm
+++ b/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm
@@ -5,13 +5,14 @@
// proportions to default transition duration
static const float RNSSlideOpenTransitionDurationProportion = 1;
-static const float RNSFadeOpenTransitionDurationProportion = 0.2 / 0.35;
-static const float RNSSlideCloseTransitionDurationProportion = 0.25 / 0.35;
-static const float RNSFadeCloseTransitionDurationProportion = 0.15 / 0.35;
-static const float RNSFadeCloseDelayTransitionDurationProportion = 0.1 / 0.35;
+static const float RNSFadeOpenTransitionDurationProportion = 0.2 / 0.5;
+static const float RNSSlideCloseTransitionDurationProportion = 0.25 / 0.5;
+static const float RNSFadeCloseTransitionDurationProportion = 0.15 / 0.5;
+static const float RNSFadeCloseDelayTransitionDurationProportion = 0.1 / 0.5;
// same value is used in other projects using similar approach for transistions
// and it looks the most similar to the value used by Apple
static constexpr float RNSShadowViewMaxAlpha = 0.1;
+static const int UIViewAnimationOptionCurveDefaultTransition = 7 << 16;
@implementation RNSScreenStackAnimator {
UINavigationControllerOperation _operation;
@@ -22,7 +23,7 @@ - (instancetype)initWithOperation:(UINavigationControllerOperation)operation
{
if (self = [super init]) {
_operation = operation;
- _transitionDuration = 0.35; // default duration in seconds
+ _transitionDuration = 0.5; // default duration in seconds
}
return self;
}
@@ -129,6 +130,8 @@ - (void)animateSimplePushWithShadowEnabled:(BOOL)shadowEnabled
}
[UIView animateWithDuration:[self transitionDuration:transitionContext]
+ delay:0
+ options:UIViewAnimationOptionCurveDefaultTransition
animations:^{
fromViewController.view.transform = leftTransform;
toViewController.view.transform = CGAffineTransformIdentity;
@@ -170,6 +173,8 @@ - (void)animateSimplePushWithShadowEnabled:(BOOL)shadowEnabled
if (!transitionContext.isInteractive) {
[UIView animateWithDuration:[self transitionDuration:transitionContext]
+ delay:0
+ options:UIViewAnimationOptionCurveDefaultTransition
animations:animationBlock
completion:completionBlock];
} else {
@@ -203,6 +208,8 @@ - (void)animateSlideFromLeftWithTransitionContext:(id<UIViewControllerContextTra
toViewController.view.transform = rightTransform;
[[transitionContext containerView] addSubview:toViewController.view];
[UIView animateWithDuration:[self transitionDuration:transitionContext]
+ delay:0
+ options:UIViewAnimationOptionCurveDefaultTransition
animations:^{
fromViewController.view.transform = leftTransform;
toViewController.view.transform = CGAffineTransformIdentity;
@@ -228,6 +235,8 @@ - (void)animateSlideFromLeftWithTransitionContext:(id<UIViewControllerContextTra
if (!transitionContext.isInteractive) {
[UIView animateWithDuration:[self transitionDuration:transitionContext]
+ delay:0
+ options:UIViewAnimationOptionCurveDefaultTransition
animations:animationBlock
completion:completionBlock];
} else {
@@ -284,6 +293,8 @@ - (void)animateSlideFromBottomWithTransitionContext:(id<UIViewControllerContextT
toViewController.view.transform = topBottomTransform;
[[transitionContext containerView] addSubview:toViewController.view];
[UIView animateWithDuration:[self transitionDuration:transitionContext]
+ delay:0
+ options:UIViewAnimationOptionCurveDefaultTransition
animations:^{
fromViewController.view.transform = CGAffineTransformIdentity;
toViewController.view.transform = CGAffineTransformIdentity;
@@ -309,6 +320,8 @@ - (void)animateSlideFromBottomWithTransitionContext:(id<UIViewControllerContextT
if (!transitionContext.isInteractive) {
[UIView animateWithDuration:[self transitionDuration:transitionContext]
+ delay:0
+ options:UIViewAnimationOptionCurveDefaultTransition
animations:animationBlock
completion:completionBlock];
} else {
diff --git a/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts b/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts
index 28d6463..a1473e1 100644
--- a/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts
+++ b/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts
@@ -55,7 +55,7 @@ export interface NativeProps extends ViewProps {
gestureResponseDistance?: GestureResponseDistanceType;
stackPresentation?: WithDefault<StackPresentation, 'push'>;
stackAnimation?: WithDefault<StackAnimation, 'default'>;
- transitionDuration?: WithDefault<Int32, 350>;
+ transitionDuration?: WithDefault<Int32, 500>;
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
hideKeyboardOnSwipe?: boolean;
diff --git a/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts b/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts
index 11ed190..f676e08 100644
--- a/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts
+++ b/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts
@@ -55,7 +55,7 @@ export interface NativeProps extends ViewProps {
gestureResponseDistance?: GestureResponseDistanceType;
stackPresentation?: WithDefault<StackPresentation, 'push'>;
stackAnimation?: WithDefault<StackAnimation, 'default'>;
- transitionDuration?: WithDefault<Int32, 350>;
+ transitionDuration?: WithDefault<Int32, 500>;
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
hideKeyboardOnSwipe?: boolean;
diff --git a/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts b/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts
index bb59c4c..d4c14ee 100644
--- a/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts
+++ b/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts
@@ -90,7 +90,7 @@ export interface NativeProps extends ViewProps {
gestureResponseDistance?: GestureResponseDistanceType;
stackPresentation?: WithDefault<StackPresentation, 'push'>;
stackAnimation?: WithDefault<StackAnimation, 'default'>;
- transitionDuration?: WithDefault<Int32, 350>;
+ transitionDuration?: WithDefault<Int32, 500>;
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
hideKeyboardOnSwipe?: boolean;
diff --git a/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts b/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts
index 4e39336..ab0b313 100644
--- a/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts
+++ b/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts
@@ -92,7 +92,7 @@ export interface NativeProps extends ViewProps {
gestureResponseDistance?: GestureResponseDistanceType;
stackPresentation?: WithDefault<StackPresentation, 'push'>;
stackAnimation?: WithDefault<StackAnimation, 'default'>;
- transitionDuration?: WithDefault<Int32, 350>;
+ transitionDuration?: WithDefault<Int32, 500>;
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
hideKeyboardOnSwipe?: boolean;