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
package/ios/RNSScreenStack.mm
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
#import "RCTTouchHandler+RNSUtility.h"
|
|
21
21
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
22
22
|
|
|
23
|
+
#import "RNSPercentDrivenInteractiveTransition.h"
|
|
23
24
|
#import "RNSScreen.h"
|
|
24
25
|
#import "RNSScreenStack.h"
|
|
25
26
|
#import "RNSScreenStackAnimator.h"
|
|
@@ -149,9 +150,16 @@ namespace react = facebook::react;
|
|
|
149
150
|
NSMutableArray<RNSScreenView *> *_reactSubviews;
|
|
150
151
|
BOOL _invalidated;
|
|
151
152
|
BOOL _isFullWidthSwiping;
|
|
152
|
-
|
|
153
|
+
RNSPercentDrivenInteractiveTransition *_interactionController;
|
|
153
154
|
__weak RNSScreenStackManager *_manager;
|
|
154
155
|
BOOL _updateScheduled;
|
|
156
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
157
|
+
/// Screens that are subject of `ShadowViewMutation::Type::Delete` mutation
|
|
158
|
+
/// in current transaction. This vector should be populated when we receive notification via
|
|
159
|
+
/// `RCTMountingObserving` protocol, that a transaction will be performed, and should
|
|
160
|
+
/// be cleaned up when we're notified that the transaction has been completed.
|
|
161
|
+
std::vector<__strong RNSScreenView *> _toBeDeletedScreens;
|
|
162
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -673,7 +681,7 @@ namespace react = facebook::react;
|
|
|
673
681
|
NSMutableArray<UIViewController *> *pushControllers = [NSMutableArray new];
|
|
674
682
|
NSMutableArray<UIViewController *> *modalControllers = [NSMutableArray new];
|
|
675
683
|
for (RNSScreenView *screen in _reactSubviews) {
|
|
676
|
-
if (!screen.dismissed && screen.controller != nil) {
|
|
684
|
+
if (!screen.dismissed && screen.controller != nil && screen.activityState != RNSActivityStateInactive) {
|
|
677
685
|
if (pushControllers.count == 0) {
|
|
678
686
|
// first screen on the list needs to be places as "push controller"
|
|
679
687
|
[pushControllers addObject:screen.controller];
|
|
@@ -862,7 +870,7 @@ namespace react = facebook::react;
|
|
|
862
870
|
|
|
863
871
|
switch (gestureRecognizer.state) {
|
|
864
872
|
case UIGestureRecognizerStateBegan: {
|
|
865
|
-
_interactionController = [
|
|
873
|
+
_interactionController = [RNSPercentDrivenInteractiveTransition new];
|
|
866
874
|
[_controller popViewControllerAnimated:YES];
|
|
867
875
|
break;
|
|
868
876
|
}
|
|
@@ -909,7 +917,7 @@ namespace react = facebook::react;
|
|
|
909
917
|
if (_interactionController == nil && fromView.reactSuperview) {
|
|
910
918
|
BOOL shouldCancelDismiss = [self shouldCancelDismissFromView:fromView toView:toView];
|
|
911
919
|
if (shouldCancelDismiss) {
|
|
912
|
-
_interactionController = [
|
|
920
|
+
_interactionController = [RNSPercentDrivenInteractiveTransition new];
|
|
913
921
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
914
922
|
[self->_interactionController cancelInteractiveTransition];
|
|
915
923
|
self->_interactionController = nil;
|
|
@@ -922,6 +930,10 @@ namespace react = facebook::react;
|
|
|
922
930
|
});
|
|
923
931
|
}
|
|
924
932
|
}
|
|
933
|
+
|
|
934
|
+
if (_interactionController != nil) {
|
|
935
|
+
[_interactionController setAnimationController:animationController];
|
|
936
|
+
}
|
|
925
937
|
return _interactionController;
|
|
926
938
|
}
|
|
927
939
|
|
|
@@ -946,7 +958,8 @@ namespace react = facebook::react;
|
|
|
946
958
|
|
|
947
959
|
- (void)markChildUpdated
|
|
948
960
|
{
|
|
949
|
-
//
|
|
961
|
+
// In native stack this should be called only for `preload` purposes.
|
|
962
|
+
[self updateContainer];
|
|
950
963
|
}
|
|
951
964
|
|
|
952
965
|
- (void)didUpdateChildren
|
|
@@ -1103,7 +1116,7 @@ namespace react = facebook::react;
|
|
|
1103
1116
|
{
|
|
1104
1117
|
if (_interactionController == nil) {
|
|
1105
1118
|
_customAnimation = YES;
|
|
1106
|
-
_interactionController = [
|
|
1119
|
+
_interactionController = [RNSPercentDrivenInteractiveTransition new];
|
|
1107
1120
|
[_controller popViewControllerAnimated:YES];
|
|
1108
1121
|
}
|
|
1109
1122
|
}
|
|
@@ -1150,6 +1163,16 @@ namespace react = facebook::react;
|
|
|
1150
1163
|
// `- [RNSScreenStackView mountingTransactionDidMount: withSurfaceTelemetry:]`
|
|
1151
1164
|
}
|
|
1152
1165
|
|
|
1166
|
+
- (nullable RNSScreenView *)childScreenForTag:(react::Tag)tag
|
|
1167
|
+
{
|
|
1168
|
+
for (RNSScreenView *child in _reactSubviews) {
|
|
1169
|
+
if (child.tag == tag) {
|
|
1170
|
+
return child;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
return nil;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1153
1176
|
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
1154
1177
|
{
|
|
1155
1178
|
RNSScreenView *screenChildComponent = (RNSScreenView *)childComponentView;
|
|
@@ -1183,6 +1206,20 @@ namespace react = facebook::react;
|
|
|
1183
1206
|
[screenChildComponent removeFromSuperview];
|
|
1184
1207
|
}
|
|
1185
1208
|
|
|
1209
|
+
- (void)mountingTransactionWillMount:(const facebook::react::MountingTransaction &)transaction
|
|
1210
|
+
withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
|
|
1211
|
+
{
|
|
1212
|
+
for (const auto &mutation : transaction.getMutations()) {
|
|
1213
|
+
if (mutation.type == react::ShadowViewMutation::Delete) {
|
|
1214
|
+
RNSScreenView *_Nullable toBeRemovedChild = [self childScreenForTag:mutation.oldChildShadowView.tag];
|
|
1215
|
+
if (toBeRemovedChild != nil) {
|
|
1216
|
+
[toBeRemovedChild willBeUnmountedInUpcomingTransaction];
|
|
1217
|
+
_toBeDeletedScreens.push_back(toBeRemovedChild);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1186
1223
|
- (void)mountingTransactionDidMount:(const facebook::react::MountingTransaction &)transaction
|
|
1187
1224
|
withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
|
|
1188
1225
|
{
|
|
@@ -1199,6 +1236,21 @@ namespace react = facebook::react;
|
|
|
1199
1236
|
break;
|
|
1200
1237
|
}
|
|
1201
1238
|
}
|
|
1239
|
+
|
|
1240
|
+
if (!self->_toBeDeletedScreens.empty()) {
|
|
1241
|
+
__weak RNSScreenStackView *weakSelf = self;
|
|
1242
|
+
// We want to run after container updates are performed (transitions etc.)
|
|
1243
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1244
|
+
RNSScreenStackView *_Nullable strongSelf = weakSelf;
|
|
1245
|
+
if (strongSelf == nil) {
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1248
|
+
for (RNSScreenView *screenRef : strongSelf->_toBeDeletedScreens) {
|
|
1249
|
+
[screenRef invalidate];
|
|
1250
|
+
}
|
|
1251
|
+
strongSelf->_toBeDeletedScreens.clear();
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1202
1254
|
}
|
|
1203
1255
|
|
|
1204
1256
|
- (void)prepareForRecycle
|
|
@@ -1226,12 +1278,25 @@ namespace react = facebook::react;
|
|
|
1226
1278
|
- (void)invalidate
|
|
1227
1279
|
{
|
|
1228
1280
|
_invalidated = YES;
|
|
1229
|
-
|
|
1281
|
+
[self dismissAllRelatedModals];
|
|
1282
|
+
[_controller willMoveToParentViewController:nil];
|
|
1283
|
+
[_controller removeFromParentViewController];
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
// This method aims to dismiss all modals for which presentation process
|
|
1287
|
+
// has been initiated in this navigation controller, i. e. either a Screen
|
|
1288
|
+
// with modal presentation or foreign modal presented from inside a Screen.
|
|
1289
|
+
- (void)dismissAllRelatedModals
|
|
1290
|
+
{
|
|
1291
|
+
[_controller dismissViewControllerAnimated:NO completion:nil];
|
|
1292
|
+
|
|
1293
|
+
// This loop seems to be excessive. Above message send to `_controller` should
|
|
1294
|
+
// be enough, because system dismisses the controllers recursively,
|
|
1295
|
+
// however better safe than sorry & introduce a regression, thus it is left here.
|
|
1296
|
+
for (UIViewController *controller in [_presentedModals reverseObjectEnumerator]) {
|
|
1230
1297
|
[controller dismissViewControllerAnimated:NO completion:nil];
|
|
1231
1298
|
}
|
|
1232
1299
|
[_presentedModals removeAllObjects];
|
|
1233
|
-
[_controller willMoveToParentViewController:nil];
|
|
1234
|
-
[_controller removeFromParentViewController];
|
|
1235
1300
|
}
|
|
1236
1301
|
|
|
1237
1302
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RNSScreenStackAnimator : NSObject <UIViewControllerAnimatedTransitioning>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/// This property is filled whenever there is an ongoing animation and cleared on animation end.
|
|
6
|
+
@property (nonatomic, strong, nullable, readonly) UIViewPropertyAnimator *inFlightAnimator;
|
|
7
|
+
|
|
8
|
+
- (nonnull instancetype)initWithOperation:(UINavigationControllerOperation)operation;
|
|
9
|
+
|
|
10
|
+
/// In case of interactive / interruptible transition (e.g. swipe back gesture) this method should return
|
|
11
|
+
/// timing parameters expected by animator to be used for animation completion (e.g. when user's
|
|
12
|
+
/// gesture had ended).
|
|
13
|
+
///
|
|
14
|
+
/// @return timing curve provider expected to be used for animation completion or nil,
|
|
15
|
+
/// when there is no interactive transition running.
|
|
16
|
+
- (nullable id<UITimingCurveProvider>)timingParamsForAnimationCompletion;
|
|
17
|
+
|
|
6
18
|
+ (BOOL)isCustomAnimation:(RNSScreenStackAnimation)animation;
|
|
7
19
|
|
|
8
20
|
@end
|