react-native-screens 4.0.0-beta.8 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/android/CMakeLists.txt +28 -19
- package/android/src/main/java/com/swmansion/rnscreens/CustomToolbar.kt +13 -3
- package/android/src/main/java/com/swmansion/rnscreens/InsetsObserverProxy.kt +2 -4
- package/android/src/main/java/com/swmansion/rnscreens/NativeDismissalObserver.kt +12 -0
- package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +11 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +24 -6
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +64 -68
- package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +1 -0
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/BottomSheetBehaviorExt.kt +42 -0
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/DimmingFragment.kt +24 -19
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetUtils.kt +8 -0
- package/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt +24 -0
- package/android/src/main/jni/CMakeLists.txt +28 -19
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +2 -2
- package/ios/RNSConvert.h +13 -4
- package/ios/RNSConvert.mm +50 -28
- package/ios/RNSEnums.h +47 -0
- package/ios/RNSPercentDrivenInteractiveTransition.h +12 -0
- package/ios/RNSPercentDrivenInteractiveTransition.mm +69 -0
- package/ios/RNSScreen.h +14 -0
- package/ios/RNSScreen.mm +30 -5
- package/ios/RNSScreenStack.mm +74 -9
- package/ios/RNSScreenStackAnimator.h +13 -1
- package/ios/RNSScreenStackAnimator.mm +233 -130
- package/ios/RNSScreenStackHeaderConfig.h +1 -1
- package/ios/RNSScreenStackHeaderConfig.mm +39 -29
- package/lib/commonjs/components/DebugContainer.js +40 -0
- package/lib/commonjs/components/DebugContainer.js.map +1 -0
- package/lib/commonjs/components/DebugContainer.web.js +15 -0
- package/lib/commonjs/components/DebugContainer.web.js.map +1 -0
- package/lib/commonjs/components/FullWindowOverlay.js +8 -5
- package/lib/commonjs/components/FullWindowOverlay.js.map +1 -1
- package/lib/commonjs/components/Screen.js +35 -10
- package/lib/commonjs/components/Screen.js.map +1 -1
- package/lib/commonjs/components/ScreenContainer.js +3 -5
- package/lib/commonjs/components/ScreenContainer.js.map +1 -1
- package/lib/commonjs/components/ScreenContainer.web.js +3 -4
- package/lib/commonjs/components/ScreenContainer.web.js.map +1 -1
- package/lib/commonjs/components/ScreenContentWrapper.js +2 -4
- package/lib/commonjs/components/ScreenContentWrapper.js.map +1 -1
- package/lib/commonjs/components/ScreenContentWrapper.web.js +1 -2
- package/lib/commonjs/components/ScreenContentWrapper.web.js.map +1 -1
- package/lib/commonjs/components/ScreenFooter.js +2 -8
- package/lib/commonjs/components/ScreenFooter.js.map +1 -1
- package/lib/commonjs/components/ScreenFooter.web.js +1 -2
- package/lib/commonjs/components/ScreenFooter.web.js.map +1 -1
- package/lib/commonjs/components/ScreenStack.js +47 -9
- package/lib/commonjs/components/ScreenStack.js.map +1 -1
- package/lib/commonjs/components/ScreenStack.web.js +2 -1
- package/lib/commonjs/components/ScreenStack.web.js.map +1 -1
- package/lib/commonjs/components/ScreenStackHeaderConfig.js +14 -10
- package/lib/commonjs/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/commonjs/components/ScreenStackItem.js +99 -0
- package/lib/commonjs/components/ScreenStackItem.js.map +1 -0
- package/lib/commonjs/components/SearchBar.js +5 -5
- package/lib/commonjs/components/SearchBar.js.map +1 -1
- package/lib/commonjs/components/SearchBar.web.js +3 -4
- package/lib/commonjs/components/SearchBar.web.js.map +1 -1
- package/lib/commonjs/components/helpers/usePrevious.js +15 -0
- package/lib/commonjs/components/helpers/usePrevious.js.map +1 -0
- package/lib/commonjs/contexts.js +11 -0
- package/lib/commonjs/contexts.js.map +1 -0
- package/lib/commonjs/core.js +0 -3
- package/lib/commonjs/core.js.map +1 -1
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js +2 -2
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js.map +1 -1
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js +3 -3
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js.map +1 -1
- package/lib/commonjs/gesture-handler/fabricUtils.js +54 -18
- package/lib/commonjs/gesture-handler/fabricUtils.js.map +1 -1
- package/lib/commonjs/index.js +23 -86
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +4 -0
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/views/FooterComponent.js +2 -2
- package/lib/commonjs/native-stack/views/FooterComponent.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js +10 -8
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +34 -39
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +2 -2
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreen.js +2 -2
- package/lib/commonjs/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js +2 -2
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/commonjs/utils.js +28 -6
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/components/DebugContainer.js +31 -0
- package/lib/module/components/DebugContainer.js.map +1 -0
- package/lib/module/components/DebugContainer.web.js +6 -0
- package/lib/module/components/DebugContainer.web.js.map +1 -0
- package/lib/module/components/FullWindowOverlay.js +9 -6
- package/lib/module/components/FullWindowOverlay.js.map +1 -1
- package/lib/module/components/Screen.js +34 -9
- package/lib/module/components/Screen.js.map +1 -1
- package/lib/module/components/ScreenContainer.js +2 -4
- package/lib/module/components/ScreenContainer.js.map +1 -1
- package/lib/module/components/ScreenContainer.web.js +2 -3
- package/lib/module/components/ScreenContainer.web.js.map +1 -1
- package/lib/module/components/ScreenContentWrapper.js +1 -3
- package/lib/module/components/ScreenContentWrapper.js.map +1 -1
- package/lib/module/components/ScreenContentWrapper.web.js +0 -1
- package/lib/module/components/ScreenContentWrapper.web.js.map +1 -1
- package/lib/module/components/ScreenFooter.js +1 -7
- package/lib/module/components/ScreenFooter.js.map +1 -1
- package/lib/module/components/ScreenFooter.web.js +0 -1
- package/lib/module/components/ScreenFooter.web.js.map +1 -1
- package/lib/module/components/ScreenStack.js +46 -8
- package/lib/module/components/ScreenStack.js.map +1 -1
- package/lib/module/components/ScreenStack.web.js +2 -1
- package/lib/module/components/ScreenStack.web.js.map +1 -1
- package/lib/module/components/ScreenStackHeaderConfig.js +14 -8
- package/lib/module/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/module/components/ScreenStackItem.js +90 -0
- package/lib/module/components/ScreenStackItem.js.map +1 -0
- package/lib/module/components/SearchBar.js +3 -3
- package/lib/module/components/SearchBar.js.map +1 -1
- package/lib/module/components/SearchBar.web.js +2 -3
- package/lib/module/components/SearchBar.web.js.map +1 -1
- package/lib/module/components/helpers/usePrevious.js +9 -0
- package/lib/module/components/helpers/usePrevious.js.map +1 -0
- package/lib/module/contexts.js +4 -0
- package/lib/module/contexts.js.map +1 -0
- package/lib/module/core.js +0 -3
- package/lib/module/core.js.map +1 -1
- package/lib/module/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/gesture-handler/GestureDetectorProvider.js +1 -1
- package/lib/module/gesture-handler/GestureDetectorProvider.js.map +1 -1
- package/lib/module/gesture-handler/ScreenGestureDetector.js +3 -3
- package/lib/module/gesture-handler/ScreenGestureDetector.js.map +1 -1
- package/lib/module/gesture-handler/fabricUtils.js +55 -17
- package/lib/module/gesture-handler/fabricUtils.js.map +1 -1
- package/lib/module/index.js +12 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +4 -0
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/native-stack/views/FooterComponent.js +1 -1
- package/lib/module/native-stack/views/FooterComponent.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js +3 -1
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +28 -33
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js +1 -2
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreen.js +1 -2
- package/lib/module/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/module/utils.js +26 -5
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/components/DebugContainer.d.ts +15 -0
- package/lib/typescript/components/DebugContainer.d.ts.map +1 -0
- package/lib/typescript/components/DebugContainer.web.d.ts +4 -0
- package/lib/typescript/components/DebugContainer.web.d.ts.map +1 -0
- package/lib/typescript/components/FullWindowOverlay.d.ts.map +1 -1
- package/lib/typescript/components/Screen.d.ts +2 -7
- package/lib/typescript/components/Screen.d.ts.map +1 -1
- package/lib/typescript/components/Screen.web.d.ts +1 -1
- package/lib/typescript/components/Screen.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContainer.d.ts +1 -3
- package/lib/typescript/components/ScreenContainer.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContainer.web.d.ts +2 -3
- package/lib/typescript/components/ScreenContainer.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContentWrapper.d.ts +0 -1
- package/lib/typescript/components/ScreenContentWrapper.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContentWrapper.web.d.ts +0 -1
- package/lib/typescript/components/ScreenContentWrapper.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenFooter.d.ts +0 -4
- package/lib/typescript/components/ScreenFooter.d.ts.map +1 -1
- package/lib/typescript/components/ScreenFooter.web.d.ts +0 -1
- package/lib/typescript/components/ScreenFooter.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStack.d.ts +1 -1
- package/lib/typescript/components/ScreenStack.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStack.web.d.ts +2 -1
- package/lib/typescript/components/ScreenStack.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts +3 -3
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackItem.d.ts +11 -0
- package/lib/typescript/components/ScreenStackItem.d.ts.map +1 -0
- package/lib/typescript/components/SearchBar.d.ts +1 -15
- package/lib/typescript/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/components/SearchBar.web.d.ts +2 -3
- package/lib/typescript/components/SearchBar.web.d.ts.map +1 -1
- package/lib/typescript/components/helpers/usePrevious.d.ts +2 -0
- package/lib/typescript/components/helpers/usePrevious.d.ts.map +1 -0
- package/lib/typescript/contexts.d.ts +5 -0
- package/lib/typescript/contexts.d.ts.map +1 -0
- package/lib/typescript/core.d.ts +0 -1
- package/lib/typescript/core.d.ts.map +1 -1
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts +9 -3
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +2 -2
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +2 -2
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts +1 -1
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts.map +1 -1
- package/lib/typescript/gesture-handler/ScreenGestureDetector.d.ts +2 -2
- package/lib/typescript/gesture-handler/ScreenGestureDetector.d.ts.map +1 -1
- package/lib/typescript/gesture-handler/fabricUtils.d.ts +7 -5
- package/lib/typescript/gesture-handler/fabricUtils.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +10 -16
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts +3 -0
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +58 -12
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts.map +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts.map +1 -1
- package/lib/typescript/reanimated/ReanimatedScreenProvider.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +52 -16
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +26 -1
- package/lib/typescript/utils.d.ts.map +1 -1
- package/native-stack/README.md +5 -4
- package/native-stack/package.json +4 -4
- package/package.json +1 -1
- package/react-native.config.js +16 -28
- package/src/components/DebugContainer.tsx +47 -0
- package/src/components/DebugContainer.web.tsx +7 -0
- package/src/components/FullWindowOverlay.tsx +10 -2
- package/src/components/Screen.tsx +52 -24
- package/src/components/Screen.web.tsx +1 -1
- package/src/components/ScreenContainer.tsx +4 -11
- package/src/components/ScreenContainer.web.tsx +2 -3
- package/src/components/ScreenContentWrapper.tsx +2 -5
- package/src/components/ScreenContentWrapper.web.tsx +1 -2
- package/src/components/ScreenFooter.tsx +2 -8
- package/src/components/ScreenFooter.web.tsx +1 -2
- package/src/components/ScreenStack.tsx +99 -12
- package/src/components/ScreenStack.web.tsx +3 -1
- package/src/components/ScreenStackHeaderConfig.tsx +28 -13
- package/src/components/ScreenStackHeaderConfig.web.tsx +1 -1
- package/src/components/ScreenStackItem.tsx +162 -0
- package/src/components/SearchBar.tsx +4 -7
- package/src/components/SearchBar.web.tsx +2 -3
- package/src/components/helpers/usePrevious.tsx +11 -0
- package/src/contexts.tsx +9 -0
- package/src/core.ts +0 -3
- package/src/fabric/ModalScreenNativeComponent.ts +11 -3
- package/src/fabric/ScreenNativeComponent.ts +2 -2
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +2 -1
- package/src/fabric/ScreenStackNativeComponent.ts +1 -1
- package/src/gesture-handler/GestureDetectorProvider.tsx +2 -2
- package/src/gesture-handler/ScreenGestureDetector.tsx +4 -4
- package/src/gesture-handler/fabricUtils.ts +74 -27
- package/src/index.tsx +11 -37
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +3 -0
- package/src/native-stack/types.tsx +60 -17
- package/src/native-stack/utils/getDefaultHeaderHeight.tsx +1 -1
- package/src/native-stack/views/FooterComponent.tsx +1 -1
- package/src/native-stack/views/HeaderConfig.tsx +7 -5
- package/src/native-stack/views/NativeStackView.tsx +48 -67
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +2 -2
- package/src/reanimated/ReanimatedScreen.tsx +2 -1
- package/src/reanimated/ReanimatedScreenProvider.tsx +2 -1
- package/src/types.tsx +72 -15
- package/src/utils.ts +27 -5
|
@@ -3,30 +3,48 @@
|
|
|
3
3
|
|
|
4
4
|
#import "RNSScreen.h"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
static
|
|
12
|
-
|
|
6
|
+
#pragma mark - Constants
|
|
7
|
+
|
|
8
|
+
// Default duration for transitions in seconds. Note, that this enforces the default
|
|
9
|
+
// only on Paper. On Fabric the transition duration coming from JS layer
|
|
10
|
+
// is never null, thus it defaults to the value set in component codegen spec.
|
|
11
|
+
static constexpr NSTimeInterval RNSDefaultTransitionDuration = 0.5;
|
|
12
|
+
|
|
13
|
+
// Proportions for diffrent phases of more complex animations.
|
|
14
|
+
// The reference duration differs from default transition duration,
|
|
15
|
+
// because we've changed the default duration & we want to keep proportions
|
|
16
|
+
// in tact. Unit = seconds.
|
|
17
|
+
static constexpr NSTimeInterval RNSTransitionDurationForProportion = 0.35;
|
|
18
|
+
|
|
19
|
+
static constexpr float RNSSlideOpenTransitionDurationProportion = 1;
|
|
20
|
+
static constexpr float RNSFadeOpenTransitionDurationProportion = 0.2 / RNSTransitionDurationForProportion;
|
|
21
|
+
static constexpr float RNSSlideCloseTransitionDurationProportion = 0.25 / RNSTransitionDurationForProportion;
|
|
22
|
+
static constexpr float RNSFadeCloseTransitionDurationProportion = 0.15 / RNSTransitionDurationForProportion;
|
|
23
|
+
static constexpr float RNSFadeCloseDelayTransitionDurationProportion = 0.1 / RNSTransitionDurationForProportion;
|
|
24
|
+
|
|
25
|
+
// Value used for dimming view attached for tranistion time.
|
|
26
|
+
// Same value is used in other projects using similar approach for transistions
|
|
13
27
|
// and it looks the most similar to the value used by Apple
|
|
14
28
|
static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
15
29
|
|
|
16
30
|
@implementation RNSScreenStackAnimator {
|
|
17
31
|
UINavigationControllerOperation _operation;
|
|
18
32
|
NSTimeInterval _transitionDuration;
|
|
33
|
+
UIViewPropertyAnimator *_Nullable _inFlightAnimator;
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
- (instancetype)initWithOperation:(UINavigationControllerOperation)operation
|
|
22
37
|
{
|
|
23
38
|
if (self = [super init]) {
|
|
24
39
|
_operation = operation;
|
|
25
|
-
_transitionDuration =
|
|
40
|
+
_transitionDuration = RNSDefaultTransitionDuration; // default duration in seconds
|
|
41
|
+
_inFlightAnimator = nil;
|
|
26
42
|
}
|
|
27
43
|
return self;
|
|
28
44
|
}
|
|
29
45
|
|
|
46
|
+
#pragma mark - UIViewControllerAnimatedTransitioning
|
|
47
|
+
|
|
30
48
|
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext
|
|
31
49
|
{
|
|
32
50
|
RNSScreenView *screen;
|
|
@@ -52,6 +70,12 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
52
70
|
return _transitionDuration;
|
|
53
71
|
}
|
|
54
72
|
|
|
73
|
+
- (id<UIViewImplicitlyAnimating>)interruptibleAnimatorForTransition:
|
|
74
|
+
(id<UIViewControllerContextTransitioning>)transitionContext
|
|
75
|
+
{
|
|
76
|
+
return _inFlightAnimator;
|
|
77
|
+
}
|
|
78
|
+
|
|
55
79
|
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
|
|
56
80
|
{
|
|
57
81
|
UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
|
|
@@ -97,6 +121,13 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
97
121
|
}
|
|
98
122
|
}
|
|
99
123
|
|
|
124
|
+
- (void)animationEnded:(BOOL)transitionCompleted
|
|
125
|
+
{
|
|
126
|
+
_inFlightAnimator = nil;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
#pragma mark - Animation implementations
|
|
130
|
+
|
|
100
131
|
- (void)animateSimplePushWithShadowEnabled:(BOOL)shadowEnabled
|
|
101
132
|
transitionContext:(id<UIViewControllerContextTransitioning>)transitionContext
|
|
102
133
|
toVC:(UIViewController *)toViewController
|
|
@@ -128,22 +159,28 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
128
159
|
shadowView.alpha = 0.0;
|
|
129
160
|
}
|
|
130
161
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
162
|
+
UIViewPropertyAnimator *animator =
|
|
163
|
+
[[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
164
|
+
timingParameters:[RNSScreenStackAnimator defaultSpringTimingParametersApprox]];
|
|
165
|
+
|
|
166
|
+
[animator addAnimations:^{
|
|
167
|
+
fromViewController.view.transform = leftTransform;
|
|
168
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
169
|
+
if (shadowView) {
|
|
170
|
+
shadowView.alpha = RNSShadowViewMaxAlpha;
|
|
171
|
+
}
|
|
172
|
+
}];
|
|
173
|
+
|
|
174
|
+
[animator addCompletion:^(UIViewAnimatingPosition finalPosition) {
|
|
175
|
+
if (shadowView) {
|
|
176
|
+
[shadowView removeFromSuperview];
|
|
177
|
+
}
|
|
178
|
+
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
179
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
180
|
+
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
181
|
+
}];
|
|
182
|
+
_inFlightAnimator = animator;
|
|
183
|
+
[animator startAnimation];
|
|
147
184
|
} else if (_operation == UINavigationControllerOperationPop) {
|
|
148
185
|
toViewController.view.transform = leftTransform;
|
|
149
186
|
[[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view];
|
|
@@ -159,7 +196,8 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
159
196
|
shadowView.alpha = 0.0;
|
|
160
197
|
}
|
|
161
198
|
};
|
|
162
|
-
|
|
199
|
+
|
|
200
|
+
void (^completionBlock)(UIViewAnimatingPosition) = ^(UIViewAnimatingPosition finalPosition) {
|
|
163
201
|
if (shadowView) {
|
|
164
202
|
[shadowView removeFromSuperview];
|
|
165
203
|
}
|
|
@@ -169,16 +207,24 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
169
207
|
};
|
|
170
208
|
|
|
171
209
|
if (!transitionContext.isInteractive) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
210
|
+
UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc]
|
|
211
|
+
initWithDuration:[self transitionDuration:transitionContext]
|
|
212
|
+
timingParameters:[RNSScreenStackAnimator defaultSpringTimingParametersApprox]];
|
|
213
|
+
|
|
214
|
+
[animator addAnimations:animationBlock];
|
|
215
|
+
[animator addCompletion:completionBlock];
|
|
216
|
+
_inFlightAnimator = animator;
|
|
217
|
+
[animator startAnimation];
|
|
175
218
|
} else {
|
|
176
219
|
// we don't want the EaseInOut option when swiping to dismiss the view, it is the same in default animation option
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
220
|
+
UIViewPropertyAnimator *animator =
|
|
221
|
+
[[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
222
|
+
curve:UIViewAnimationCurveLinear
|
|
223
|
+
animations:animationBlock];
|
|
224
|
+
|
|
225
|
+
[animator addCompletion:completionBlock];
|
|
226
|
+
[animator setUserInteractionEnabled:YES];
|
|
227
|
+
_inFlightAnimator = animator;
|
|
182
228
|
}
|
|
183
229
|
}
|
|
184
230
|
}
|
|
@@ -202,16 +248,22 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
202
248
|
if (_operation == UINavigationControllerOperationPush) {
|
|
203
249
|
toViewController.view.transform = rightTransform;
|
|
204
250
|
[[transitionContext containerView] addSubview:toViewController.view];
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
251
|
+
|
|
252
|
+
UIViewPropertyAnimator *animator =
|
|
253
|
+
[[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
254
|
+
timingParameters:[RNSScreenStackAnimator defaultSpringTimingParametersApprox]];
|
|
255
|
+
|
|
256
|
+
[animator addAnimations:^{
|
|
257
|
+
fromViewController.view.transform = leftTransform;
|
|
258
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
259
|
+
}];
|
|
260
|
+
[animator addCompletion:^(UIViewAnimatingPosition finalPosition) {
|
|
261
|
+
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
262
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
263
|
+
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
264
|
+
}];
|
|
265
|
+
_inFlightAnimator = animator;
|
|
266
|
+
[animator startAnimation];
|
|
215
267
|
} else if (_operation == UINavigationControllerOperationPop) {
|
|
216
268
|
toViewController.view.transform = leftTransform;
|
|
217
269
|
[[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view];
|
|
@@ -220,23 +272,30 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
220
272
|
toViewController.view.transform = CGAffineTransformIdentity;
|
|
221
273
|
fromViewController.view.transform = rightTransform;
|
|
222
274
|
};
|
|
223
|
-
void (^completionBlock)(
|
|
275
|
+
void (^completionBlock)(UIViewAnimatingPosition) = ^(UIViewAnimatingPosition finalPosition) {
|
|
224
276
|
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
225
277
|
toViewController.view.transform = CGAffineTransformIdentity;
|
|
226
278
|
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
227
279
|
};
|
|
228
280
|
|
|
229
281
|
if (!transitionContext.isInteractive) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
282
|
+
UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc]
|
|
283
|
+
initWithDuration:[self transitionDuration:transitionContext]
|
|
284
|
+
timingParameters:[RNSScreenStackAnimator defaultSpringTimingParametersApprox]];
|
|
285
|
+
|
|
286
|
+
[animator addAnimations:animationBlock];
|
|
287
|
+
[animator addCompletion:completionBlock];
|
|
288
|
+
_inFlightAnimator = animator;
|
|
289
|
+
[animator startAnimation];
|
|
233
290
|
} else {
|
|
234
291
|
// we don't want the EaseInOut option when swiping to dismiss the view, it is the same in default animation option
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
292
|
+
UIViewPropertyAnimator *animator =
|
|
293
|
+
[[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
294
|
+
curve:UIViewAnimationCurveLinear
|
|
295
|
+
animations:animationBlock];
|
|
296
|
+
[animator addCompletion:completionBlock];
|
|
297
|
+
[animator setUserInteractionEnabled:YES];
|
|
298
|
+
_inFlightAnimator = animator;
|
|
240
299
|
}
|
|
241
300
|
}
|
|
242
301
|
}
|
|
@@ -250,26 +309,30 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
250
309
|
if (_operation == UINavigationControllerOperationPush) {
|
|
251
310
|
[[transitionContext containerView] addSubview:toViewController.view];
|
|
252
311
|
toViewController.view.alpha = 0.0;
|
|
253
|
-
[
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
312
|
+
auto animator = [[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
313
|
+
curve:UIViewAnimationCurveEaseInOut
|
|
314
|
+
animations:^{
|
|
315
|
+
toViewController.view.alpha = 1.0;
|
|
316
|
+
}];
|
|
317
|
+
[animator addCompletion:^(UIViewAnimatingPosition finalPosition) {
|
|
318
|
+
toViewController.view.alpha = 1.0;
|
|
319
|
+
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
320
|
+
}];
|
|
321
|
+
_inFlightAnimator = animator;
|
|
322
|
+
[animator startAnimation];
|
|
261
323
|
} else if (_operation == UINavigationControllerOperationPop) {
|
|
262
324
|
[[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view];
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
325
|
+
auto animator = [[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
326
|
+
curve:UIViewAnimationCurveEaseInOut
|
|
327
|
+
animations:^{
|
|
328
|
+
fromViewController.view.alpha = 0.0;
|
|
329
|
+
}];
|
|
330
|
+
[animator addCompletion:^(UIViewAnimatingPosition finalPosition) {
|
|
331
|
+
fromViewController.view.alpha = 1.0;
|
|
332
|
+
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
333
|
+
}];
|
|
334
|
+
_inFlightAnimator = animator;
|
|
335
|
+
[animator startAnimation];
|
|
273
336
|
}
|
|
274
337
|
}
|
|
275
338
|
|
|
@@ -283,16 +346,21 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
283
346
|
if (_operation == UINavigationControllerOperationPush) {
|
|
284
347
|
toViewController.view.transform = topBottomTransform;
|
|
285
348
|
[[transitionContext containerView] addSubview:toViewController.view];
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
349
|
+
|
|
350
|
+
auto animator = [[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
351
|
+
curve:UIViewAnimationCurveEaseInOut
|
|
352
|
+
animations:^{
|
|
353
|
+
fromViewController.view.transform =
|
|
354
|
+
CGAffineTransformIdentity;
|
|
355
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
356
|
+
}];
|
|
357
|
+
[animator addCompletion:^(UIViewAnimatingPosition finalPosition) {
|
|
358
|
+
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
359
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
360
|
+
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
361
|
+
}];
|
|
362
|
+
_inFlightAnimator = animator;
|
|
363
|
+
[animator startAnimation];
|
|
296
364
|
} else if (_operation == UINavigationControllerOperationPop) {
|
|
297
365
|
toViewController.view.transform = CGAffineTransformIdentity;
|
|
298
366
|
[[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view];
|
|
@@ -301,23 +369,26 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
301
369
|
toViewController.view.transform = CGAffineTransformIdentity;
|
|
302
370
|
fromViewController.view.transform = topBottomTransform;
|
|
303
371
|
};
|
|
304
|
-
void (^completionBlock)(
|
|
372
|
+
void (^completionBlock)(UIViewAnimatingPosition) = ^(UIViewAnimatingPosition finalPosition) {
|
|
305
373
|
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
306
374
|
toViewController.view.transform = CGAffineTransformIdentity;
|
|
307
375
|
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
308
376
|
};
|
|
309
377
|
|
|
310
378
|
if (!transitionContext.isInteractive) {
|
|
311
|
-
[
|
|
312
|
-
|
|
313
|
-
|
|
379
|
+
auto animator = [[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
380
|
+
curve:UIViewAnimationCurveEaseInOut
|
|
381
|
+
animations:animationBlock];
|
|
382
|
+
[animator addCompletion:completionBlock];
|
|
383
|
+
_inFlightAnimator = animator;
|
|
384
|
+
[animator startAnimation];
|
|
314
385
|
} else {
|
|
315
386
|
// we don't want the EaseInOut option when swiping to dismiss the view, it is the same in default animation option
|
|
316
|
-
[
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
387
|
+
auto animator = [[UIViewPropertyAnimator alloc] initWithDuration:[self transitionDuration:transitionContext]
|
|
388
|
+
curve:UIViewAnimationCurveLinear
|
|
389
|
+
animations:animationBlock];
|
|
390
|
+
[animator addCompletion:completionBlock];
|
|
391
|
+
_inFlightAnimator = animator;
|
|
321
392
|
}
|
|
322
393
|
}
|
|
323
394
|
}
|
|
@@ -329,7 +400,7 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
329
400
|
CGAffineTransform topBottomTransform =
|
|
330
401
|
CGAffineTransformMakeTranslation(0, 0.08 * transitionContext.containerView.bounds.size.height);
|
|
331
402
|
|
|
332
|
-
const float
|
|
403
|
+
const float baseTransitionDuration = [self transitionDuration:transitionContext];
|
|
333
404
|
|
|
334
405
|
if (_operation == UINavigationControllerOperationPush) {
|
|
335
406
|
toViewController.view.transform = topBottomTransform;
|
|
@@ -338,52 +409,59 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
338
409
|
|
|
339
410
|
// Android Nougat open animation
|
|
340
411
|
// http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
412
|
+
auto slideAnimator = [[UIViewPropertyAnimator alloc]
|
|
413
|
+
initWithDuration:baseTransitionDuration * RNSSlideOpenTransitionDurationProportion
|
|
414
|
+
curve:UIViewAnimationCurveEaseOut
|
|
415
|
+
animations:^{
|
|
416
|
+
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
417
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
418
|
+
}];
|
|
419
|
+
[slideAnimator addCompletion:^(UIViewAnimatingPosition finalPosition) {
|
|
420
|
+
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
421
|
+
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
422
|
+
}];
|
|
423
|
+
|
|
424
|
+
auto fadeAnimator = [[UIViewPropertyAnimator alloc]
|
|
425
|
+
initWithDuration:baseTransitionDuration * RNSFadeOpenTransitionDurationProportion
|
|
426
|
+
curve:UIViewAnimationCurveEaseOut
|
|
427
|
+
animations:^{
|
|
428
|
+
toViewController.view.alpha = 1.0;
|
|
429
|
+
}];
|
|
430
|
+
|
|
431
|
+
_inFlightAnimator = slideAnimator;
|
|
432
|
+
[slideAnimator startAnimation];
|
|
433
|
+
[fadeAnimator startAnimation];
|
|
360
434
|
} else if (_operation == UINavigationControllerOperationPop) {
|
|
361
435
|
toViewController.view.transform = CGAffineTransformIdentity;
|
|
362
436
|
[[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view];
|
|
363
437
|
|
|
364
438
|
// Android Nougat exit animation
|
|
365
439
|
// http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_close_exit.xml
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
440
|
+
auto slideAnimator = [[UIViewPropertyAnimator alloc]
|
|
441
|
+
initWithDuration:baseTransitionDuration * RNSSlideCloseTransitionDurationProportion
|
|
442
|
+
curve:UIViewAnimationCurveEaseIn
|
|
443
|
+
animations:^{
|
|
444
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
445
|
+
fromViewController.view.transform = topBottomTransform;
|
|
446
|
+
}];
|
|
447
|
+
[slideAnimator addCompletion:^(UIViewAnimatingPosition finalPosition) {
|
|
448
|
+
fromViewController.view.transform = CGAffineTransformIdentity;
|
|
449
|
+
toViewController.view.transform = CGAffineTransformIdentity;
|
|
450
|
+
fromViewController.view.alpha = 1.0;
|
|
451
|
+
toViewController.view.alpha = 1.0;
|
|
452
|
+
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
|
|
453
|
+
}];
|
|
454
|
+
|
|
455
|
+
auto fadeAnimator = [[UIViewPropertyAnimator alloc]
|
|
456
|
+
initWithDuration:baseTransitionDuration * RNSFadeCloseTransitionDurationProportion
|
|
457
|
+
curve:UIViewAnimationCurveLinear
|
|
458
|
+
animations:^{
|
|
459
|
+
fromViewController.view.alpha = 0.0;
|
|
460
|
+
}];
|
|
461
|
+
|
|
462
|
+
_inFlightAnimator = slideAnimator;
|
|
463
|
+
[slideAnimator startAnimation];
|
|
464
|
+
[fadeAnimator startAnimationAfterDelay:baseTransitionDuration * RNSFadeCloseDelayTransitionDurationProportion];
|
|
387
465
|
}
|
|
388
466
|
}
|
|
389
467
|
|
|
@@ -411,11 +489,20 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
411
489
|
}
|
|
412
490
|
}
|
|
413
491
|
|
|
492
|
+
#pragma mark - Public API
|
|
493
|
+
|
|
494
|
+
- (nullable id<UITimingCurveProvider>)timingParamsForAnimationCompletion
|
|
495
|
+
{
|
|
496
|
+
return [RNSScreenStackAnimator defaultSpringTimingParametersApprox];
|
|
497
|
+
}
|
|
498
|
+
|
|
414
499
|
+ (BOOL)isCustomAnimation:(RNSScreenStackAnimation)animation
|
|
415
500
|
{
|
|
416
501
|
return (animation != RNSScreenStackAnimationFlip && animation != RNSScreenStackAnimationDefault);
|
|
417
502
|
}
|
|
418
503
|
|
|
504
|
+
#pragma mark - Helpers
|
|
505
|
+
|
|
419
506
|
- (void)animateTransitionWithStackAnimation:(RNSScreenStackAnimation)animation
|
|
420
507
|
shadowEnabled:(BOOL)shadowEnabled
|
|
421
508
|
transitionContext:(id<UIViewControllerContextTransitioning>)transitionContext
|
|
@@ -442,4 +529,20 @@ static constexpr float RNSShadowViewMaxAlpha = 0.1;
|
|
|
442
529
|
[self animateSimplePushWithShadowEnabled:shadowEnabled transitionContext:transitionContext toVC:toVC fromVC:fromVC];
|
|
443
530
|
}
|
|
444
531
|
|
|
532
|
+
+ (UISpringTimingParameters *)defaultSpringTimingParametersApprox
|
|
533
|
+
{
|
|
534
|
+
// Default curve provider is as defined below, however spring timing defined this way
|
|
535
|
+
// ignores the requested duration of the animation, effectively impairing our `animationDuration` prop.
|
|
536
|
+
// We want to keep `animationDuration` functional.
|
|
537
|
+
// id<UITimingCurveProvider> timingCurveProvider = [[UISpringTimingParameters alloc] init];
|
|
538
|
+
|
|
539
|
+
// According to "Programming iOS 14" by Matt Neuburg, the params for the default spring are as follows:
|
|
540
|
+
// mass = 3, stiffness = 1000, damping = 500. Damping ratio is computed using formula
|
|
541
|
+
// ratio = damping / (2 * sqrt(stiffness * mass)) ==> default damping ratio should be ~= 4,56.
|
|
542
|
+
// I've found afterwards that this is even indicated here:
|
|
543
|
+
// https://developer.apple.com/documentation/uikit/uispringtimingparameters/1649802-init?language=objc
|
|
544
|
+
|
|
545
|
+
return [[UISpringTimingParameters alloc] initWithDampingRatio:4.56];
|
|
546
|
+
}
|
|
547
|
+
|
|
445
548
|
@end
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
@property (nonatomic) BOOL backButtonInCustomView;
|
|
57
57
|
@property (nonatomic) UISemanticContentAttribute direction;
|
|
58
58
|
@property (nonatomic) UINavigationItemBackButtonDisplayMode backButtonDisplayMode;
|
|
59
|
-
@property (nonatomic)
|
|
59
|
+
@property (nonatomic) RNSBlurEffectStyle blurEffect;
|
|
60
60
|
|
|
61
61
|
+ (void)willShowViewController:(UIViewController *)vc
|
|
62
62
|
animated:(BOOL)animated
|
|
@@ -110,6 +110,7 @@ namespace react = facebook::react;
|
|
|
110
110
|
self.hidden = YES;
|
|
111
111
|
_reactSubviews = [NSMutableArray new];
|
|
112
112
|
_backTitleVisible = YES;
|
|
113
|
+
_blurEffect = RNSBlurEffectStyleNone;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
- (UIView *)reactSuperview
|
|
@@ -449,8 +450,11 @@ namespace react = facebook::react;
|
|
|
449
450
|
appearance.backgroundColor = config.backgroundColor;
|
|
450
451
|
}
|
|
451
452
|
|
|
452
|
-
if (config.blurEffect) {
|
|
453
|
-
appearance.backgroundEffect =
|
|
453
|
+
if (config.blurEffect != RNSBlurEffectStyleNone) {
|
|
454
|
+
appearance.backgroundEffect =
|
|
455
|
+
[UIBlurEffect effectWithStyle:[RNSConvert tryConvertRNSBlurEffectStyleToUIBlurEffectStyle:config.blurEffect]];
|
|
456
|
+
} else {
|
|
457
|
+
appearance.backgroundEffect = nil;
|
|
454
458
|
}
|
|
455
459
|
|
|
456
460
|
if (config.hideShadow) {
|
|
@@ -823,12 +827,17 @@ namespace react = facebook::react;
|
|
|
823
827
|
|
|
824
828
|
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
825
829
|
{
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
830
|
+
BOOL isGoingToBeRemoved = _screenView.isMarkedForUnmountInCurrentTransaction;
|
|
831
|
+
if (isGoingToBeRemoved) {
|
|
832
|
+
// For explanation of why we can make a snapshot here despite the fact that our children are already
|
|
833
|
+
// unmounted see https://github.com/software-mansion/react-native-screens/pull/2261
|
|
834
|
+
[self replaceNavigationBarViewsWithSnapshotOfSubview:(RNSScreenStackHeaderSubview *)childComponentView];
|
|
835
|
+
}
|
|
829
836
|
[_reactSubviews removeObject:(RNSScreenStackHeaderSubview *)childComponentView];
|
|
830
837
|
[childComponentView removeFromSuperview];
|
|
831
|
-
|
|
838
|
+
if (!isGoingToBeRemoved) {
|
|
839
|
+
[self updateViewControllerIfNeeded];
|
|
840
|
+
}
|
|
832
841
|
}
|
|
833
842
|
|
|
834
843
|
- (void)replaceNavigationBarViewsWithSnapshotOfSubview:(RNSScreenStackHeaderSubview *)childComponentView
|
|
@@ -972,7 +981,7 @@ static RCTResizeMode resizeModeFromCppEquiv(react::ImageResizeMode resizeMode)
|
|
|
972
981
|
_backgroundColor = RCTUIColorFromSharedColor(newScreenProps.backgroundColor);
|
|
973
982
|
|
|
974
983
|
if (newScreenProps.blurEffect != oldScreenProps.blurEffect) {
|
|
975
|
-
_blurEffect = [RNSConvert
|
|
984
|
+
_blurEffect = [RNSConvert RNSBlurEffectStyleFromCppEquivalent:newScreenProps.blurEffect];
|
|
976
985
|
}
|
|
977
986
|
|
|
978
987
|
[self updateViewControllerIfNeeded];
|
|
@@ -1056,7 +1065,7 @@ RCT_EXPORT_VIEW_PROPERTY(backTitleFontFamily, NSString)
|
|
|
1056
1065
|
RCT_EXPORT_VIEW_PROPERTY(backTitleFontSize, NSNumber)
|
|
1057
1066
|
RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
|
|
1058
1067
|
RCT_EXPORT_VIEW_PROPERTY(backTitleVisible, BOOL)
|
|
1059
|
-
RCT_EXPORT_VIEW_PROPERTY(blurEffect,
|
|
1068
|
+
RCT_EXPORT_VIEW_PROPERTY(blurEffect, RNSBlurEffectStyle)
|
|
1060
1069
|
RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
|
|
1061
1070
|
RCT_EXPORT_VIEW_PROPERTY(direction, UISemanticContentAttribute)
|
|
1062
1071
|
RCT_EXPORT_VIEW_PROPERTY(largeTitle, BOOL)
|
|
@@ -1122,36 +1131,37 @@ RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL)
|
|
|
1122
1131
|
{
|
|
1123
1132
|
NSMutableDictionary *blurEffects = [NSMutableDictionary new];
|
|
1124
1133
|
[blurEffects addEntriesFromDictionary:@{
|
|
1125
|
-
@"
|
|
1126
|
-
@"
|
|
1127
|
-
@"
|
|
1134
|
+
@"none" : @(RNSBlurEffectStyleNone),
|
|
1135
|
+
@"extraLight" : @(RNSBlurEffectStyleExtraLight),
|
|
1136
|
+
@"light" : @(RNSBlurEffectStyleLight),
|
|
1137
|
+
@"dark" : @(RNSBlurEffectStyleDark),
|
|
1128
1138
|
}];
|
|
1129
1139
|
|
|
1130
1140
|
if (@available(iOS 10.0, *)) {
|
|
1131
1141
|
[blurEffects addEntriesFromDictionary:@{
|
|
1132
|
-
@"regular" : @(
|
|
1133
|
-
@"prominent" : @(
|
|
1142
|
+
@"regular" : @(RNSBlurEffectStyleRegular),
|
|
1143
|
+
@"prominent" : @(RNSBlurEffectStyleProminent),
|
|
1134
1144
|
}];
|
|
1135
1145
|
}
|
|
1136
1146
|
#if !TARGET_OS_TV && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
|
|
1137
1147
|
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
|
1138
1148
|
if (@available(iOS 13.0, *)) {
|
|
1139
1149
|
[blurEffects addEntriesFromDictionary:@{
|
|
1140
|
-
@"systemUltraThinMaterial" : @(
|
|
1141
|
-
@"systemThinMaterial" : @(
|
|
1142
|
-
@"systemMaterial" : @(
|
|
1143
|
-
@"systemThickMaterial" : @(
|
|
1144
|
-
@"systemChromeMaterial" : @(
|
|
1145
|
-
@"systemUltraThinMaterialLight" : @(
|
|
1146
|
-
@"systemThinMaterialLight" : @(
|
|
1147
|
-
@"systemMaterialLight" : @(
|
|
1148
|
-
@"systemThickMaterialLight" : @(
|
|
1149
|
-
@"systemChromeMaterialLight" : @(
|
|
1150
|
-
@"systemUltraThinMaterialDark" : @(
|
|
1151
|
-
@"systemThinMaterialDark" : @(
|
|
1152
|
-
@"systemMaterialDark" : @(
|
|
1153
|
-
@"systemThickMaterialDark" : @(
|
|
1154
|
-
@"systemChromeMaterialDark" : @(
|
|
1150
|
+
@"systemUltraThinMaterial" : @(RNSBlurEffectStyleSystemUltraThinMaterial),
|
|
1151
|
+
@"systemThinMaterial" : @(RNSBlurEffectStyleSystemThinMaterial),
|
|
1152
|
+
@"systemMaterial" : @(RNSBlurEffectStyleSystemMaterial),
|
|
1153
|
+
@"systemThickMaterial" : @(RNSBlurEffectStyleSystemThickMaterial),
|
|
1154
|
+
@"systemChromeMaterial" : @(RNSBlurEffectStyleSystemChromeMaterial),
|
|
1155
|
+
@"systemUltraThinMaterialLight" : @(RNSBlurEffectStyleSystemUltraThinMaterialLight),
|
|
1156
|
+
@"systemThinMaterialLight" : @(RNSBlurEffectStyleSystemThinMaterialLight),
|
|
1157
|
+
@"systemMaterialLight" : @(RNSBlurEffectStyleSystemMaterialLight),
|
|
1158
|
+
@"systemThickMaterialLight" : @(RNSBlurEffectStyleSystemThickMaterialLight),
|
|
1159
|
+
@"systemChromeMaterialLight" : @(RNSBlurEffectStyleSystemChromeMaterialLight),
|
|
1160
|
+
@"systemUltraThinMaterialDark" : @(RNSBlurEffectStyleSystemUltraThinMaterialDark),
|
|
1161
|
+
@"systemThinMaterialDark" : @(RNSBlurEffectStyleSystemThinMaterialDark),
|
|
1162
|
+
@"systemMaterialDark" : @(RNSBlurEffectStyleSystemMaterialDark),
|
|
1163
|
+
@"systemThickMaterialDark" : @(RNSBlurEffectStyleSystemThickMaterialDark),
|
|
1164
|
+
@"systemChromeMaterialDark" : @(RNSBlurEffectStyleSystemChromeMaterialDark),
|
|
1155
1165
|
}];
|
|
1156
1166
|
}
|
|
1157
1167
|
#endif
|
|
@@ -1177,6 +1187,6 @@ RCT_ENUM_CONVERTER(
|
|
|
1177
1187
|
UINavigationItemBackButtonDisplayModeDefault,
|
|
1178
1188
|
integerValue)
|
|
1179
1189
|
|
|
1180
|
-
RCT_ENUM_CONVERTER(
|
|
1190
|
+
RCT_ENUM_CONVERTER(RNSBlurEffectStyle, ([self blurEffectsForIOSVersion]), RNSBlurEffectStyleNone, integerValue)
|
|
1181
1191
|
|
|
1182
1192
|
@end
|