@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.
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +114 -67
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +39 -39
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js +24 -2
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +31 -3
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createStackNavigator.js +18 -17
- package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/CardAnimationContext.js +1 -1
- package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
- package/lib/commonjs/utils/GestureHandlerRefContext.js +1 -1
- package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/commonjs/utils/ModalPresentationContext.js +1 -1
- package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
- package/lib/commonjs/utils/conditional.js.map +1 -1
- package/lib/commonjs/utils/findLastIndex.js.map +1 -1
- package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/commonjs/utils/getModalRoutesKeys.js +17 -0
- package/lib/commonjs/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/commonjs/utils/memoize.js +1 -4
- package/lib/commonjs/utils/memoize.js.map +1 -1
- package/lib/commonjs/utils/throttle.js +18 -0
- package/lib/commonjs/utils/throttle.js.map +1 -0
- package/lib/commonjs/utils/useCardAnimation.js +1 -1
- package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js +1 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardManager.js +1 -1
- package/lib/commonjs/utils/useKeyboardManager.js.map +1 -1
- package/lib/commonjs/views/GestureHandler.android.js.map +1 -1
- package/lib/commonjs/views/GestureHandler.ios.js.map +1 -1
- package/lib/commonjs/views/GestureHandler.js +4 -7
- package/lib/commonjs/views/GestureHandler.js.map +1 -1
- package/lib/commonjs/views/GestureHandlerNative.js +2 -2
- package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
- package/lib/commonjs/views/Header/Header.js +13 -14
- package/lib/commonjs/views/Header/Header.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderContainer.js +12 -13
- package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderSegment.js +4 -5
- package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
- package/lib/commonjs/views/Screens.js +11 -13
- package/lib/commonjs/views/Screens.js.map +1 -1
- package/lib/commonjs/views/Stack/Card.js +38 -40
- package/lib/commonjs/views/Stack/Card.js.map +1 -1
- package/lib/commonjs/views/Stack/CardContainer.js +42 -45
- package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
- package/lib/commonjs/views/Stack/CardSheet.js +8 -9
- package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
- package/lib/commonjs/views/Stack/CardStack.js +59 -31
- package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
- package/lib/commonjs/views/Stack/StackView.js +42 -57
- package/lib/commonjs/views/Stack/StackView.js.map +1 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +112 -67
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +40 -40
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js +24 -2
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionSpecs.js +30 -2
- package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createStackNavigator.js +16 -15
- package/lib/module/navigators/createStackNavigator.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/CardAnimationContext.js.map +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/module/utils/ModalPresentationContext.js.map +1 -1
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/findLastIndex.js.map +1 -1
- package/lib/module/utils/getDistanceForDirection.js.map +1 -1
- package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/module/utils/getModalRoutesKeys.js +10 -0
- package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/module/utils/memoize.js +1 -4
- package/lib/module/utils/memoize.js.map +1 -1
- package/lib/module/utils/throttle.js +12 -0
- package/lib/module/utils/throttle.js.map +1 -0
- package/lib/module/utils/useCardAnimation.js.map +1 -1
- package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/module/utils/useKeyboardManager.js.map +1 -1
- package/lib/module/views/GestureHandler.android.js.map +1 -1
- package/lib/module/views/GestureHandler.ios.js.map +1 -1
- package/lib/module/views/GestureHandler.js +3 -6
- package/lib/module/views/GestureHandler.js.map +1 -1
- package/lib/module/views/GestureHandlerNative.js +1 -1
- package/lib/module/views/GestureHandlerNative.js.map +1 -1
- package/lib/module/views/Header/Header.js +12 -13
- package/lib/module/views/Header/Header.js.map +1 -1
- package/lib/module/views/Header/HeaderContainer.js +11 -12
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js +3 -4
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/Screens.js +10 -12
- package/lib/module/views/Screens.js.map +1 -1
- package/lib/module/views/Stack/Card.js +36 -38
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardContainer.js +41 -44
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardSheet.js +7 -8
- package/lib/module/views/Stack/CardSheet.js.map +1 -1
- package/lib/module/views/Stack/CardStack.js +59 -31
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +41 -56
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts +8 -0
- package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +8 -0
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts +10 -0
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts +14 -9
- package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +57 -10
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/src/utils/throttle.d.ts +2 -0
- package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/src/views/GestureHandler.d.ts +2 -1
- package/lib/typescript/src/views/GestureHandler.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/Screens.d.ts +2 -1
- package/lib/typescript/src/views/Screens.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/TransitionConfigs/CardStyleInterpolators.tsx +70 -5
- package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +10 -2
- package/src/TransitionConfigs/TransitionPresets.tsx +31 -5
- package/src/TransitionConfigs/TransitionSpecs.tsx +30 -2
- package/src/index.tsx +2 -0
- package/src/navigators/createStackNavigator.tsx +33 -9
- package/src/types.tsx +73 -8
- package/src/utils/getModalRoutesKeys.ts +21 -0
- package/src/utils/throttle.tsx +16 -0
- package/src/views/Header/Header.tsx +4 -4
- package/src/views/Header/HeaderContainer.tsx +4 -4
- package/src/views/Header/HeaderSegment.tsx +2 -3
- package/src/views/Screens.tsx +1 -0
- package/src/views/Stack/Card.tsx +23 -16
- package/src/views/Stack/CardContainer.tsx +2 -2
- package/src/views/Stack/CardStack.tsx +99 -40
- package/src/views/Stack/StackView.tsx +1 -1
- package/lib/commonjs/utils/debounce.js +0 -21
- package/lib/commonjs/utils/debounce.js.map +0 -1
- package/lib/module/utils/debounce.js +0 -15
- package/lib/module/utils/debounce.js.map +0 -1
- package/lib/typescript/src/utils/debounce.d.ts +0 -2
- package/lib/typescript/src/utils/debounce.d.ts.map +0 -1
- package/src/utils/debounce.tsx +0 -16
package/src/views/Screens.tsx
CHANGED
package/src/views/Stack/Card.tsx
CHANGED
|
@@ -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
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
|
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.
|
|
574
|
+
? [styles.shadowHorizontal, styles.shadowStart]
|
|
568
575
|
: gestureDirection === 'horizontal-inverted'
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
|
-
|
|
617
|
-
|
|
623
|
+
shadowStart: {
|
|
624
|
+
start: 0,
|
|
618
625
|
},
|
|
619
|
-
|
|
620
|
-
|
|
626
|
+
shadowEnd: {
|
|
627
|
+
end: 0,
|
|
621
628
|
},
|
|
622
629
|
shadowVertical: {
|
|
623
|
-
|
|
624
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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
|
-
|
|
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
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
|
-
|
|
654
|
-
|
|
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
|
-
|
|
755
|
-
|
|
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.
|
|
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 +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"}
|
package/src/utils/debounce.tsx
DELETED
|
@@ -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
|
-
}
|