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.
Files changed (210) hide show
  1. package/README.md +4 -1
  2. package/RNScreens.podspec +1 -1
  3. package/android/build.gradle +24 -6
  4. package/android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt +4 -0
  5. package/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.kt +60 -0
  6. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +7 -9
  7. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +12 -4
  8. package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +10 -0
  9. package/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +32 -8
  10. package/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt +36 -15
  11. package/android/src/main/java/com/swmansion/rnscreens/events/HeaderAttachedEvent.kt +24 -0
  12. package/android/src/main/java/com/swmansion/rnscreens/events/HeaderDetachedEvent.kt +24 -0
  13. package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarBlurEvent.kt +24 -0
  14. package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarChangeTextEvent.kt +29 -0
  15. package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarCloseEvent.kt +24 -0
  16. package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarFocusEvent.kt +24 -0
  17. package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarOpenEvent.kt +24 -0
  18. package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarSearchButtonPressEvent.kt +26 -0
  19. package/android/src/main/res/base/anim/rns_standard_accelerate_interpolator.xml +6 -0
  20. package/android/src/main/res/v33/anim-v33/rns_default_enter_in.xml +38 -0
  21. package/android/src/main/res/v33/anim-v33/rns_default_enter_out.xml +38 -0
  22. package/android/src/main/res/v33/anim-v33/rns_default_exit_in.xml +38 -0
  23. package/android/src/main/res/v33/anim-v33/rns_default_exit_out.xml +38 -0
  24. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +15 -0
  25. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +5 -0
  26. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerDelegate.java +3 -0
  27. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerInterface.java +1 -0
  28. package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.h +1 -2
  29. package/ios/RCTImageComponentView+RNSScreenStackHeaderConfig.h +11 -0
  30. package/ios/RCTImageComponentView+RNSScreenStackHeaderConfig.mm +14 -0
  31. package/ios/RNSConvert.h +8 -2
  32. package/ios/RNSConvert.mm +28 -2
  33. package/ios/RNSEnums.h +6 -0
  34. package/ios/RNSFullWindowOverlay.h +5 -5
  35. package/ios/RNSFullWindowOverlay.mm +13 -13
  36. package/ios/RNSScreen.h +14 -6
  37. package/ios/RNSScreen.mm +129 -28
  38. package/ios/RNSScreenContainer.h +2 -2
  39. package/ios/RNSScreenContainer.mm +5 -5
  40. package/ios/RNSScreenNavigationContainer.mm +3 -3
  41. package/ios/RNSScreenStack.h +4 -4
  42. package/ios/RNSScreenStack.mm +62 -23
  43. package/ios/RNSScreenStackHeaderConfig.h +10 -3
  44. package/ios/RNSScreenStackHeaderConfig.mm +138 -81
  45. package/ios/RNSScreenStackHeaderSubview.h +5 -6
  46. package/ios/RNSScreenStackHeaderSubview.mm +20 -11
  47. package/ios/RNSScreenWindowTraits.mm +21 -2
  48. package/ios/RNSSearchBar.h +5 -4
  49. package/ios/RNSSearchBar.mm +87 -12
  50. package/lib/commonjs/TransitionProgressContext.js.map +1 -1
  51. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +0 -5
  52. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
  53. package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +0 -5
  54. package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -1
  55. package/lib/commonjs/fabric/ScreenNativeComponent.js +0 -5
  56. package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
  57. package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +0 -5
  58. package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
  59. package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -8
  60. package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
  61. package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -8
  62. package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
  63. package/lib/commonjs/fabric/ScreenStackNativeComponent.js +0 -5
  64. package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
  65. package/lib/commonjs/fabric/SearchBarNativeComponent.js +7 -7
  66. package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
  67. package/lib/commonjs/index.js +8 -1
  68. package/lib/commonjs/index.js.map +1 -1
  69. package/lib/commonjs/index.native.js +51 -10
  70. package/lib/commonjs/index.native.js.map +1 -1
  71. package/lib/commonjs/native-stack/index.js.map +1 -1
  72. package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +18 -16
  73. package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  74. package/lib/commonjs/native-stack/types.js.map +1 -1
  75. package/lib/commonjs/native-stack/utils/HeaderHeightContext.js.map +1 -1
  76. package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
  77. package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
  78. package/lib/commonjs/native-stack/utils/useBackPressSubscription.js.map +1 -1
  79. package/lib/commonjs/native-stack/utils/useHeaderHeight.js.map +1 -1
  80. package/lib/commonjs/native-stack/views/FontProcessor.js +1 -0
  81. package/lib/commonjs/native-stack/views/FontProcessor.js.map +1 -1
  82. package/lib/commonjs/native-stack/views/HeaderConfig.js +3 -1
  83. package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
  84. package/lib/commonjs/native-stack/views/NativeStackView.js +14 -1
  85. package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
  86. package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
  87. package/lib/commonjs/reanimated/ReanimatedScreen.js.map +1 -1
  88. package/lib/commonjs/reanimated/ReanimatedScreenProvider.js.map +1 -1
  89. package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
  90. package/lib/commonjs/reanimated/index.js.map +1 -1
  91. package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js.map +1 -1
  92. package/lib/commonjs/types.js.map +1 -1
  93. package/lib/commonjs/useTransitionProgress.js.map +1 -1
  94. package/lib/commonjs/utils.js +8 -1
  95. package/lib/commonjs/utils.js.map +1 -1
  96. package/lib/module/fabric/FullWindowOverlayNativeComponent.js +0 -5
  97. package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
  98. package/lib/module/fabric/ScreenContainerNativeComponent.js +0 -5
  99. package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -1
  100. package/lib/module/fabric/ScreenNativeComponent.js +0 -5
  101. package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
  102. package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +0 -5
  103. package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
  104. package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -6
  105. package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
  106. package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -6
  107. package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
  108. package/lib/module/fabric/ScreenStackNativeComponent.js +0 -5
  109. package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
  110. package/lib/module/fabric/SearchBarNativeComponent.js +4 -6
  111. package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
  112. package/lib/module/index.js +2 -2
  113. package/lib/module/index.js.map +1 -1
  114. package/lib/module/index.native.js +53 -11
  115. package/lib/module/index.native.js.map +1 -1
  116. package/lib/module/native-stack/navigators/createNativeStackNavigator.js +18 -16
  117. package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  118. package/lib/module/native-stack/types.js.map +1 -1
  119. package/lib/module/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
  120. package/lib/module/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
  121. package/lib/module/native-stack/utils/useBackPressSubscription.js.map +1 -1
  122. package/lib/module/native-stack/utils/useHeaderHeight.js.map +1 -1
  123. package/lib/module/native-stack/views/FontProcessor.js +1 -0
  124. package/lib/module/native-stack/views/FontProcessor.js.map +1 -1
  125. package/lib/module/native-stack/views/HeaderConfig.js +3 -1
  126. package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
  127. package/lib/module/native-stack/views/NativeStackView.js +15 -1
  128. package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
  129. package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
  130. package/lib/module/reanimated/ReanimatedScreen.js.map +1 -1
  131. package/lib/module/reanimated/ReanimatedScreenProvider.js.map +1 -1
  132. package/lib/module/reanimated/useReanimatedTransitionProgress.js.map +1 -1
  133. package/lib/module/types.js.map +1 -1
  134. package/lib/module/useTransitionProgress.js.map +1 -1
  135. package/lib/module/utils.js +6 -0
  136. package/lib/module/utils.js.map +1 -1
  137. package/lib/typescript/TransitionProgressContext.d.ts +1 -1
  138. package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts +6 -0
  139. package/lib/typescript/fabric/ScreenContainerNativeComponent.d.ts +6 -0
  140. package/lib/typescript/fabric/ScreenNativeComponent.d.ts +62 -0
  141. package/lib/typescript/fabric/ScreenNavigationContainerNativeComponent.d.ts +6 -0
  142. package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +34 -0
  143. package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts +9 -0
  144. package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts +9 -0
  145. package/lib/typescript/fabric/SearchBarNativeComponent.d.ts +46 -0
  146. package/lib/typescript/index.d.ts +3 -3
  147. package/lib/typescript/native-stack/types.d.ts +64 -10
  148. package/lib/typescript/native-stack/utils/SafeAreaProviderCompat.d.ts +1 -1
  149. package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -1
  150. package/lib/typescript/native-stack/views/HeaderConfig.d.ts +1 -1
  151. package/lib/typescript/native-stack/views/NativeStackView.d.ts +1 -1
  152. package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
  153. package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
  154. package/lib/typescript/reanimated/ReanimatedTransitionProgressContext.d.ts +1 -1
  155. package/lib/typescript/types.d.ts +90 -11
  156. package/lib/typescript/useTransitionProgress.d.ts +3 -3
  157. package/lib/typescript/utils.d.ts +1 -0
  158. package/native-stack/README.md +59 -1
  159. package/package.json +11 -14
  160. package/src/fabric/FullWindowOverlayNativeComponent.ts +6 -0
  161. package/src/fabric/ScreenContainerNativeComponent.ts +6 -0
  162. package/src/fabric/ScreenNativeComponent.ts +97 -0
  163. package/src/fabric/ScreenNavigationContainerNativeComponent.ts +9 -0
  164. package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +43 -0
  165. package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +20 -0
  166. package/src/fabric/ScreenStackNativeComponent.ts +12 -0
  167. package/src/fabric/SearchBarNativeComponent.ts +73 -0
  168. package/src/index.native.tsx +109 -14
  169. package/src/index.tsx +5 -3
  170. package/src/native-stack/navigators/createNativeStackNavigator.tsx +23 -19
  171. package/src/native-stack/types.tsx +55 -0
  172. package/src/native-stack/views/FontProcessor.tsx +1 -0
  173. package/src/native-stack/views/HeaderConfig.tsx +3 -1
  174. package/src/native-stack/views/NativeStackView.tsx +14 -2
  175. package/src/types.tsx +84 -2
  176. package/src/utils.ts +6 -0
  177. package/createNativeStackNavigator/README.md +0 -522
  178. package/createNativeStackNavigator/package.json +0 -6
  179. package/lib/commonjs/createNativeStackNavigator.js +0 -374
  180. package/lib/commonjs/createNativeStackNavigator.js.map +0 -1
  181. package/lib/module/createNativeStackNavigator.js +0 -366
  182. package/lib/module/createNativeStackNavigator.js.map +0 -1
  183. package/lib/typescript/createNativeStackNavigator.d.ts +0 -51
  184. package/src/createNativeStackNavigator.tsx +0 -594
  185. package/src/fabric/FullWindowOverlayNativeComponent.js +0 -19
  186. package/src/fabric/ScreenContainerNativeComponent.js +0 -19
  187. package/src/fabric/ScreenNativeComponent.js +0 -97
  188. package/src/fabric/ScreenNavigationContainerNativeComponent.js +0 -19
  189. package/src/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -54
  190. package/src/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -31
  191. package/src/fabric/ScreenStackNativeComponent.js +0 -23
  192. package/src/fabric/SearchBarNativeComponent.js +0 -62
  193. /package/android/src/main/res/{anim → base/anim}/rns_default_enter_in.xml +0 -0
  194. /package/android/src/main/res/{anim → base/anim}/rns_default_enter_out.xml +0 -0
  195. /package/android/src/main/res/{anim → base/anim}/rns_default_exit_in.xml +0 -0
  196. /package/android/src/main/res/{anim → base/anim}/rns_default_exit_out.xml +0 -0
  197. /package/android/src/main/res/{anim → base/anim}/rns_fade_from_bottom.xml +0 -0
  198. /package/android/src/main/res/{anim → base/anim}/rns_fade_in.xml +0 -0
  199. /package/android/src/main/res/{anim → base/anim}/rns_fade_out.xml +0 -0
  200. /package/android/src/main/res/{anim → base/anim}/rns_fade_to_bottom.xml +0 -0
  201. /package/android/src/main/res/{anim → base/anim}/rns_no_animation_20.xml +0 -0
  202. /package/android/src/main/res/{anim → base/anim}/rns_no_animation_250.xml +0 -0
  203. /package/android/src/main/res/{anim → base/anim}/rns_no_animation_350.xml +0 -0
  204. /package/android/src/main/res/{anim → base/anim}/rns_no_animation_medium.xml +0 -0
  205. /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_bottom.xml +0 -0
  206. /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_left.xml +0 -0
  207. /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_right.xml +0 -0
  208. /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_bottom.xml +0 -0
  209. /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_left.xml +0 -0
  210. /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_right.xml +0 -0
@@ -1,4 +1,4 @@
1
- #ifdef RN_FABRIC_ENABLED
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 // RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
98
+ #ifdef RCT_NEW_ARCH_ENABLED
99
99
  UIView *_snapshot;
100
100
  #endif
101
101
  }
102
102
 
103
- #ifdef RN_FABRIC_ENABLED
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 // RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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
- // we need to return the animator when full width swiping even if the animation is not custom,
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
- (_isFullWidthSwiping || [RNSScreenStackAnimator isCustomAnimation:screen.stackAnimation])) {
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 // RN_FABRIC_ENABLED
1055
+ #endif // RCT_NEW_ARCH_ENABLED
1017
1056
 
1018
1057
  @end
1019
1058
 
1020
- #ifdef RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 // RN_FABRIC_ENABLED
1085
+ #endif // RCT_NEW_ARCH_ENABLED
1047
1086
 
1048
1087
  - (void)invalidate
1049
1088
  {
@@ -1,4 +1,4 @@
1
- #ifdef RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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 RN_FABRIC_ENABLED
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;