react-native-screens 4.11.0-beta.0 → 4.11.0-beta.2

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 (74) hide show
  1. package/RNScreens.podspec +3 -1
  2. package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +18 -12
  3. package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +48 -97
  4. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +4 -124
  5. package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetDelegate.kt +2 -2
  6. package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetUtils.kt +23 -0
  7. package/android/src/main/java/com/swmansion/rnscreens/stack/anim/ScreensAnimation.kt +18 -0
  8. package/android/src/main/java/com/swmansion/rnscreens/stack/views/ChildDrawingOrderStrategyImpl.kt +48 -0
  9. package/android/src/main/java/com/swmansion/rnscreens/stack/views/ChildrenDrawingOrderStrategy.kt +24 -0
  10. package/android/src/main/java/com/swmansion/rnscreens/stack/views/ScreensCoordinatorLayout.kt +99 -0
  11. package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +1 -2
  12. package/ios/RNSConvert.mm +44 -47
  13. package/ios/RNSFullWindowOverlay.h +2 -0
  14. package/ios/RNSFullWindowOverlay.mm +32 -8
  15. package/ios/RNSScreen.mm +20 -34
  16. package/ios/RNSScreenStack.mm +6 -8
  17. package/ios/RNSScreenStackHeaderConfig.mm +120 -223
  18. package/ios/RNSScreenWindowTraits.mm +19 -37
  19. package/ios/RNSSearchBar.mm +15 -24
  20. package/lib/commonjs/components/FullWindowOverlay.js +2 -1
  21. package/lib/commonjs/components/FullWindowOverlay.js.map +1 -1
  22. package/lib/commonjs/components/ScreenContentWrapper.windows.js +10 -0
  23. package/lib/commonjs/components/ScreenContentWrapper.windows.js.map +1 -0
  24. package/lib/commonjs/components/ScreenFooter.windows.js +11 -0
  25. package/lib/commonjs/components/ScreenFooter.windows.js.map +1 -0
  26. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +1 -0
  27. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
  28. package/lib/module/components/FullWindowOverlay.js +2 -1
  29. package/lib/module/components/FullWindowOverlay.js.map +1 -1
  30. package/lib/module/components/ScreenContentWrapper.windows.js +4 -0
  31. package/lib/module/components/ScreenContentWrapper.windows.js.map +1 -0
  32. package/lib/module/components/ScreenFooter.windows.js +6 -0
  33. package/lib/module/components/ScreenFooter.windows.js.map +1 -0
  34. package/lib/module/fabric/FullWindowOverlayNativeComponent.js +3 -0
  35. package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
  36. package/lib/typescript/components/FullWindowOverlay.d.ts +4 -2
  37. package/lib/typescript/components/FullWindowOverlay.d.ts.map +1 -1
  38. package/lib/typescript/components/ScreenContentWrapper.windows.d.ts +4 -0
  39. package/lib/typescript/components/ScreenContentWrapper.windows.d.ts.map +1 -0
  40. package/lib/typescript/components/ScreenFooter.windows.d.ts +6 -0
  41. package/lib/typescript/components/ScreenFooter.windows.d.ts.map +1 -0
  42. package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts +3 -1
  43. package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts.map +1 -1
  44. package/lib/typescript/native-stack/types.d.ts +1 -1
  45. package/lib/typescript/types.d.ts +2 -2
  46. package/native-stack/README.md +2 -2
  47. package/package.json +1 -1
  48. package/src/components/FullWindowOverlay.tsx +14 -3
  49. package/src/components/ScreenContentWrapper.windows.tsx +5 -0
  50. package/src/components/ScreenFooter.windows.tsx +7 -0
  51. package/src/fabric/FullWindowOverlayNativeComponent.ts +5 -1
  52. package/src/native-stack/types.tsx +1 -1
  53. package/src/types.tsx +2 -2
  54. package/windows/RNScreens/ModalScreenViewManager.cpp +22 -0
  55. package/windows/RNScreens/ModalScreenViewManager.h +13 -0
  56. package/windows/RNScreens/RNScreens.vcxproj +11 -1
  57. package/windows/RNScreens/RNScreens.vcxproj.filters +10 -0
  58. package/windows/RNScreens/ReactPackageProvider.cpp +18 -0
  59. package/windows/RNScreens/Screen.cpp +128 -122
  60. package/windows/RNScreens/Screen.h +6 -2
  61. package/windows/RNScreens/ScreenStackHeaderConfig.cpp +25 -1
  62. package/windows/RNScreens/ScreenStackHeaderConfig.h +10 -1
  63. package/windows/RNScreens/ScreenStackHeaderConfigViewManager.cpp +42 -1
  64. package/windows/RNScreens/ScreenStackHeaderConfigViewManager.h +15 -0
  65. package/windows/RNScreens/ScreenStackHeaderSubview.cpp +43 -0
  66. package/windows/RNScreens/ScreenStackHeaderSubview.h +24 -0
  67. package/windows/RNScreens/ScreenStackHeaderSubviewViewManager.cpp +129 -0
  68. package/windows/RNScreens/ScreenStackHeaderSubviewViewManager.h +77 -0
  69. package/windows/RNScreens/ScreenViewManager.cpp +45 -16
  70. package/windows/RNScreens/ScreenViewManager.h +1 -1
  71. package/windows/RNScreens/SearchBar.cpp +19 -0
  72. package/windows/RNScreens/SearchBar.h +14 -0
  73. package/windows/RNScreens/SearchBarViewManager.cpp +88 -0
  74. package/windows/RNScreens/SearchBarViewManager.h +62 -0
@@ -0,0 +1,99 @@
1
+ package com.swmansion.rnscreens.stack.views
2
+
3
+ import android.content.Context
4
+ import android.view.WindowInsets
5
+ import android.view.animation.Animation
6
+ import android.view.animation.AnimationSet
7
+ import androidx.coordinatorlayout.widget.CoordinatorLayout
8
+ import com.facebook.react.uimanager.ReactPointerEventsView
9
+ import com.swmansion.rnscreens.PointerEventsBoxNoneImpl
10
+ import com.swmansion.rnscreens.ScreenStackFragment
11
+ import com.swmansion.rnscreens.bottomsheet.usesFormSheetPresentation
12
+ import com.swmansion.rnscreens.stack.anim.ScreensAnimation
13
+
14
+ internal class ScreensCoordinatorLayout(
15
+ context: Context,
16
+ internal val fragment: ScreenStackFragment,
17
+ private val pointerEventsImpl: ReactPointerEventsView,
18
+ ) : CoordinatorLayout(context),
19
+ ReactPointerEventsView by pointerEventsImpl {
20
+ constructor(context: Context, fragment: ScreenStackFragment) : this(
21
+ context,
22
+ fragment,
23
+ PointerEventsBoxNoneImpl(),
24
+ )
25
+
26
+ override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets = super.onApplyWindowInsets(insets)
27
+
28
+ private val animationListener: Animation.AnimationListener =
29
+ object : Animation.AnimationListener {
30
+ override fun onAnimationStart(animation: Animation) {
31
+ fragment.onViewAnimationStart()
32
+ }
33
+
34
+ override fun onAnimationEnd(animation: Animation) {
35
+ fragment.onViewAnimationEnd()
36
+ }
37
+
38
+ override fun onAnimationRepeat(animation: Animation) {}
39
+ }
40
+
41
+ override fun startAnimation(animation: Animation) {
42
+ // For some reason View##onAnimationEnd doesn't get called for
43
+ // exit transitions so we explicitly attach animation listener.
44
+ // We also have some animations that are an AnimationSet, so we don't wrap them
45
+ // in another set since it causes some visual glitches when going forward.
46
+ // We also set the listener only when going forward, since when going back,
47
+ // there is already a listener for dismiss action added, which would be overridden
48
+ // and also this is not necessary when going back since the lifecycle methods
49
+ // are correctly dispatched then.
50
+ // We also add fakeAnimation to the set of animations, which sends the progress of animation
51
+ val fakeAnimation = ScreensAnimation(fragment).apply { duration = animation.duration }
52
+
53
+ if (animation is AnimationSet && !fragment.isRemoving) {
54
+ animation
55
+ .apply {
56
+ addAnimation(fakeAnimation)
57
+ setAnimationListener(animationListener)
58
+ }.also {
59
+ super.startAnimation(it)
60
+ }
61
+ } else {
62
+ AnimationSet(true)
63
+ .apply {
64
+ addAnimation(animation)
65
+ addAnimation(fakeAnimation)
66
+ setAnimationListener(animationListener)
67
+ }.also {
68
+ super.startAnimation(it)
69
+ }
70
+ }
71
+ }
72
+
73
+ /**
74
+ * This method implements a workaround for RN's autoFocus functionality. Because of the way
75
+ * autoFocus is implemented it dismisses soft keyboard in fragment transition
76
+ * due to change of visibility of the view at the start of the transition. Here we override the
77
+ * call to `clearFocus` when the visibility of view is `INVISIBLE` since `clearFocus` triggers the
78
+ * hiding of the keyboard in `ReactEditText.java`.
79
+ */
80
+ override fun clearFocus() {
81
+ if (visibility != INVISIBLE) {
82
+ super.clearFocus()
83
+ }
84
+ }
85
+
86
+ override fun onLayout(
87
+ changed: Boolean,
88
+ l: Int,
89
+ t: Int,
90
+ r: Int,
91
+ b: Int,
92
+ ) {
93
+ super.onLayout(changed, l, t, r, b)
94
+
95
+ if (fragment.screen.usesFormSheetPresentation()) {
96
+ fragment.screen.onBottomSheetBehaviorDidLayout(changed)
97
+ }
98
+ }
99
+ }
@@ -11,8 +11,7 @@ extern const char RNSScreenComponentName[] = "RNSScreen";
11
11
  Point RNSScreenShadowNode::getContentOriginOffset(
12
12
  bool /*includeTransform*/) const {
13
13
  auto stateData = getStateData();
14
- auto contentOffset = stateData.contentOffset;
15
- return {contentOffset.x, contentOffset.y};
14
+ return stateData.contentOffset;
16
15
  }
17
16
 
18
17
  std::optional<std::reference_wrapper<const ShadowNode::Shared>>
package/ios/RNSConvert.mm CHANGED
@@ -195,53 +195,50 @@
195
195
  + (RNSBlurEffectStyle)RNSBlurEffectStyleFromCppEquivalent:(react::RNSScreenStackHeaderConfigBlurEffect)blurEffect
196
196
  {
197
197
  using enum react::RNSScreenStackHeaderConfigBlurEffect;
198
- #if !TARGET_OS_TV && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
199
- __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
200
- if (@available(iOS 13.0, *)) {
201
- switch (blurEffect) {
202
- case None:
203
- return RNSBlurEffectStyleNone;
204
- case ExtraLight:
205
- return RNSBlurEffectStyleExtraLight;
206
- case Light:
207
- return RNSBlurEffectStyleLight;
208
- case Dark:
209
- return RNSBlurEffectStyleDark;
210
- case Regular:
211
- return RNSBlurEffectStyleRegular;
212
- case Prominent:
213
- return RNSBlurEffectStyleProminent;
214
- case SystemUltraThinMaterial:
215
- return RNSBlurEffectStyleSystemUltraThinMaterial;
216
- case SystemThinMaterial:
217
- return RNSBlurEffectStyleSystemThinMaterial;
218
- case SystemMaterial:
219
- return RNSBlurEffectStyleSystemMaterial;
220
- case SystemThickMaterial:
221
- return RNSBlurEffectStyleSystemThickMaterial;
222
- case SystemChromeMaterial:
223
- return RNSBlurEffectStyleSystemChromeMaterial;
224
- case SystemUltraThinMaterialLight:
225
- return RNSBlurEffectStyleSystemUltraThinMaterialLight;
226
- case SystemThinMaterialLight:
227
- return RNSBlurEffectStyleSystemThinMaterialLight;
228
- case SystemMaterialLight:
229
- return RNSBlurEffectStyleSystemMaterialLight;
230
- case SystemThickMaterialLight:
231
- return RNSBlurEffectStyleSystemThickMaterialLight;
232
- case SystemChromeMaterialLight:
233
- return RNSBlurEffectStyleSystemChromeMaterialLight;
234
- case SystemUltraThinMaterialDark:
235
- return RNSBlurEffectStyleSystemUltraThinMaterialDark;
236
- case SystemThinMaterialDark:
237
- return RNSBlurEffectStyleSystemThinMaterialDark;
238
- case SystemMaterialDark:
239
- return RNSBlurEffectStyleSystemMaterialDark;
240
- case SystemThickMaterialDark:
241
- return RNSBlurEffectStyleSystemThickMaterialDark;
242
- case SystemChromeMaterialDark:
243
- return RNSBlurEffectStyleSystemChromeMaterialDark;
244
- }
198
+ #if !TARGET_OS_TV
199
+ switch (blurEffect) {
200
+ case None:
201
+ return RNSBlurEffectStyleNone;
202
+ case ExtraLight:
203
+ return RNSBlurEffectStyleExtraLight;
204
+ case Light:
205
+ return RNSBlurEffectStyleLight;
206
+ case Dark:
207
+ return RNSBlurEffectStyleDark;
208
+ case Regular:
209
+ return RNSBlurEffectStyleRegular;
210
+ case Prominent:
211
+ return RNSBlurEffectStyleProminent;
212
+ case SystemUltraThinMaterial:
213
+ return RNSBlurEffectStyleSystemUltraThinMaterial;
214
+ case SystemThinMaterial:
215
+ return RNSBlurEffectStyleSystemThinMaterial;
216
+ case SystemMaterial:
217
+ return RNSBlurEffectStyleSystemMaterial;
218
+ case SystemThickMaterial:
219
+ return RNSBlurEffectStyleSystemThickMaterial;
220
+ case SystemChromeMaterial:
221
+ return RNSBlurEffectStyleSystemChromeMaterial;
222
+ case SystemUltraThinMaterialLight:
223
+ return RNSBlurEffectStyleSystemUltraThinMaterialLight;
224
+ case SystemThinMaterialLight:
225
+ return RNSBlurEffectStyleSystemThinMaterialLight;
226
+ case SystemMaterialLight:
227
+ return RNSBlurEffectStyleSystemMaterialLight;
228
+ case SystemThickMaterialLight:
229
+ return RNSBlurEffectStyleSystemThickMaterialLight;
230
+ case SystemChromeMaterialLight:
231
+ return RNSBlurEffectStyleSystemChromeMaterialLight;
232
+ case SystemUltraThinMaterialDark:
233
+ return RNSBlurEffectStyleSystemUltraThinMaterialDark;
234
+ case SystemThinMaterialDark:
235
+ return RNSBlurEffectStyleSystemThinMaterialDark;
236
+ case SystemMaterialDark:
237
+ return RNSBlurEffectStyleSystemMaterialDark;
238
+ case SystemThickMaterialDark:
239
+ return RNSBlurEffectStyleSystemThickMaterialDark;
240
+ case SystemChromeMaterialDark:
241
+ return RNSBlurEffectStyleSystemChromeMaterialDark;
245
242
  }
246
243
  #endif
247
244
 
@@ -26,6 +26,8 @@ namespace react = facebook::react;
26
26
  RCTView <RCTInvalidating>
27
27
  #endif // RCT_NEW_ARCH_ENABLED
28
28
 
29
+ @property (nonatomic) BOOL accessibilityContainerViewIsModal;
30
+
29
31
  #ifdef RCT_NEW_ARCH_ENABLED
30
32
  @property (nonatomic) react::LayoutMetrics oldLayoutMetrics;
31
33
  @property (nonatomic) react::LayoutMetrics newLayoutMetrics;
@@ -17,10 +17,10 @@
17
17
 
18
18
  @implementation RNSFullWindowOverlayContainer
19
19
 
20
- - (instancetype)initWithFrame:(CGRect)frame
20
+ - (instancetype)initWithFrame:(CGRect)frame accessibilityViewIsModal:(BOOL)accessibilityViewIsModal
21
21
  {
22
22
  if (self = [super initWithFrame:frame]) {
23
- self.accessibilityViewIsModal = YES;
23
+ self.accessibilityViewIsModal = accessibilityViewIsModal;
24
24
  }
25
25
  return self;
26
26
  }
@@ -92,29 +92,37 @@
92
92
  if (self = [super init]) {
93
93
  static const auto defaultProps = std::make_shared<const react::RNSFullWindowOverlayProps>();
94
94
  _props = defaultProps;
95
- [self _initCommon];
95
+ [self initCommonProps];
96
96
  }
97
97
  return self;
98
98
  }
99
- #endif // RCT_NEW_ARCH_ENABLED
100
-
99
+ #else
101
100
  - (instancetype)initWithBridge:(RCTBridge *)bridge
102
101
  {
103
102
  if (self = [super init]) {
104
103
  _bridge = bridge;
105
- [self _initCommon];
104
+ [self initCommonProps];
106
105
  }
107
106
 
108
107
  return self;
109
108
  }
109
+ #endif // RCT_NEW_ARCH_ENABLED
110
110
 
111
- - (void)_initCommon
111
+ - (void)initCommonProps
112
112
  {
113
+ // Default value used by container.
114
+ _accessibilityContainerViewIsModal = YES;
113
115
  _reactFrame = CGRectNull;
114
116
  _container = self.container;
115
117
  [self show];
116
118
  }
117
119
 
120
+ - (void)setAccessibilityContainerViewIsModal:(BOOL)accessibilityContainerViewIsModal
121
+ {
122
+ _accessibilityContainerViewIsModal = accessibilityContainerViewIsModal;
123
+ self.container.accessibilityViewIsModal = accessibilityContainerViewIsModal;
124
+ }
125
+
118
126
  - (void)addSubview:(UIView *)view
119
127
  {
120
128
  [_container addSubview:view];
@@ -123,7 +131,8 @@
123
131
  - (RNSFullWindowOverlayContainer *)container
124
132
  {
125
133
  if (_container == nil) {
126
- _container = [[RNSFullWindowOverlayContainer alloc] initWithFrame:_reactFrame];
134
+ _container = [[RNSFullWindowOverlayContainer alloc] initWithFrame:_reactFrame
135
+ accessibilityViewIsModal:_accessibilityContainerViewIsModal];
127
136
  }
128
137
 
129
138
  return _container;
@@ -220,6 +229,19 @@ RNS_IGNORE_SUPER_CALL_BEGIN
220
229
 
221
230
  RNS_IGNORE_SUPER_CALL_END
222
231
 
232
+ - (void)updateProps:(const facebook::react::Props::Shared &)props
233
+ oldProps:(const facebook::react::Props::Shared &)oldProps
234
+ {
235
+ const auto &oldComponentProps = *std::static_pointer_cast<const react::RNSFullWindowOverlayProps>(_props);
236
+ const auto &newComponentProps = *std::static_pointer_cast<const react::RNSFullWindowOverlayProps>(props);
237
+
238
+ if (newComponentProps.accessibilityContainerViewIsModal != oldComponentProps.accessibilityContainerViewIsModal) {
239
+ [self setAccessibilityContainerViewIsModal:newComponentProps.accessibilityContainerViewIsModal];
240
+ }
241
+
242
+ [super updateProps:props oldProps:oldProps];
243
+ }
244
+
223
245
  #else
224
246
  #pragma mark - Paper specific
225
247
 
@@ -250,6 +272,8 @@ Class<RCTComponentViewProtocol> RNSFullWindowOverlayCls(void)
250
272
 
251
273
  RCT_EXPORT_MODULE()
252
274
 
275
+ RCT_EXPORT_VIEW_PROPERTY(accessibilityContainerViewIsModal, BOOL)
276
+
253
277
  #ifdef RCT_NEW_ARCH_ENABLED
254
278
  #else
255
279
  - (UIView *)view
package/ios/RNSScreen.mm CHANGED
@@ -151,12 +151,20 @@ RNS_IGNORE_SUPER_CALL_END
151
151
  #ifdef RCT_NEW_ARCH_ENABLED
152
152
  if (_state != nullptr) {
153
153
  RNSScreenStackHeaderConfig *config = [self findHeaderConfig];
154
- // in large title, ScrollView handles the offset of content so we cannot set it here also.
155
- CGFloat headerHeight =
156
- config.largeTitle ? 0 : [_controller calculateHeaderHeightIsModal:self.isPresentedAsNativeModal];
157
- auto newState =
158
- react::RNSScreenState{RCTSizeFromCGSize(self.bounds.size), RCTPointFromCGPoint(CGPointMake(0, headerHeight))};
154
+
155
+ // in large title, ScrollView handles the offset of content so we cannot set it here also
156
+ // TODO: Why is it assumed in comment above, that large title uses scrollview here? What if only SafeAreaView is
157
+ // used?
158
+ // When config.translucent == true, we currently use `edgesForExtendedLayout` and the screen is laid out under the
159
+ // navigation bar, therefore there is no need to set content offset in shadow tree.
160
+ const CGFloat effectiveContentOffsetY = config.largeTitle || config.translucent
161
+ ? 0
162
+ : [_controller calculateHeaderHeightIsModal:self.isPresentedAsNativeModal];
163
+
164
+ auto newState = react::RNSScreenState{RCTSizeFromCGSize(self.bounds.size), {0, effectiveContentOffsetY}};
159
165
  _state->updateState(std::move(newState));
166
+
167
+ // TODO: Requesting layout on every layout is wrong. We should look for a way to get rid of this.
160
168
  UINavigationController *navctr = _controller.navigationController;
161
169
  [navctr.view setNeedsLayout];
162
170
  }
@@ -237,16 +245,7 @@ RNS_IGNORE_SUPER_CALL_END
237
245
  {
238
246
  switch (stackPresentation) {
239
247
  case RNSScreenStackPresentationModal:
240
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
241
- __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
242
- if (@available(iOS 13.0, tvOS 13.0, *)) {
243
- _controller.modalPresentationStyle = UIModalPresentationAutomatic;
244
- } else {
245
- _controller.modalPresentationStyle = UIModalPresentationFullScreen;
246
- }
247
- #else
248
- _controller.modalPresentationStyle = UIModalPresentationFullScreen;
249
- #endif
248
+ _controller.modalPresentationStyle = UIModalPresentationAutomatic;
250
249
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_17_0) && \
251
250
  __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_17_0 && !TARGET_OS_TV
252
251
  if (@available(iOS 18.0, *)) {
@@ -337,12 +336,7 @@ RNS_IGNORE_SUPER_CALL_END
337
336
 
338
337
  - (void)setGestureEnabled:(BOOL)gestureEnabled
339
338
  {
340
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
341
- __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
342
- if (@available(iOS 13.0, tvOS 13.0, *)) {
343
- _controller.modalInPresentation = !gestureEnabled;
344
- }
345
- #endif
339
+ _controller.modalInPresentation = !gestureEnabled;
346
340
 
347
341
  _gestureEnabled = gestureEnabled;
348
342
  }
@@ -753,8 +747,6 @@ RNS_IGNORE_SUPER_CALL_END
753
747
  return _gestureEnabled;
754
748
  }
755
749
 
756
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
757
- __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
758
750
  - (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)presentationController
759
751
  {
760
752
  // NOTE(kkafar): We should consider depracating the use of gesture cancel here & align
@@ -764,7 +756,6 @@ RNS_IGNORE_SUPER_CALL_END
764
756
  [self notifyDismissCancelledWithDismissCount:1];
765
757
  }
766
758
  }
767
- #endif
768
759
 
769
760
  - (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController
770
761
  {
@@ -1572,18 +1563,12 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
1572
1563
  #if !TARGET_OS_TV && !TARGET_OS_VISION
1573
1564
  CGSize fallbackStatusBarSize = [[UIApplication sharedApplication] statusBarFrame].size;
1574
1565
 
1575
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
1576
- __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
1577
- if (@available(iOS 13.0, *)) {
1578
- CGSize primaryStatusBarSize = self.view.window.windowScene.statusBarManager.statusBarFrame.size;
1579
- if (primaryStatusBarSize.height == 0 || primaryStatusBarSize.width == 0)
1580
- return fallbackStatusBarSize;
1581
-
1582
- return primaryStatusBarSize;
1583
- } else {
1566
+ CGSize primaryStatusBarSize = self.view.window.windowScene.statusBarManager.statusBarFrame.size;
1567
+ if (primaryStatusBarSize.height == 0 || primaryStatusBarSize.width == 0) {
1584
1568
  return fallbackStatusBarSize;
1585
1569
  }
1586
- #endif /* Check for iOS 13.0 */
1570
+
1571
+ return primaryStatusBarSize;
1587
1572
 
1588
1573
  #else
1589
1574
  // TVOS does not have status bar.
@@ -1914,6 +1899,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
1914
1899
  // if we dismissed the view natively, it will already be detached from view hierarchy
1915
1900
  if (self.view.window != nil) {
1916
1901
  UIView *snapshot = [self.view snapshotViewAfterScreenUpdates:NO];
1902
+ snapshot.frame = self.view.frame;
1917
1903
  [self.view removeFromSuperview];
1918
1904
  self.view = snapshot;
1919
1905
  [superView addSubview:snapshot];
@@ -492,14 +492,9 @@ RNS_IGNORE_SUPER_CALL_END
492
492
  UIViewController *next = controllers[i];
493
493
  BOOL lastModal = (i == controllers.count - 1);
494
494
 
495
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
496
- __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
497
- if (@available(iOS 13.0, tvOS 13.0, *)) {
498
- // Inherit UI style from its parent - solves an issue with incorrect style being applied to some UIKit views
499
- // like date picker or segmented control.
500
- next.overrideUserInterfaceStyle = self->_controller.overrideUserInterfaceStyle;
501
- }
502
- #endif
495
+ // Inherit UI style from its parent - solves an issue with incorrect style being applied to some UIKit views
496
+ // like date picker or segmented control.
497
+ next.overrideUserInterfaceStyle = self->_controller.overrideUserInterfaceStyle;
503
498
 
504
499
  BOOL shouldAnimate = lastModal && [next isKindOfClass:[RNSScreen class]] &&
505
500
  ((RNSScreen *)next).screenView.stackAnimation != RNSScreenStackAnimationNone;
@@ -1234,6 +1229,9 @@ RNS_IGNORE_SUPER_CALL_END
1234
1229
  withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
1235
1230
  {
1236
1231
  for (const auto &mutation : transaction.getMutations()) {
1232
+ // Note that self.tag might be invalid in cases this stack is removed.
1233
+ // This mostlikely does not cause any problems now, but it is something
1234
+ // worth to be aware of.
1237
1235
  if (MUTATION_PARENT_TAG(mutation) == self.tag &&
1238
1236
  (mutation.type == react::ShadowViewMutation::Type::Insert ||
1239
1237
  mutation.type == react::ShadowViewMutation::Type::Remove)) {