react-native-screens 3.12.0 → 3.13.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.
@@ -163,8 +163,10 @@ object ScreenWindowTraits {
163
163
  val screenForNavBarColor = findScreenForTrait(screen, WindowTraits.NAVIGATION_BAR_COLOR)
164
164
  val color = screenForNavBarColor?.navigationBarColor ?: window.navigationBarColor
165
165
 
166
- WindowInsetsControllerCompat(window, window.decorView).isAppearanceLightNavigationBars =
167
- isColorLight(color)
166
+ UiThreadUtil.runOnUiThread {
167
+ WindowInsetsControllerCompat(window, window.decorView).isAppearanceLightNavigationBars =
168
+ isColorLight(color)
169
+ }
168
170
  window.navigationBarColor = color
169
171
  }
170
172
 
@@ -142,6 +142,10 @@
142
142
  // that can handle it when dismissing a modal, the same for orientation
143
143
  [RNSScreenWindowTraits updateWindowTraits];
144
144
  [_presentedModals removeObject:presentationController.presentedViewController];
145
+ // we double check if there are no new controllers pending to be presented since someone could
146
+ // have tried to push another one during the transition
147
+ _updatingModals = NO;
148
+ [self updateContainer];
145
149
  if (self.onFinishTransitioning) {
146
150
  // instead of directly triggering onFinishTransitioning this time we enqueue the event on the
147
151
  // main queue. We do that because onDismiss event is also enqueued and we want for the transition
@@ -362,6 +366,14 @@
362
366
  BOOL shouldAnimate = lastModal && [next isKindOfClass:[RNSScreen class]] &&
363
367
  ((RNSScreenView *)next.view).stackAnimation != RNSScreenStackAnimationNone;
364
368
 
369
+ // if you want to present another modal quick enough after dismissing the previous one,
370
+ // it will result in wrong changeRootController, see repro in
371
+ // https://github.com/software-mansion/react-native-screens/issues/1299 We call `updateContainer` again in
372
+ // `presentationControllerDidDismiss` to cover this case and present new controller
373
+ if (previous.beingDismissed) {
374
+ return;
375
+ }
376
+
365
377
  [previous presentViewController:next
366
378
  animated:shouldAnimate
367
379
  completion:^{
@@ -106,6 +106,10 @@ using namespace facebook::react;
106
106
  {
107
107
  [super didMoveToWindow];
108
108
  if (!_invalidated) {
109
+ // We check whether the view has been invalidated before running side-effects in didMoveToWindow
110
+ // This is needed because when LayoutAnimations are used it is possible for view to be re-attached
111
+ // to a window despite the fact it has been removed from the React Native view hierarchy.
112
+ // See https://github.com/software-mansion/react-native-screens/pull/700
109
113
  [self maybeAddToParentAndUpdateContainer];
110
114
  }
111
115
  }
@@ -253,18 +257,10 @@ using namespace facebook::react;
253
257
  _controller.view.frame = self.bounds;
254
258
  }
255
259
 
256
- - (void)invalidate
257
- {
258
- _invalidated = YES;
259
- [_controller willMoveToParentViewController:nil];
260
- [_controller removeFromParentViewController];
261
- }
262
-
263
260
  - (void)dismissOnReload
264
261
  {
265
- dispatch_async(dispatch_get_main_queue(), ^{
266
- [self invalidate];
267
- });
262
+ auto screenController = (RNSScreenController *)_controller.viewControllers.lastObject;
263
+ [screenController resetViewToScreen];
268
264
  }
269
265
 
270
266
  #pragma mark methods connected to transitioning
@@ -280,6 +276,10 @@ using namespace facebook::react;
280
276
  {
281
277
  [super prepareForRecycle];
282
278
  _reactSubviews = [NSMutableArray new];
279
+ [self dismissOnReload];
280
+ _invalidated = YES;
281
+ [_controller willMoveToParentViewController:nil];
282
+ [_controller removeFromParentViewController];
283
283
  }
284
284
 
285
285
  + (ComponentDescriptorProvider)componentDescriptorProvider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screens",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "Native navigation primitives for your React Native app.",
5
5
  "scripts": {
6
6
  "check-types": "tsc --noEmit",
@@ -58,7 +58,6 @@
58
58
  "homepage": "https://github.com/software-mansion/react-native-screens#readme",
59
59
  "dependencies": {
60
60
  "react-freeze": "^1.0.0",
61
- "react-native-gradle-plugin": "^0.0.3",
62
61
  "warn-once": "^0.1.0"
63
62
  },
64
63
  "peerDependencies": {
@@ -100,7 +99,7 @@
100
99
  "react-dom": "^16.13.1",
101
100
  "react-native": "^0.63.2",
102
101
  "react-native-reanimated": "^2.2.0",
103
- "react-native-safe-area-context": "^3.1.9",
102
+ "react-native-safe-area-context": "^4.0.1-rc.5",
104
103
  "react-native-windows": "^0.64.8",
105
104
  "react-navigation": "^4.4.3",
106
105
  "react-navigation-stack": "^2.9.0",