react-native-screens 3.20.0 → 3.21.1
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 +4 -1
- package/RNScreens.podspec +1 -1
- package/android/build.gradle +24 -6
- package/android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt +4 -0
- package/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.kt +60 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +7 -9
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +12 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +10 -0
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +32 -8
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt +36 -15
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderAttachedEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderDetachedEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarBlurEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarChangeTextEvent.kt +29 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarCloseEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarFocusEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarOpenEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarSearchButtonPressEvent.kt +26 -0
- package/android/src/main/res/base/anim/rns_standard_accelerate_interpolator.xml +6 -0
- package/android/src/main/res/v33/anim-v33/rns_default_enter_in.xml +38 -0
- package/android/src/main/res/v33/anim-v33/rns_default_enter_out.xml +38 -0
- package/android/src/main/res/v33/anim-v33/rns_default_exit_in.xml +38 -0
- package/android/src/main/res/v33/anim-v33/rns_default_exit_out.xml +38 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +15 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +5 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerDelegate.java +3 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerInterface.java +1 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.h +1 -2
- package/ios/RCTImageComponentView+RNSScreenStackHeaderConfig.h +11 -0
- package/ios/RCTImageComponentView+RNSScreenStackHeaderConfig.mm +14 -0
- package/ios/RNSConvert.h +8 -2
- package/ios/RNSConvert.mm +28 -2
- package/ios/RNSEnums.h +6 -0
- package/ios/RNSFullWindowOverlay.h +5 -5
- package/ios/RNSFullWindowOverlay.mm +13 -13
- package/ios/RNSScreen.h +14 -6
- package/ios/RNSScreen.mm +129 -28
- package/ios/RNSScreenContainer.h +2 -2
- package/ios/RNSScreenContainer.mm +5 -5
- package/ios/RNSScreenNavigationContainer.mm +3 -3
- package/ios/RNSScreenStack.h +4 -4
- package/ios/RNSScreenStack.mm +62 -23
- package/ios/RNSScreenStackHeaderConfig.h +10 -3
- package/ios/RNSScreenStackHeaderConfig.mm +138 -81
- package/ios/RNSScreenStackHeaderSubview.h +5 -6
- package/ios/RNSScreenStackHeaderSubview.mm +20 -11
- package/ios/RNSScreenWindowTraits.mm +21 -2
- package/ios/RNSSearchBar.h +5 -4
- package/ios/RNSSearchBar.mm +87 -12
- package/lib/commonjs/TransitionProgressContext.js.map +1 -1
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +0 -5
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -8
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -8
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +7 -7
- package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/commonjs/index.js +8 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.native.js +51 -10
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/native-stack/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +18 -16
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/types.js.map +1 -1
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/views/FontProcessor.js +1 -0
- package/lib/commonjs/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js +3 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +14 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/commonjs/reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useTransitionProgress.js.map +1 -1
- package/lib/commonjs/utils.js +8 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js +0 -5
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenContainerNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -6
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -6
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/module/fabric/SearchBarNativeComponent.js +4 -6
- package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +53 -11
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +18 -16
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/native-stack/types.js.map +1 -1
- package/lib/module/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/module/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/views/FontProcessor.js +1 -0
- package/lib/module/native-stack/views/FontProcessor.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 +15 -1
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/module/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/useTransitionProgress.js.map +1 -1
- package/lib/module/utils.js +6 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/TransitionProgressContext.d.ts +1 -1
- package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts +6 -0
- package/lib/typescript/fabric/ScreenContainerNativeComponent.d.ts +6 -0
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +62 -0
- package/lib/typescript/fabric/ScreenNavigationContainerNativeComponent.d.ts +6 -0
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +34 -0
- package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts +9 -0
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts +9 -0
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts +46 -0
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/native-stack/types.d.ts +64 -10
- package/lib/typescript/native-stack/utils/SafeAreaProviderCompat.d.ts +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedTransitionProgressContext.d.ts +1 -1
- package/lib/typescript/types.d.ts +90 -11
- package/lib/typescript/useTransitionProgress.d.ts +3 -3
- package/lib/typescript/utils.d.ts +1 -0
- package/native-stack/README.md +59 -1
- package/package.json +11 -14
- package/src/fabric/FullWindowOverlayNativeComponent.ts +6 -0
- package/src/fabric/ScreenContainerNativeComponent.ts +6 -0
- package/src/fabric/ScreenNativeComponent.ts +97 -0
- package/src/fabric/ScreenNavigationContainerNativeComponent.ts +9 -0
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +43 -0
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +20 -0
- package/src/fabric/ScreenStackNativeComponent.ts +12 -0
- package/src/fabric/SearchBarNativeComponent.ts +73 -0
- package/src/index.native.tsx +109 -14
- package/src/index.tsx +5 -3
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +23 -19
- package/src/native-stack/types.tsx +55 -0
- package/src/native-stack/views/FontProcessor.tsx +1 -0
- package/src/native-stack/views/HeaderConfig.tsx +3 -1
- package/src/native-stack/views/NativeStackView.tsx +14 -2
- package/src/types.tsx +84 -2
- package/src/utils.ts +6 -0
- package/createNativeStackNavigator/README.md +0 -522
- package/createNativeStackNavigator/package.json +0 -6
- package/lib/commonjs/createNativeStackNavigator.js +0 -374
- package/lib/commonjs/createNativeStackNavigator.js.map +0 -1
- package/lib/module/createNativeStackNavigator.js +0 -366
- package/lib/module/createNativeStackNavigator.js.map +0 -1
- package/lib/typescript/createNativeStackNavigator.d.ts +0 -51
- package/src/createNativeStackNavigator.tsx +0 -594
- package/src/fabric/FullWindowOverlayNativeComponent.js +0 -19
- package/src/fabric/ScreenContainerNativeComponent.js +0 -19
- package/src/fabric/ScreenNativeComponent.js +0 -97
- package/src/fabric/ScreenNavigationContainerNativeComponent.js +0 -19
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -54
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -31
- package/src/fabric/ScreenStackNativeComponent.js +0 -23
- package/src/fabric/SearchBarNativeComponent.js +0 -62
- /package/android/src/main/res/{anim → base/anim}/rns_default_enter_in.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_default_enter_out.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_default_exit_in.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_default_exit_out.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_from_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_in.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_out.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_to_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_20.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_250.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_350.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_medium.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_left.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_right.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_left.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_right.xml +0 -0
package/ios/RNSScreenStack.mm
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#ifdef
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
2
|
#import <React/RCTMountingTransactionObserving.h>
|
|
3
3
|
#import <React/RCTSurfaceTouchHandler.h>
|
|
4
4
|
#import <React/UIView+React.h>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
#import <React/RCTTouchHandler.h>
|
|
17
17
|
#import <React/RCTUIManager.h>
|
|
18
18
|
#import <React/RCTUIManagerUtils.h>
|
|
19
|
-
#endif //
|
|
19
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
20
20
|
|
|
21
21
|
#import "RNSScreen.h"
|
|
22
22
|
#import "RNSScreenStack.h"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
UIAdaptivePresentationControllerDelegate,
|
|
30
30
|
UIGestureRecognizerDelegate,
|
|
31
31
|
UIViewControllerTransitioningDelegate
|
|
32
|
-
#ifdef
|
|
32
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
33
33
|
,
|
|
34
34
|
RCTMountingTransactionObserving
|
|
35
35
|
#endif
|
|
@@ -95,12 +95,12 @@
|
|
|
95
95
|
BOOL _hasLayout;
|
|
96
96
|
__weak RNSScreenStackManager *_manager;
|
|
97
97
|
BOOL _updateScheduled;
|
|
98
|
-
#ifdef
|
|
98
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
99
99
|
UIView *_snapshot;
|
|
100
100
|
#endif
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
#ifdef
|
|
103
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
104
104
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
105
105
|
{
|
|
106
106
|
if (self = [super initWithFrame:frame]) {
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
|
|
112
112
|
return self;
|
|
113
113
|
}
|
|
114
|
-
#endif //
|
|
114
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
115
115
|
|
|
116
116
|
- (instancetype)initWithManager:(RNSScreenStackManager *)manager
|
|
117
117
|
{
|
|
@@ -140,11 +140,26 @@
|
|
|
140
140
|
[_controller setViewControllers:@[ [UIViewController new] ]];
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
#pragma mark - helper methods
|
|
144
|
+
|
|
145
|
+
- (BOOL)shouldCancelDismissFromView:(RNSScreenView *)fromView toView:(RNSScreenView *)toView
|
|
146
|
+
{
|
|
147
|
+
int fromIndex = (int)[_reactSubviews indexOfObject:fromView];
|
|
148
|
+
int toIndex = (int)[_reactSubviews indexOfObject:toView];
|
|
149
|
+
for (int i = fromIndex; i > toIndex; i--) {
|
|
150
|
+
if (_reactSubviews[i].preventNativeDismiss) {
|
|
151
|
+
return YES;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return NO;
|
|
156
|
+
}
|
|
157
|
+
|
|
143
158
|
#pragma mark - Common
|
|
144
159
|
|
|
145
160
|
- (void)emitOnFinishTransitioningEvent
|
|
146
161
|
{
|
|
147
|
-
#ifdef
|
|
162
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
148
163
|
if (_eventEmitter != nullptr) {
|
|
149
164
|
std::dynamic_pointer_cast<const facebook::react::RNSScreenStackEventEmitter>(_eventEmitter)
|
|
150
165
|
->onFinishTransitioning(facebook::react::RNSScreenStackEventEmitter::OnFinishTransitioning{});
|
|
@@ -161,7 +176,7 @@
|
|
|
161
176
|
animated:(BOOL)animated
|
|
162
177
|
{
|
|
163
178
|
UIView *view = viewController.view;
|
|
164
|
-
#ifdef
|
|
179
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
165
180
|
if (![view isKindOfClass:[RNSScreenView class]]) {
|
|
166
181
|
// if the current view is a snapshot, config was already removed so we don't trigger the method
|
|
167
182
|
return;
|
|
@@ -188,7 +203,7 @@
|
|
|
188
203
|
[_presentedModals removeObject:presentationController.presentedViewController];
|
|
189
204
|
|
|
190
205
|
_updatingModals = NO;
|
|
191
|
-
#ifdef
|
|
206
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
192
207
|
[self emitOnFinishTransitioningEvent];
|
|
193
208
|
#else
|
|
194
209
|
// we double check if there are no new controllers pending to be presented since someone could
|
|
@@ -215,7 +230,7 @@
|
|
|
215
230
|
- (void)didMoveToWindow
|
|
216
231
|
{
|
|
217
232
|
[super didMoveToWindow];
|
|
218
|
-
#ifdef
|
|
233
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
219
234
|
// for handling nested stacks
|
|
220
235
|
[self maybeAddToParentAndUpdateContainer];
|
|
221
236
|
#else
|
|
@@ -231,7 +246,7 @@
|
|
|
231
246
|
- (void)maybeAddToParentAndUpdateContainer
|
|
232
247
|
{
|
|
233
248
|
BOOL wasScreenMounted = _controller.parentViewController != nil;
|
|
234
|
-
#ifdef
|
|
249
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
235
250
|
BOOL isScreenReadyForShowing = self.window;
|
|
236
251
|
#else
|
|
237
252
|
BOOL isScreenReadyForShowing = self.window && _hasLayout;
|
|
@@ -452,7 +467,7 @@
|
|
|
452
467
|
}
|
|
453
468
|
|
|
454
469
|
UIViewController *top = controllers.lastObject;
|
|
455
|
-
#ifdef
|
|
470
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
456
471
|
UIViewController *previousTop = _controller.topViewController;
|
|
457
472
|
#else
|
|
458
473
|
UIViewController *previousTop = _controller.viewControllers.lastObject;
|
|
@@ -474,7 +489,7 @@
|
|
|
474
489
|
if (![_controller.viewControllers containsObject:top] &&
|
|
475
490
|
((RNSScreenView *)top.view).replaceAnimation == RNSScreenReplaceAnimationPush) {
|
|
476
491
|
// setting new controllers with animation does `push` animation by default
|
|
477
|
-
#ifdef
|
|
492
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
478
493
|
auto screenController = (RNSScreen *)top;
|
|
479
494
|
[screenController resetViewToScreen];
|
|
480
495
|
#endif
|
|
@@ -495,7 +510,7 @@
|
|
|
495
510
|
NSMutableArray *newControllers = [NSMutableArray arrayWithArray:controllers];
|
|
496
511
|
[newControllers removeLastObject];
|
|
497
512
|
[_controller setViewControllers:newControllers animated:NO];
|
|
498
|
-
#ifdef
|
|
513
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
499
514
|
auto screenController = (RNSScreen *)top;
|
|
500
515
|
[screenController resetViewToScreen];
|
|
501
516
|
#endif
|
|
@@ -542,7 +557,7 @@
|
|
|
542
557
|
|
|
543
558
|
- (void)dismissOnReload
|
|
544
559
|
{
|
|
545
|
-
#ifdef
|
|
560
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
546
561
|
if ([_controller.visibleViewController isKindOfClass:[RNSScreen class]]) {
|
|
547
562
|
[(RNSScreen *)_controller.visibleViewController resetViewToScreen];
|
|
548
563
|
}
|
|
@@ -566,10 +581,14 @@
|
|
|
566
581
|
} else if (operation == UINavigationControllerOperationPop) {
|
|
567
582
|
screen = ((RNSScreen *)fromVC).screenView;
|
|
568
583
|
}
|
|
584
|
+
BOOL shouldCancelDismiss = [self shouldCancelDismissFromView:(RNSScreenView *)fromVC.view
|
|
585
|
+
toView:(RNSScreenView *)toVC.view];
|
|
569
586
|
if (screen != nil &&
|
|
570
|
-
//
|
|
587
|
+
// when preventing the native dismiss with back button, we have to return the animator.
|
|
588
|
+
// Also, we need to return the animator when full width swiping even if the animation is not custom,
|
|
571
589
|
// otherwise the screen will be just popped immediately due to no animation
|
|
572
|
-
(
|
|
590
|
+
((operation == UINavigationControllerOperationPop && shouldCancelDismiss) || _isFullWidthSwiping ||
|
|
591
|
+
[RNSScreenStackAnimator isCustomAnimation:screen.stackAnimation])) {
|
|
573
592
|
return [[RNSScreenStackAnimator alloc] initWithOperation:operation];
|
|
574
593
|
}
|
|
575
594
|
return nil;
|
|
@@ -585,7 +604,7 @@
|
|
|
585
604
|
while (parent != nil && ![parent respondsToSelector:@selector(touchHandler)])
|
|
586
605
|
parent = parent.superview;
|
|
587
606
|
if (parent != nil) {
|
|
588
|
-
#ifdef
|
|
607
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
589
608
|
RCTSurfaceTouchHandler *touchHandler = [parent performSelector:@selector(touchHandler)];
|
|
590
609
|
#else
|
|
591
610
|
RCTTouchHandler *touchHandler = [parent performSelector:@selector(touchHandler)];
|
|
@@ -727,6 +746,26 @@
|
|
|
727
746
|
interactionControllerForAnimationController:
|
|
728
747
|
(id<UIViewControllerAnimatedTransitioning>)animationController
|
|
729
748
|
{
|
|
749
|
+
RNSScreenView *fromView = [_controller.transitionCoordinator viewForKey:UITransitionContextFromViewKey];
|
|
750
|
+
RNSScreenView *toView = [_controller.transitionCoordinator viewForKey:UITransitionContextToViewKey];
|
|
751
|
+
// we can intercept clicking back button here, we check reactSuperview since this method also fires when
|
|
752
|
+
// navigating back from JS
|
|
753
|
+
if (_interactionController == nil && fromView.reactSuperview) {
|
|
754
|
+
BOOL shouldCancelDismiss = [self shouldCancelDismissFromView:fromView toView:toView];
|
|
755
|
+
if (shouldCancelDismiss) {
|
|
756
|
+
_interactionController = [UIPercentDrivenInteractiveTransition new];
|
|
757
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
758
|
+
[self->_interactionController cancelInteractiveTransition];
|
|
759
|
+
self->_interactionController = nil;
|
|
760
|
+
int fromIndex = (int)[self->_reactSubviews indexOfObject:fromView];
|
|
761
|
+
int toIndex = (int)[self->_reactSubviews indexOfObject:toView];
|
|
762
|
+
int indexDiff = fromIndex - toIndex;
|
|
763
|
+
int dismissCount = indexDiff > 0 ? indexDiff : 1;
|
|
764
|
+
[self updateContainer];
|
|
765
|
+
[fromView notifyDismissCancelledWithDismissCount:dismissCount];
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
}
|
|
730
769
|
return _interactionController;
|
|
731
770
|
}
|
|
732
771
|
|
|
@@ -901,7 +940,7 @@
|
|
|
901
940
|
});
|
|
902
941
|
}
|
|
903
942
|
|
|
904
|
-
#ifdef
|
|
943
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
905
944
|
#pragma mark - Fabric specific
|
|
906
945
|
|
|
907
946
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
@@ -1013,11 +1052,11 @@
|
|
|
1013
1052
|
[_controller removeFromParentViewController];
|
|
1014
1053
|
}
|
|
1015
1054
|
|
|
1016
|
-
#endif //
|
|
1055
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
1017
1056
|
|
|
1018
1057
|
@end
|
|
1019
1058
|
|
|
1020
|
-
#ifdef
|
|
1059
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
1021
1060
|
Class<RCTComponentViewProtocol> RNSScreenStackCls(void)
|
|
1022
1061
|
{
|
|
1023
1062
|
return RNSScreenStackView.class;
|
|
@@ -1032,7 +1071,7 @@ RCT_EXPORT_MODULE()
|
|
|
1032
1071
|
|
|
1033
1072
|
RCT_EXPORT_VIEW_PROPERTY(onFinishTransitioning, RCTDirectEventBlock);
|
|
1034
1073
|
|
|
1035
|
-
#ifdef
|
|
1074
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
1036
1075
|
#else
|
|
1037
1076
|
- (UIView *)view
|
|
1038
1077
|
{
|
|
@@ -1043,7 +1082,7 @@ RCT_EXPORT_VIEW_PROPERTY(onFinishTransitioning, RCTDirectEventBlock);
|
|
|
1043
1082
|
[_stacks addPointer:(__bridge void *)view];
|
|
1044
1083
|
return view;
|
|
1045
1084
|
}
|
|
1046
|
-
#endif //
|
|
1085
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
1047
1086
|
|
|
1048
1087
|
- (void)invalidate
|
|
1049
1088
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#ifdef
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
2
|
#import <React/RCTViewComponentView.h>
|
|
3
3
|
#else
|
|
4
4
|
#import <React/RCTViewManager.h>
|
|
@@ -9,8 +9,14 @@
|
|
|
9
9
|
#import "RNSScreenStackHeaderSubview.h"
|
|
10
10
|
#import "RNSSearchBar.h"
|
|
11
11
|
|
|
12
|
+
@interface NSString (RNSStringUtil)
|
|
13
|
+
|
|
14
|
+
+ (BOOL)RNSisBlank:(NSString *)string;
|
|
15
|
+
|
|
16
|
+
@end
|
|
17
|
+
|
|
12
18
|
@interface RNSScreenStackHeaderConfig :
|
|
13
|
-
#ifdef
|
|
19
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
14
20
|
RCTViewComponentView
|
|
15
21
|
#else
|
|
16
22
|
UIView
|
|
@@ -18,7 +24,7 @@
|
|
|
18
24
|
|
|
19
25
|
@property (nonatomic, weak) RNSScreenView *screenView;
|
|
20
26
|
|
|
21
|
-
#ifdef
|
|
27
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
22
28
|
@property (nonatomic) BOOL show;
|
|
23
29
|
#else
|
|
24
30
|
@property (nonatomic) UIBlurEffectStyle blurEffect;
|
|
@@ -33,6 +39,7 @@
|
|
|
33
39
|
@property (nonatomic, retain) NSString *backTitle;
|
|
34
40
|
@property (nonatomic, retain) NSString *backTitleFontFamily;
|
|
35
41
|
@property (nonatomic, retain) NSNumber *backTitleFontSize;
|
|
42
|
+
@property (nonatomic, getter=isBackTitleVisible) BOOL backTitleVisible;
|
|
36
43
|
@property (nonatomic, retain) UIColor *backgroundColor;
|
|
37
44
|
@property (nonatomic, retain) UIColor *color;
|
|
38
45
|
@property (nonatomic) BOOL largeTitle;
|