@react-navigation/stack 7.0.0-alpha.8 → 7.0.0-rc.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.
Files changed (161) hide show
  1. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +114 -67
  2. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  3. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +39 -39
  4. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  5. package/lib/commonjs/TransitionConfigs/TransitionPresets.js +24 -2
  6. package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
  7. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +31 -3
  8. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
  9. package/lib/commonjs/index.js +1 -1
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/navigators/createStackNavigator.js +18 -17
  12. package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
  13. package/lib/commonjs/types.js.map +1 -1
  14. package/lib/commonjs/utils/CardAnimationContext.js +1 -1
  15. package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
  16. package/lib/commonjs/utils/GestureHandlerRefContext.js +1 -1
  17. package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
  18. package/lib/commonjs/utils/ModalPresentationContext.js +1 -1
  19. package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
  20. package/lib/commonjs/utils/conditional.js.map +1 -1
  21. package/lib/commonjs/utils/findLastIndex.js.map +1 -1
  22. package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
  23. package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
  24. package/lib/commonjs/utils/getModalRoutesKeys.js +17 -0
  25. package/lib/commonjs/utils/getModalRoutesKeys.js.map +1 -0
  26. package/lib/commonjs/utils/memoize.js +1 -4
  27. package/lib/commonjs/utils/memoize.js.map +1 -1
  28. package/lib/commonjs/utils/throttle.js +18 -0
  29. package/lib/commonjs/utils/throttle.js.map +1 -0
  30. package/lib/commonjs/utils/useCardAnimation.js +1 -1
  31. package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
  32. package/lib/commonjs/utils/useGestureHandlerRef.js +1 -1
  33. package/lib/commonjs/utils/useGestureHandlerRef.js.map +1 -1
  34. package/lib/commonjs/utils/useKeyboardManager.js +1 -1
  35. package/lib/commonjs/utils/useKeyboardManager.js.map +1 -1
  36. package/lib/commonjs/views/GestureHandler.android.js.map +1 -1
  37. package/lib/commonjs/views/GestureHandler.ios.js.map +1 -1
  38. package/lib/commonjs/views/GestureHandler.js +4 -7
  39. package/lib/commonjs/views/GestureHandler.js.map +1 -1
  40. package/lib/commonjs/views/GestureHandlerNative.js +2 -2
  41. package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
  42. package/lib/commonjs/views/Header/Header.js +13 -14
  43. package/lib/commonjs/views/Header/Header.js.map +1 -1
  44. package/lib/commonjs/views/Header/HeaderContainer.js +12 -13
  45. package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
  46. package/lib/commonjs/views/Header/HeaderSegment.js +4 -5
  47. package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
  48. package/lib/commonjs/views/Screens.js +11 -13
  49. package/lib/commonjs/views/Screens.js.map +1 -1
  50. package/lib/commonjs/views/Stack/Card.js +38 -40
  51. package/lib/commonjs/views/Stack/Card.js.map +1 -1
  52. package/lib/commonjs/views/Stack/CardContainer.js +42 -45
  53. package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
  54. package/lib/commonjs/views/Stack/CardSheet.js +8 -9
  55. package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
  56. package/lib/commonjs/views/Stack/CardStack.js +59 -31
  57. package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
  58. package/lib/commonjs/views/Stack/StackView.js +42 -57
  59. package/lib/commonjs/views/Stack/StackView.js.map +1 -1
  60. package/lib/module/TransitionConfigs/CardStyleInterpolators.js +112 -67
  61. package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  62. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +40 -40
  63. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  64. package/lib/module/TransitionConfigs/TransitionPresets.js +24 -2
  65. package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
  66. package/lib/module/TransitionConfigs/TransitionSpecs.js +30 -2
  67. package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/navigators/createStackNavigator.js +16 -15
  70. package/lib/module/navigators/createStackNavigator.js.map +1 -1
  71. package/lib/module/types.js.map +1 -1
  72. package/lib/module/utils/CardAnimationContext.js.map +1 -1
  73. package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
  74. package/lib/module/utils/ModalPresentationContext.js.map +1 -1
  75. package/lib/module/utils/conditional.js.map +1 -1
  76. package/lib/module/utils/findLastIndex.js.map +1 -1
  77. package/lib/module/utils/getDistanceForDirection.js.map +1 -1
  78. package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
  79. package/lib/module/utils/getModalRoutesKeys.js +10 -0
  80. package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
  81. package/lib/module/utils/memoize.js +1 -4
  82. package/lib/module/utils/memoize.js.map +1 -1
  83. package/lib/module/utils/throttle.js +12 -0
  84. package/lib/module/utils/throttle.js.map +1 -0
  85. package/lib/module/utils/useCardAnimation.js.map +1 -1
  86. package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
  87. package/lib/module/utils/useKeyboardManager.js.map +1 -1
  88. package/lib/module/views/GestureHandler.android.js.map +1 -1
  89. package/lib/module/views/GestureHandler.ios.js.map +1 -1
  90. package/lib/module/views/GestureHandler.js +3 -6
  91. package/lib/module/views/GestureHandler.js.map +1 -1
  92. package/lib/module/views/GestureHandlerNative.js +1 -1
  93. package/lib/module/views/GestureHandlerNative.js.map +1 -1
  94. package/lib/module/views/Header/Header.js +12 -13
  95. package/lib/module/views/Header/Header.js.map +1 -1
  96. package/lib/module/views/Header/HeaderContainer.js +11 -12
  97. package/lib/module/views/Header/HeaderContainer.js.map +1 -1
  98. package/lib/module/views/Header/HeaderSegment.js +3 -4
  99. package/lib/module/views/Header/HeaderSegment.js.map +1 -1
  100. package/lib/module/views/Screens.js +10 -12
  101. package/lib/module/views/Screens.js.map +1 -1
  102. package/lib/module/views/Stack/Card.js +36 -38
  103. package/lib/module/views/Stack/Card.js.map +1 -1
  104. package/lib/module/views/Stack/CardContainer.js +41 -44
  105. package/lib/module/views/Stack/CardContainer.js.map +1 -1
  106. package/lib/module/views/Stack/CardSheet.js +7 -8
  107. package/lib/module/views/Stack/CardSheet.js.map +1 -1
  108. package/lib/module/views/Stack/CardStack.js +59 -31
  109. package/lib/module/views/Stack/CardStack.js.map +1 -1
  110. package/lib/module/views/Stack/StackView.js +41 -56
  111. package/lib/module/views/Stack/StackView.js.map +1 -1
  112. package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts +8 -0
  113. package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -1
  114. package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -1
  115. package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +8 -0
  116. package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -1
  117. package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts +10 -0
  118. package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -1
  119. package/lib/typescript/src/index.d.ts +1 -1
  120. package/lib/typescript/src/index.d.ts.map +1 -1
  121. package/lib/typescript/src/navigators/createStackNavigator.d.ts +14 -9
  122. package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
  123. package/lib/typescript/src/types.d.ts +57 -10
  124. package/lib/typescript/src/types.d.ts.map +1 -1
  125. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
  126. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
  127. package/lib/typescript/src/utils/throttle.d.ts +2 -0
  128. package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
  129. package/lib/typescript/src/views/GestureHandler.d.ts +2 -1
  130. package/lib/typescript/src/views/GestureHandler.d.ts.map +1 -1
  131. package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
  132. package/lib/typescript/src/views/Screens.d.ts +2 -1
  133. package/lib/typescript/src/views/Screens.d.ts.map +1 -1
  134. package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
  135. package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
  136. package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
  137. package/package.json +19 -19
  138. package/src/TransitionConfigs/CardStyleInterpolators.tsx +70 -5
  139. package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +10 -2
  140. package/src/TransitionConfigs/TransitionPresets.tsx +31 -5
  141. package/src/TransitionConfigs/TransitionSpecs.tsx +30 -2
  142. package/src/index.tsx +2 -0
  143. package/src/navigators/createStackNavigator.tsx +33 -9
  144. package/src/types.tsx +73 -8
  145. package/src/utils/getModalRoutesKeys.ts +21 -0
  146. package/src/utils/throttle.tsx +16 -0
  147. package/src/views/Header/Header.tsx +4 -4
  148. package/src/views/Header/HeaderContainer.tsx +4 -4
  149. package/src/views/Header/HeaderSegment.tsx +2 -3
  150. package/src/views/Screens.tsx +1 -0
  151. package/src/views/Stack/Card.tsx +23 -16
  152. package/src/views/Stack/CardContainer.tsx +2 -2
  153. package/src/views/Stack/CardStack.tsx +99 -40
  154. package/src/views/Stack/StackView.tsx +1 -1
  155. package/lib/commonjs/utils/debounce.js +0 -21
  156. package/lib/commonjs/utils/debounce.js.map +0 -1
  157. package/lib/module/utils/debounce.js +0 -15
  158. package/lib/module/utils/debounce.js.map +0 -1
  159. package/lib/typescript/src/utils/debounce.d.ts +0 -2
  160. package/lib/typescript/src/utils/debounce.d.ts.map +0 -1
  161. package/src/utils/debounce.tsx +0 -16
@@ -32,6 +32,7 @@ export const MaybeScreen = ({
32
32
  active: 0 | 1 | Animated.AnimatedInterpolation<0 | 1>;
33
33
  children: React.ReactNode;
34
34
  freezeOnBlur?: boolean;
35
+ homeIndicatorHidden?: boolean;
35
36
  }) => {
36
37
  if (Screens != null) {
37
38
  return (
@@ -295,7 +295,8 @@ export class Card extends React.Component<Props> {
295
295
  this.handleStartInteraction();
296
296
  onGestureBegin?.();
297
297
  break;
298
- case GestureState.CANCELLED: {
298
+ case GestureState.CANCELLED:
299
+ case GestureState.FAILED: {
299
300
  this.isSwiping.setValue(FALSE);
300
301
  this.handleEndInteraction();
301
302
 
@@ -407,9 +408,9 @@ export class Card extends React.Component<Props> {
407
408
  gestureResponseDistance !== undefined
408
409
  ? gestureResponseDistance
409
410
  : gestureDirection === 'vertical' ||
410
- gestureDirection === 'vertical-inverted'
411
- ? GESTURE_RESPONSE_DISTANCE_VERTICAL
412
- : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
411
+ gestureDirection === 'vertical-inverted'
412
+ ? GESTURE_RESPONSE_DISTANCE_VERTICAL
413
+ : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
413
414
 
414
415
  if (gestureDirection === 'vertical') {
415
416
  return {
@@ -539,7 +540,13 @@ export class Card extends React.Component<Props> {
539
540
  // Make sure that this view isn't removed. If this view is removed, our style with animated value won't apply
540
541
  collapsable={false}
541
542
  />
542
- <View pointerEvents="box-none" {...rest}>
543
+ <View
544
+ pointerEvents="box-none"
545
+ // Make sure this view is not removed on the new architecture, as it causes focus loss during navigation on Android.
546
+ // This can happen when the view flattening results in different trees - due to `overflow` style changing in a parent.
547
+ collapsable={false}
548
+ {...rest}
549
+ >
543
550
  {overlayEnabled ? (
544
551
  <View pointerEvents="box-none" style={StyleSheet.absoluteFill}>
545
552
  {overlay({ style: overlayStyle })}
@@ -564,12 +571,12 @@ export class Card extends React.Component<Props> {
564
571
  style={[
565
572
  styles.shadow,
566
573
  gestureDirection === 'horizontal'
567
- ? [styles.shadowHorizontal, styles.shadowLeft]
574
+ ? [styles.shadowHorizontal, styles.shadowStart]
568
575
  : gestureDirection === 'horizontal-inverted'
569
- ? [styles.shadowHorizontal, styles.shadowRight]
570
- : gestureDirection === 'vertical'
571
- ? [styles.shadowVertical, styles.shadowTop]
572
- : [styles.shadowVertical, styles.shadowBottom],
576
+ ? [styles.shadowHorizontal, styles.shadowEnd]
577
+ : gestureDirection === 'vertical'
578
+ ? [styles.shadowVertical, styles.shadowTop]
579
+ : [styles.shadowVertical, styles.shadowBottom],
573
580
  { backgroundColor },
574
581
  shadowStyle,
575
582
  ]}
@@ -613,15 +620,15 @@ const styles = StyleSheet.create({
613
620
  width: 3,
614
621
  shadowOffset: { width: -1, height: 1 },
615
622
  },
616
- shadowLeft: {
617
- left: 0,
623
+ shadowStart: {
624
+ start: 0,
618
625
  },
619
- shadowRight: {
620
- right: 0,
626
+ shadowEnd: {
627
+ end: 0,
621
628
  },
622
629
  shadowVertical: {
623
- left: 0,
624
- right: 0,
630
+ start: 0,
631
+ end: 0,
625
632
  height: 3,
626
633
  shadowOffset: { width: 1, height: -1 },
627
634
  },
@@ -190,7 +190,7 @@ function CardContainerInner({
190
190
 
191
191
  const {
192
192
  presentation,
193
- animationEnabled,
193
+ animation,
194
194
  cardOverlay,
195
195
  cardOverlayEnabled,
196
196
  cardShadowEnabled,
@@ -275,7 +275,7 @@ function CardContainerInner({
275
275
  display:
276
276
  // Hide unfocused screens when animation isn't enabled
277
277
  // This is also necessary for a11y on web
278
- animationEnabled === false &&
278
+ animation === 'none' &&
279
279
  isNextScreenTransparent === false &&
280
280
  detachCurrentScreen !== false &&
281
281
  !focused
@@ -23,21 +23,31 @@ import {
23
23
  forNoAnimation as forNoAnimationCard,
24
24
  } from '../../TransitionConfigs/CardStyleInterpolators';
25
25
  import {
26
+ BottomSheetAndroid,
26
27
  DefaultTransition,
28
+ FadeFromBottomAndroid,
29
+ FadeFromRightAndroid,
27
30
  ModalFadeTransition,
31
+ ModalSlideFromBottomIOS,
28
32
  ModalTransition,
33
+ RevealFromBottomAndroid,
34
+ ScaleFromCenterAndroid,
35
+ SlideFromLeftIOS,
36
+ SlideFromRightIOS,
29
37
  } from '../../TransitionConfigs/TransitionPresets';
30
38
  import type {
31
39
  Layout,
32
40
  Scene,
41
+ StackAnimationName,
33
42
  StackCardStyleInterpolator,
34
43
  StackDescriptor,
35
44
  StackDescriptorMap,
36
45
  StackHeaderMode,
37
- StackNavigationOptions,
46
+ TransitionPreset,
38
47
  } from '../../types';
39
48
  import { findLastIndex } from '../../utils/findLastIndex';
40
49
  import { getDistanceForDirection } from '../../utils/getDistanceForDirection';
50
+ import { getModalRouteKeys } from '../../utils/getModalRoutesKeys';
41
51
  import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
42
52
  import { MaybeScreen, MaybeScreenContainer } from '../Screens';
43
53
  import { CardContainer } from './CardContainer';
@@ -86,6 +96,22 @@ type State = {
86
96
  headerHeights: Record<string, number>;
87
97
  };
88
98
 
99
+ const NAMED_TRANSITIONS_PRESETS = {
100
+ default: DefaultTransition,
101
+ fade: ModalFadeTransition,
102
+ fade_from_bottom: FadeFromBottomAndroid,
103
+ fade_from_right: FadeFromRightAndroid,
104
+ none: DefaultTransition,
105
+ reveal_from_bottom: RevealFromBottomAndroid,
106
+ scale_from_center: ScaleFromCenterAndroid,
107
+ slide_from_left: SlideFromLeftIOS,
108
+ slide_from_right: SlideFromRightIOS,
109
+ slide_from_bottom: Platform.select({
110
+ ios: ModalSlideFromBottomIOS,
111
+ default: BottomSheetAndroid,
112
+ }),
113
+ } as const satisfies Record<StackAnimationName, TransitionPreset>;
114
+
89
115
  const EPSILON = 1e-5;
90
116
 
91
117
  const STATE_INACTIVE = 0;
@@ -178,12 +204,22 @@ const getDistanceFromOptions = (
178
204
  descriptor: StackDescriptor | undefined,
179
205
  isRTL: boolean
180
206
  ) => {
181
- const {
182
- presentation,
183
- gestureDirection = presentation === 'modal'
207
+ if (descriptor?.options.gestureDirection) {
208
+ return getDistanceForDirection(
209
+ layout,
210
+ descriptor?.options.gestureDirection,
211
+ isRTL
212
+ );
213
+ }
214
+
215
+ const defaultGestureDirection =
216
+ descriptor?.options.presentation === 'modal'
184
217
  ? ModalTransition.gestureDirection
185
- : DefaultTransition.gestureDirection,
186
- } = (descriptor?.options || {}) as StackNavigationOptions;
218
+ : DefaultTransition.gestureDirection;
219
+
220
+ const gestureDirection = descriptor?.options.animation
221
+ ? NAMED_TRANSITIONS_PRESETS[descriptor?.options.animation]?.gestureDirection
222
+ : defaultGestureDirection;
187
223
 
188
224
  return getDistanceForDirection(layout, gestureDirection, isRTL);
189
225
  };
@@ -236,13 +272,12 @@ export class CardStack extends React.Component<Props, State> {
236
272
  ].reduce<GestureValues>((acc, curr) => {
237
273
  const descriptor =
238
274
  props.descriptors[curr.key] || props.preloadedDescriptors[curr.key];
239
- const { animationEnabled } = descriptor?.options || {};
275
+ const { animation } = descriptor?.options || {};
240
276
 
241
277
  acc[curr.key] =
242
278
  state.gestures[curr.key] ||
243
279
  new Animated.Value(
244
- (props.openingRouteKeys.includes(curr.key) &&
245
- animationEnabled !== false) ||
280
+ (props.openingRouteKeys.includes(curr.key) && animation !== 'none') ||
246
281
  props.state.preloadedRoutes.includes(curr)
247
282
  ? getDistanceFromOptions(
248
283
  state.layout,
@@ -255,6 +290,14 @@ export class CardStack extends React.Component<Props, State> {
255
290
  return acc;
256
291
  }, {});
257
292
 
293
+ const modalRouteKeys = getModalRouteKeys(
294
+ [...props.routes, ...props.state.preloadedRoutes],
295
+ {
296
+ ...props.descriptors,
297
+ ...props.preloadedDescriptors,
298
+ }
299
+ );
300
+
258
301
  const scenes = [...props.routes, ...props.state.preloadedRoutes].map(
259
302
  (route, index, self) => {
260
303
  // For preloaded screens, we don't care about the previous and the next screen
@@ -300,24 +343,38 @@ export class CardStack extends React.Component<Props, State> {
300
343
  ? nextDescriptor.options
301
344
  : descriptor.options;
302
345
 
303
- const defaultTransitionPreset =
304
- optionsForTransitionConfig.presentation === 'modal'
305
- ? ModalTransition
306
- : optionsForTransitionConfig.presentation === 'transparentModal'
307
- ? ModalFadeTransition
308
- : DefaultTransition;
346
+ // Assume modal if there are already modal screens in the stack
347
+ // or current screen is a modal when no presentation is specified
348
+ const isModal = modalRouteKeys.includes(route.key);
349
+
350
+ // Disable screen transition animation by default on web, windows and macos to match the native behavior
351
+ const excludedPlatforms =
352
+ Platform.OS !== 'web' &&
353
+ Platform.OS !== 'windows' &&
354
+ Platform.OS !== 'macos';
355
+
356
+ const animation =
357
+ optionsForTransitionConfig.animation ??
358
+ (excludedPlatforms ? 'default' : 'none');
359
+ const isAnimationEnabled = animation !== 'none';
360
+
361
+ const transitionPreset =
362
+ animation !== 'default'
363
+ ? NAMED_TRANSITIONS_PRESETS[animation]
364
+ : isModal || optionsForTransitionConfig.presentation === 'modal'
365
+ ? ModalTransition
366
+ : optionsForTransitionConfig.presentation === 'transparentModal'
367
+ ? ModalFadeTransition
368
+ : DefaultTransition;
309
369
 
310
370
  const {
311
- animationEnabled = Platform.OS !== 'web' &&
312
- Platform.OS !== 'windows' &&
313
- Platform.OS !== 'macos',
314
- gestureEnabled = Platform.OS === 'ios' && animationEnabled,
315
- gestureDirection = defaultTransitionPreset.gestureDirection,
316
- transitionSpec = defaultTransitionPreset.transitionSpec,
317
- cardStyleInterpolator = animationEnabled === false
318
- ? forNoAnimationCard
319
- : defaultTransitionPreset.cardStyleInterpolator,
320
- headerStyleInterpolator = defaultTransitionPreset.headerStyleInterpolator,
371
+ gestureEnabled = Platform.OS === 'ios' && isAnimationEnabled,
372
+ gestureDirection = transitionPreset.gestureDirection,
373
+ transitionSpec = transitionPreset.transitionSpec,
374
+ cardStyleInterpolator = isAnimationEnabled
375
+ ? transitionPreset.cardStyleInterpolator
376
+ : forNoAnimationCard,
377
+ headerStyleInterpolator = transitionPreset.headerStyleInterpolator,
321
378
  cardOverlayEnabled = (Platform.OS !== 'ios' &&
322
379
  optionsForTransitionConfig.presentation !== 'transparentModal') ||
323
380
  getIsModalPresentation(cardStyleInterpolator),
@@ -345,7 +402,7 @@ export class CardStack extends React.Component<Props, State> {
345
402
  ...descriptor,
346
403
  options: {
347
404
  ...descriptor.options,
348
- animationEnabled,
405
+ animation,
349
406
  cardOverlayEnabled,
350
407
  cardStyleInterpolator,
351
408
  gestureDirection,
@@ -560,16 +617,16 @@ export class CardStack extends React.Component<Props, State> {
560
617
  detachPreviousScreen = options.presentation === 'transparentModal'
561
618
  ? false
562
619
  : getIsModalPresentation(options.cardStyleInterpolator)
563
- ? i !==
564
- findLastIndex(scenes, (scene) => {
565
- const { cardStyleInterpolator } = scene.descriptor.options;
566
-
567
- return (
568
- cardStyleInterpolator === forModalPresentationIOS ||
569
- cardStyleInterpolator?.name === 'forModalPresentationIOS'
570
- );
571
- })
572
- : true,
620
+ ? i !==
621
+ findLastIndex(scenes, (scene) => {
622
+ const { cardStyleInterpolator } = scene.descriptor.options;
623
+
624
+ return (
625
+ cardStyleInterpolator === forModalPresentationIOS ||
626
+ cardStyleInterpolator?.name === 'forModalPresentationIOS'
627
+ );
628
+ })
629
+ : true,
573
630
  } = options;
574
631
 
575
632
  if (detachPreviousScreen === false) {
@@ -650,8 +707,8 @@ export class CardStack extends React.Component<Props, State> {
650
707
  index === routes.length - 1
651
708
  ? STATE_ON_TOP // the screen is on top after the transition
652
709
  : index >= routes.length - activeScreensLimit
653
- ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
654
- : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
710
+ ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
711
+ : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
655
712
  isScreenActive = sceneForActivity
656
713
  ? sceneForActivity.progress.current.interpolate({
657
714
  inputRange: [0, 1 - EPSILON, 1],
@@ -665,6 +722,7 @@ export class CardStack extends React.Component<Props, State> {
665
722
  headerShown = true,
666
723
  headerTransparent,
667
724
  freezeOnBlur,
725
+ autoHideHomeIndicator,
668
726
  } = scene.descriptor.options;
669
727
 
670
728
  const safeAreaInsetTop = insets.top;
@@ -698,6 +756,7 @@ export class CardStack extends React.Component<Props, State> {
698
756
  enabled={detachInactiveScreens}
699
757
  active={isScreenActive}
700
758
  freezeOnBlur={freezeOnBlur}
759
+ homeIndicatorHidden={autoHideHomeIndicator}
701
760
  pointerEvents="box-none"
702
761
  >
703
762
  <CardContainer
@@ -751,8 +810,8 @@ const styles = StyleSheet.create({
751
810
  absolute: {
752
811
  position: 'absolute',
753
812
  top: 0,
754
- left: 0,
755
- right: 0,
813
+ start: 0,
814
+ end: 0,
756
815
  },
757
816
  floating: {
758
817
  zIndex: 1,
@@ -142,7 +142,7 @@ export class StackView extends React.Component<Props, State> {
142
142
  const isAnimationEnabled = (key: string) => {
143
143
  const descriptor = props.descriptors[key] || state.descriptors[key];
144
144
 
145
- return descriptor ? descriptor.options.animationEnabled !== false : true;
145
+ return descriptor ? descriptor.options.animation !== 'none' : true;
146
146
  };
147
147
 
148
148
  const getAnimationTypeForReplace = (key: string) => {
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.debounce = debounce;
7
- function debounce(func, duration) {
8
- let timeout;
9
- return function () {
10
- if (!timeout) {
11
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12
- args[_key] = arguments[_key];
13
- }
14
- func.apply(this, args);
15
- timeout = setTimeout(() => {
16
- timeout = undefined;
17
- }, duration);
18
- }
19
- };
20
- }
21
- //# sourceMappingURL=debounce.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["debounce","func","duration","timeout","_len","arguments","length","args","Array","_key","apply","setTimeout","undefined"],"sourceRoot":"../../../src","sources":["utils/debounce.tsx"],"mappings":";;;;;;AAAO,SAASA,QAAQA,CACtBC,IAAO,EACPC,QAAgB,EACb;EACH,IAAIC,OAA4C;EAEhD,OAAO,YAA8B;IACnC,IAAI,CAACA,OAAO,EAAE;MAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EADeC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;QAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;MAAA;MAE/BR,IAAI,CAACS,KAAK,CAAC,IAAI,EAAEH,IAAI,CAAC;MAEtBJ,OAAO,GAAGQ,UAAU,CAAC,MAAM;QACzBR,OAAO,GAAGS,SAAS;MACrB,CAAC,EAAEV,QAAQ,CAAC;IACd;EACF,CAAC;AACH"}
@@ -1,15 +0,0 @@
1
- export function debounce(func, duration) {
2
- let timeout;
3
- return function () {
4
- if (!timeout) {
5
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6
- args[_key] = arguments[_key];
7
- }
8
- func.apply(this, args);
9
- timeout = setTimeout(() => {
10
- timeout = undefined;
11
- }, duration);
12
- }
13
- };
14
- }
15
- //# sourceMappingURL=debounce.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["debounce","func","duration","timeout","_len","arguments","length","args","Array","_key","apply","setTimeout","undefined"],"sourceRoot":"../../../src","sources":["utils/debounce.tsx"],"mappings":"AAAA,OAAO,SAASA,QAAQA,CACtBC,IAAO,EACPC,QAAgB,EACb;EACH,IAAIC,OAA4C;EAEhD,OAAO,YAA8B;IACnC,IAAI,CAACA,OAAO,EAAE;MAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EADeC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;QAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;MAAA;MAE/BR,IAAI,CAACS,KAAK,CAAC,IAAI,EAAEH,IAAI,CAAC;MAEtBJ,OAAO,GAAGQ,UAAU,CAAC,MAAM;QACzBR,OAAO,GAAGS,SAAS;MACrB,CAAC,EAAEV,QAAQ,CAAC;IACd;EACF,CAAC;AACH"}
@@ -1,2 +0,0 @@
1
- export declare function debounce<T extends (...args: any[]) => void>(func: T, duration: number): T;
2
- //# sourceMappingURL=debounce.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../../src/utils/debounce.tsx"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EACzD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,MAAM,GACf,CAAC,CAYH"}
@@ -1,16 +0,0 @@
1
- export function debounce<T extends (...args: any[]) => void>(
2
- func: T,
3
- duration: number
4
- ): T {
5
- let timeout: NodeJS.Timeout | number | undefined;
6
-
7
- return function (this: any, ...args) {
8
- if (!timeout) {
9
- func.apply(this, args);
10
-
11
- timeout = setTimeout(() => {
12
- timeout = undefined;
13
- }, duration);
14
- }
15
- } as T;
16
- }