@react-navigation/stack 8.0.0-alpha.11 → 8.0.0-alpha.13

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 (35) hide show
  1. package/lib/module/views/Stack/Card.js +25 -20
  2. package/lib/module/views/Stack/Card.js.map +1 -1
  3. package/lib/module/views/Stack/CardA11yWrapper.js +1 -2
  4. package/lib/module/views/Stack/CardA11yWrapper.js.map +1 -1
  5. package/lib/module/views/Stack/CardContainer.js +3 -4
  6. package/lib/module/views/Stack/CardContainer.js.map +1 -1
  7. package/lib/module/views/Stack/CardStack.js +56 -117
  8. package/lib/module/views/Stack/CardStack.js.map +1 -1
  9. package/lib/module/views/Stack/StackView.js +18 -14
  10. package/lib/module/views/Stack/StackView.js.map +1 -1
  11. package/lib/typescript/src/types.d.ts +20 -42
  12. package/lib/typescript/src/types.d.ts.map +1 -1
  13. package/lib/typescript/src/utils/gestureActivationCriteria.d.ts +1 -1
  14. package/lib/typescript/src/utils/gestureActivationCriteria.d.ts.map +1 -1
  15. package/lib/typescript/src/views/Header/HeaderSegment.d.ts +2 -2
  16. package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
  17. package/lib/typescript/src/views/Stack/Card.d.ts +3 -3
  18. package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
  19. package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts +0 -1
  20. package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts.map +1 -1
  21. package/lib/typescript/src/views/Stack/CardContainer.d.ts +2 -2
  22. package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
  23. package/lib/typescript/src/views/Stack/CardStack.d.ts +1 -1
  24. package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
  25. package/lib/typescript/src/views/Stack/StackView.d.ts +5 -15
  26. package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
  27. package/package.json +13 -13
  28. package/src/types.tsx +46 -61
  29. package/src/utils/gestureActivationCriteria.tsx +1 -1
  30. package/src/views/Header/HeaderSegment.tsx +2 -2
  31. package/src/views/Stack/Card.tsx +32 -23
  32. package/src/views/Stack/CardA11yWrapper.tsx +2 -14
  33. package/src/views/Stack/CardContainer.tsx +3 -4
  34. package/src/views/Stack/CardStack.tsx +82 -153
  35. package/src/views/Stack/StackView.tsx +34 -17
@@ -1 +1 @@
1
- {"version":3,"file":"CardStack.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/CardStack.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,KAAK,EACL,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EAKT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAoBjE,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,kBAAkB,EAElB,kBAAkB,EAInB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,KAAK,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAG/E,KAAK,aAAa,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;CAC/B,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,WAAW,EAAE,kBAAkB,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,KAAK,I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AAY,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;IACxD,eAAe,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,WAAW,EAAE,kBAAkB,CAAC;IAChC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAoKF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,kBAAkB,GAAG,SAAS,WAE5E;AAED,qBAAa,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IAC1D,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;gBAsNZ,KAAK,EAAE,KAAK;IAkBxB,OAAO,CAAC,YAAY,CAsBlB;IAEF,OAAO,CAAC,kBAAkB,CAqBxB;IAEF,OAAO,CAAC,eAAe,CAIrB;IAEF,OAAO,CAAC,gBAAgB,CAetB;IAEF,MAAM;CA2LP"}
@@ -9,7 +9,7 @@ type Props = StackNavigationConfig & {
9
9
  };
10
10
  type State = {
11
11
  routes: Route<string>[];
12
- previousRoutes: Route<string>[];
12
+ previousState: StackNavigationState<ParamListBase> | undefined;
13
13
  previousDescriptors: StackDescriptorMap;
14
14
  openingRouteKeys: string[];
15
15
  closingRouteKeys: string[];
@@ -21,25 +21,15 @@ export declare class StackView extends React.Component<Props, State> {
21
21
  routes: Readonly<{
22
22
  key: string;
23
23
  name: string;
24
- path?: string;
24
+ path?: string | undefined;
25
25
  history?: {
26
26
  type: "params";
27
27
  params: object;
28
- }[];
29
- } & Readonly<{
30
- params?: Readonly<object | undefined>;
31
- }>>[];
32
- previousRoutes: Readonly<{
33
- key: string;
34
- name: string;
35
- path?: string;
36
- history?: {
37
- type: "params";
38
- params: object;
39
- }[];
28
+ }[] | undefined;
40
29
  } & Readonly<{
41
30
  params?: Readonly<object | undefined>;
42
31
  }>>[];
32
+ previousState: StackNavigationState<ParamListBase>;
43
33
  descriptors: StackDescriptorMap;
44
34
  previousDescriptors: StackDescriptorMap;
45
35
  openingRouteKeys?: undefined;
@@ -47,7 +37,7 @@ export declare class StackView extends React.Component<Props, State> {
47
37
  replacingRouteKeys?: undefined;
48
38
  } | {
49
39
  routes: import("@react-navigation/routers").NavigationRoute<ParamListBase, string>[];
50
- previousRoutes: import("@react-navigation/routers").NavigationRoute<ParamListBase, string>[];
40
+ previousState: StackNavigationState<ParamListBase>;
51
41
  previousDescriptors: StackDescriptorMap;
52
42
  openingRouteKeys: string[];
53
43
  closingRouteKeys: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"StackView.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/StackView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,KAAK,EAEV,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AASrB,KAAK,KAAK,GAAG,qBAAqB,GAAG;IACnC,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,EAAE,sBAAsB,CAAC;IACnC,WAAW,EAAE,kBAAk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iOS and Android with animated transitions and gestures",
4
- "version": "8.0.0-alpha.11",
4
+ "version": "8.0.0-alpha.13",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -45,28 +45,28 @@
45
45
  "clean": "del lib"
46
46
  },
47
47
  "dependencies": {
48
- "@react-navigation/elements": "^3.0.0-alpha.11",
48
+ "@react-navigation/elements": "^3.0.0-alpha.13",
49
49
  "color": "^4.2.3",
50
50
  "use-latest-callback": "^0.3.2"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@jest/globals": "^30.0.0",
54
- "@react-navigation/native": "^8.0.0-alpha.11",
55
- "@testing-library/react-native": "^13.2.1",
54
+ "@react-navigation/native": "^8.0.0-alpha.12",
55
+ "@testing-library/react-native": "^13.3.3",
56
56
  "@types/color": "^4.2.0",
57
- "@types/react": "~19.1.10",
57
+ "@types/react": "~19.2.2",
58
58
  "del-cli": "^6.0.0",
59
- "react": "19.1.0",
60
- "react-native": "0.81.4",
59
+ "react": "19.2.0",
60
+ "react-native": "0.83.2",
61
61
  "react-native-builder-bob": "^0.40.12",
62
- "react-native-gesture-handler": "~2.28.0",
63
- "react-native-safe-area-context": "~5.6.0",
64
- "react-native-screens": "^4.21.0",
65
- "react-test-renderer": "19.1.0",
62
+ "react-native-gesture-handler": "~2.30.0",
63
+ "react-native-safe-area-context": "~5.6.2",
64
+ "react-native-screens": "^4.24.0",
65
+ "react-test-renderer": "19.2.0",
66
66
  "typescript": "^5.9.2"
67
67
  },
68
68
  "peerDependencies": {
69
- "@react-navigation/native": "^8.0.0-alpha.11",
69
+ "@react-navigation/native": "^8.0.0-alpha.12",
70
70
  "react": ">= 19.0.0",
71
71
  "react-native": "*",
72
72
  "react-native-gesture-handler": ">= 2.0.0",
@@ -91,5 +91,5 @@
91
91
  ]
92
92
  ]
93
93
  },
94
- "gitHead": "faad2ee23945a5a27090cfb837a35d1db25147ab"
94
+ "gitHead": "4ac6c41c1f751fba9dd82db050865bc71f3310f5"
95
95
  }
package/src/types.tsx CHANGED
@@ -138,12 +138,12 @@ export type SceneProgress = {
138
138
  * Progress value for the screen after this one in the stack.
139
139
  * This can be `undefined` in case the screen animating is the last one.
140
140
  */
141
- next?: Animated.AnimatedInterpolation<number>;
141
+ next?: Animated.AnimatedInterpolation<number> | undefined;
142
142
  /**
143
143
  * Progress value for the screen before this one in the stack.
144
144
  * This can be `undefined` in case the screen animating is the first one.
145
145
  */
146
- previous?: Animated.AnimatedInterpolation<number>;
146
+ previous?: Animated.AnimatedInterpolation<number> | undefined;
147
147
  };
148
148
 
149
149
  export type StackHeaderMode = 'float' | 'screen';
@@ -187,14 +187,14 @@ export type StackHeaderOptions = Omit<
187
187
  * Defaults to the previous screen's title, or "Back" if there's not enough space.
188
188
  * Use `headerBackButtonDisplayMode` to customize the behavior.
189
189
  */
190
- headerBackTitle?: string;
190
+ headerBackTitle?: string | undefined;
191
191
  /**
192
192
  * Title string used by the back button when `headerBackTitle` doesn't fit on the screen.
193
193
  * Use `headerBackButtonDisplayMode` to customize the behavior.
194
194
  *
195
195
  * Defaults to "Back".
196
196
  */
197
- headerBackTruncatedTitle?: string;
197
+ headerBackTruncatedTitle?: string | undefined;
198
198
  /**
199
199
  * How the back button displays icon and title.
200
200
  *
@@ -240,16 +240,18 @@ export type StackHeaderProps = {
240
240
  /**
241
241
  * Options for the back button.
242
242
  */
243
- back?: {
244
- /**
245
- * Title of the previous screen.
246
- */
247
- title: string | undefined;
248
- /**
249
- * The `href` to use for the anchor tag on web
250
- */
251
- href: string | undefined;
252
- };
243
+ back?:
244
+ | {
245
+ /**
246
+ * Title of the previous screen.
247
+ */
248
+ title: string | undefined;
249
+ /**
250
+ * The `href` to use for the anchor tag on web
251
+ */
252
+ href: string | undefined;
253
+ }
254
+ | undefined;
253
255
  /**
254
256
  * Animated nodes representing the progress of the animation.
255
257
  */
@@ -276,26 +278,26 @@ export type StackHeaderRightProps = {
276
278
  /**
277
279
  * Tint color for the header button.
278
280
  */
279
- tintColor?: ColorValue;
281
+ tintColor?: ColorValue | undefined;
280
282
  /**
281
283
  * Color for material ripple (Android >= 5.0 only).
282
284
  */
283
- pressColor?: ColorValue;
285
+ pressColor?: ColorValue | undefined;
284
286
  /**
285
287
  * Opacity when the button is pressed, used when ripple is not supported.
286
288
  */
287
- pressOpacity?: number;
289
+ pressOpacity?: number | undefined;
288
290
  /**
289
291
  * Whether it's possible to navigate back in stack.
290
292
  */
291
- canGoBack?: boolean;
293
+ canGoBack?: boolean | undefined;
292
294
  };
293
295
 
294
296
  export type StackHeaderLeftProps = HeaderBackButtonProps & {
295
297
  /**
296
298
  * Whether it's possible to navigate back in stack.
297
299
  */
298
- canGoBack?: boolean;
300
+ canGoBack?: boolean | undefined;
299
301
  };
300
302
 
301
303
  export type StackDescriptor = Descriptor<
@@ -348,9 +350,6 @@ export type StackNavigationOptions = StackHeaderOptions &
348
350
  * You can also specify `{ backgroundColor: 'transparent' }` to make the previous screen visible underneath.
349
351
  * This is useful to implement things like modal dialogs.
350
352
  *
351
- * You should also specify `detachPreviousScreen: false` in options when using a transparent background
352
- * so that the previous screen isn't detached and stays below the current screen.
353
- *
354
353
  * You might also need to change the animation of the screen using `cardStyleInterpolator`
355
354
  * so that the previous screen isn't transformed or invisible.
356
355
  */
@@ -366,7 +365,6 @@ export type StackNavigationOptions = StackHeaderOptions &
366
365
  * - `transparentModal`: Similar to `modal`. This changes following things:
367
366
  * - Sets `headerMode` to `screen` for the screen unless specified otherwise.
368
367
  * - Sets background color of the screen to transparent, so previous screen is visible
369
- * - Adjusts the `detachPreviousScreen` option so that the previous screen stays rendered.
370
368
  * - Prevents the previous screen from animating from its last position.
371
369
  * - Changes the screen animation to a vertical slide animation.
372
370
  *
@@ -408,43 +406,26 @@ export type StackNavigationOptions = StackHeaderOptions &
408
406
  * Not supported on Web.
409
407
  */
410
408
  gestureVelocityImpact?: number;
411
- /**
412
- * Whether to detach the previous screen from the view hierarchy to save memory.
413
- * Set it to `false` if you need the previous screen to be seen through the active screen.
414
- * Only applicable if `detachInactiveScreens` isn't set to `false`.
415
- * Defaults to `false` for the last screen for modals, otherwise `true`.
416
- */
417
- detachPreviousScreen?: boolean;
418
409
  /**
419
410
  * If `false`, the keyboard will NOT automatically dismiss when navigating to a new screen from this screen.
420
411
  * Defaults to `true`.
421
412
  */
422
413
  keyboardHandlingEnabled?: boolean;
414
+
423
415
  /**
424
- * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
425
- * Defaults to `true` when `enableFreeze()` is run at the top of the application.
426
- * Requires `react-native-screens` version >=3.16.0.
416
+ * What should happen when screens become inactive.
417
+ * - `pause`: Effects are cleaned up.
418
+ * - `none`: Screen renders normally
427
419
  *
428
- * Only supported on iOS and Android.
429
- */
430
- freezeOnBlur?: boolean;
431
- /**
432
- * Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
420
+ * Defaults to `pause`.
433
421
  *
434
- * @platform ios
422
+ * Preloaded screens won't be paused until after navigated to.
423
+ * This makes sure that effects are run to initialize the screen.
435
424
  */
436
- autoHideHomeIndicator?: boolean;
425
+ inactiveBehavior?: 'pause' | 'none';
437
426
  };
438
427
 
439
- export type StackNavigationConfig = {
440
- /**
441
- * Whether inactive screens should be detached from the view hierarchy to save memory.
442
- * This will have no effect if you disable `react-native-screens`.
443
- *
444
- * Defaults to `true`.
445
- */
446
- detachInactiveScreens?: boolean;
447
- };
428
+ export type StackNavigationConfig = {};
448
429
 
449
430
  export type TransitionSpec =
450
431
  | {
@@ -476,12 +457,14 @@ export type StackCardInterpolationProps = {
476
457
  * Values for the screen after this one in the stack.
477
458
  * This can be `undefined` in case the screen animating is the last one.
478
459
  */
479
- next?: {
480
- /**
481
- * Animated node representing the progress value of the next screen.
482
- */
483
- progress: Animated.AnimatedInterpolation<number>;
484
- };
460
+ next?:
461
+ | {
462
+ /**
463
+ * Animated node representing the progress value of the next screen.
464
+ */
465
+ progress: Animated.AnimatedInterpolation<number>;
466
+ }
467
+ | undefined;
485
468
  /**
486
469
  * The index of the card with this interpolation in the stack.
487
470
  */
@@ -555,12 +538,14 @@ export type StackHeaderInterpolationProps = {
555
538
  * Values for the screen after this one in the stack.
556
539
  * This can be `undefined` in case the screen animating is the last one.
557
540
  */
558
- next?: {
559
- /**
560
- * Animated node representing the progress value of the next screen.
561
- */
562
- progress: Animated.AnimatedInterpolation<number>;
563
- };
541
+ next?:
542
+ | {
543
+ /**
544
+ * Animated node representing the progress value of the next screen.
545
+ */
546
+ progress: Animated.AnimatedInterpolation<number>;
547
+ }
548
+ | undefined;
564
549
  /**
565
550
  * Writing direction of the layout.
566
551
  */
@@ -17,7 +17,7 @@ export const gestureActivationCriteria = ({
17
17
  }: {
18
18
  direction: LocaleDirection;
19
19
  gestureDirection: GestureDirection;
20
- gestureResponseDistance?: number;
20
+ gestureResponseDistance?: number | undefined;
21
21
  layout: Layout;
22
22
  }) => {
23
23
  const enableTrackpadTwoFingerGesture = true;
@@ -20,8 +20,8 @@ type Props = Omit<StackHeaderOptions, 'headerStatusBarHeight'> & {
20
20
  headerStatusBarHeight: number;
21
21
  title: string;
22
22
  modal: boolean;
23
- onGoBack?: () => void;
24
- backHref?: string;
23
+ onGoBack?: (() => void) | undefined;
24
+ backHref?: string | undefined;
25
25
  progress: SceneProgress;
26
26
  styleInterpolator: StackHeaderStyleInterpolator;
27
27
  };
@@ -58,7 +58,7 @@ type Props = {
58
58
  overlayEnabled: boolean;
59
59
  shadowEnabled: boolean | undefined;
60
60
  gestureEnabled: boolean;
61
- gestureResponseDistance?: number;
61
+ gestureResponseDistance?: number | undefined;
62
62
  gestureVelocityImpact: number | undefined;
63
63
  transitionSpec: {
64
64
  open: TransitionSpec;
@@ -66,8 +66,8 @@ type Props = {
66
66
  };
67
67
  preloaded: boolean;
68
68
  styleInterpolator: StackCardStyleInterpolator;
69
- containerStyle?: StyleProp<ViewStyle>;
70
- contentStyle?: StyleProp<ViewStyle>;
69
+ containerStyle?: StyleProp<ViewStyle> | undefined;
70
+ contentStyle?: StyleProp<ViewStyle> | undefined;
71
71
  };
72
72
 
73
73
  const GESTURE_VELOCITY_IMPACT = 0.3;
@@ -151,14 +151,14 @@ function Card({
151
151
  containerStyle: customContainerStyle,
152
152
  contentStyle,
153
153
  }: Props) {
154
- const [, forceUpdate] = React.useReducer((x) => x + 1, 0);
155
-
156
154
  const didInitiallyAnimate = React.useRef(false);
157
155
  const lastToValueRef = React.useRef<number | undefined>(undefined);
158
156
 
159
157
  const animationHandleRef = React.useRef<number | undefined>(undefined);
160
158
  const pendingGestureCallbackRef =
161
159
  React.useRef<ReturnType<typeof setTimeout>>(undefined);
160
+ const pendingOnCloseCallbackRef =
161
+ React.useRef<ReturnType<typeof setTimeout>>(undefined);
162
162
 
163
163
  const [isClosing] = React.useState(() => new Animated.Value(FALSE));
164
164
 
@@ -218,10 +218,8 @@ function Card({
218
218
  }
219
219
 
220
220
  animationHandleRef.current = requestAnimationFrame(() => {
221
- if (didInitiallyAnimate.current) {
222
- // Make sure to re-open screen if it wasn't removed
223
- forceUpdate();
224
- }
221
+ // Make sure to re-open screen if it wasn't removed
222
+ maybeAnimate();
225
223
  });
226
224
  };
227
225
 
@@ -249,6 +247,8 @@ function Card({
249
247
  ({ nativeEvent }: PanGestureHandlerGestureEvent) => {
250
248
  switch (nativeEvent.state) {
251
249
  case GestureState.ACTIVE:
250
+ clearTimeout(pendingGestureCallbackRef.current);
251
+ clearTimeout(pendingOnCloseCallbackRef.current);
252
252
  isSwiping.setValue(TRUE);
253
253
  onGestureBegin?.();
254
254
  break;
@@ -305,10 +305,13 @@ function Card({
305
305
  pendingGestureCallbackRef.current = setTimeout(() => {
306
306
  onClose();
307
307
 
308
- // Trigger an update after we dispatch the action to remove the screen
309
- // This will make sure that we check if the screen didn't get removed so we can cancel the animation
310
- forceUpdate();
311
- }, 32);
308
+ // Check if the screen is still closing with a delay
309
+ // So state update from onClose has a chance to go through
310
+ // If route wasn't removed after onClose, re-open it
311
+ pendingOnCloseCallbackRef.current = setTimeout(() => {
312
+ maybeAnimate();
313
+ }, 32);
314
+ }, 16);
312
315
  }
313
316
 
314
317
  onGestureEnd?.();
@@ -350,17 +353,15 @@ function Card({
350
353
  }
351
354
 
352
355
  clearTimeout(pendingGestureCallbackRef.current);
356
+ clearTimeout(pendingOnCloseCallbackRef.current);
353
357
  };
354
-
355
- // We only want to clean up the animation on unmount
356
358
  }, []);
357
359
 
358
- const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
360
+ const timeoutRef = React.useRef<ReturnType<typeof setTimeout>>(undefined);
359
361
 
360
- React.useEffect(() => {
361
- if (preloaded) {
362
- return;
363
- }
362
+ const maybeAnimate = useLatestCallback(() => {
363
+ clearTimeout(pendingGestureCallbackRef.current);
364
+ clearTimeout(pendingOnCloseCallbackRef.current);
364
365
 
365
366
  if (!didInitiallyAnimate.current) {
366
367
  // Animate the card in on initial mount
@@ -368,9 +369,8 @@ function Card({
368
369
  // rending of the screen is done. This is especially important
369
370
  // in the new architecture
370
371
  // cf., https://github.com/react-navigation/react-navigation/issues/12401
371
- if (timeoutRef.current) {
372
- clearTimeout(timeoutRef.current);
373
- }
372
+ clearTimeout(timeoutRef.current);
373
+
374
374
  timeoutRef.current = setTimeout(() => {
375
375
  didInitiallyAnimate.current = true;
376
376
  animate({ closing });
@@ -410,6 +410,14 @@ function Card({
410
410
  animate({ closing });
411
411
  }
412
412
  }
413
+ });
414
+
415
+ React.useEffect(() => {
416
+ if (preloaded) {
417
+ return;
418
+ }
419
+
420
+ maybeAnimate();
413
421
 
414
422
  previousPropsRef.current = {
415
423
  opening,
@@ -428,6 +436,7 @@ function Card({
428
436
  layout,
429
437
  opening,
430
438
  preloaded,
439
+ maybeAnimate,
431
440
  ]);
432
441
 
433
442
  const interpolationProps = React.useMemo(
@@ -6,7 +6,6 @@ type Props = {
6
6
  active: boolean;
7
7
  animated: boolean;
8
8
  isNextScreenTransparent: boolean;
9
- detachCurrentScreen: boolean;
10
9
  children: React.ReactNode;
11
10
  };
12
11
 
@@ -14,14 +13,7 @@ export type CardA11yWrapperRef = { setInert: (value: boolean) => void };
14
13
 
15
14
  export const CardA11yWrapper = React.forwardRef(
16
15
  (
17
- {
18
- focused,
19
- active,
20
- animated,
21
- isNextScreenTransparent,
22
- detachCurrentScreen,
23
- children,
24
- }: Props,
16
+ { focused, active, animated, isNextScreenTransparent, children }: Props,
25
17
  ref: React.Ref<CardA11yWrapperRef>
26
18
  ) => {
27
19
  // Manage this in separate component to avoid re-rendering card during gestures
@@ -30,11 +22,7 @@ export const CardA11yWrapper = React.forwardRef(
30
22
 
31
23
  React.useImperativeHandle(ref, () => ({ setInert }), []);
32
24
 
33
- const isHidden =
34
- !animated &&
35
- isNextScreenTransparent === false &&
36
- detachCurrentScreen !== false &&
37
- !focused;
25
+ const isHidden = !animated && isNextScreenTransparent === false && !focused;
38
26
 
39
27
  return (
40
28
  <View
@@ -57,7 +57,7 @@ type Props = {
57
57
  }) => void;
58
58
  isParentHeaderShown: boolean;
59
59
  isNextScreenTransparent: boolean;
60
- detachCurrentScreen: boolean;
60
+ children: React.ReactNode;
61
61
  };
62
62
 
63
63
  const EPSILON = 0.1;
@@ -78,7 +78,6 @@ function CardContainerInner({
78
78
  onHeaderHeightChange,
79
79
  isParentHeaderShown,
80
80
  isNextScreenTransparent,
81
- detachCurrentScreen,
82
81
  layout,
83
82
  onCloseRoute,
84
83
  onOpenRoute,
@@ -94,6 +93,7 @@ function CardContainerInner({
94
93
  safeAreaInsetRight,
95
94
  safeAreaInsetTop,
96
95
  scene,
96
+ children,
97
97
  }: Props) {
98
98
  const wrapperRef = React.useRef<CardA11yWrapperRef>(null);
99
99
 
@@ -242,7 +242,6 @@ function CardContainerInner({
242
242
  active={active}
243
243
  animated={animated}
244
244
  isNextScreenTransparent={isNextScreenTransparent}
245
- detachCurrentScreen={detachCurrentScreen}
246
245
  >
247
246
  <Card
248
247
  animated={animated}
@@ -311,7 +310,7 @@ function CardContainerInner({
311
310
  : (parentHeaderHeight ?? 0)
312
311
  }
313
312
  >
314
- {scene.descriptor.render()}
313
+ {children}
315
314
  </HeaderHeightContext.Provider>
316
315
  </HeaderShownContext.Provider>
317
316
  </HeaderBackContext.Provider>