@react-navigation/stack 7.0.0-alpha.0 → 7.0.0-alpha.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.
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +4 -5
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/commonjs/index.js +14 -15
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createStackNavigator.js +5 -6
- package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
- package/lib/commonjs/utils/CardAnimationContext.js +3 -3
- package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
- package/lib/commonjs/utils/GestureHandlerRefContext.js +3 -3
- package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/commonjs/utils/ModalPresentationContext.js +2 -3
- package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
- package/lib/commonjs/utils/conditional.js +1 -1
- package/lib/commonjs/utils/conditional.js.map +1 -1
- package/lib/commonjs/utils/debounce.js +1 -1
- package/lib/commonjs/utils/debounce.js.map +1 -1
- package/lib/commonjs/utils/findLastIndex.js +1 -1
- package/lib/commonjs/utils/findLastIndex.js.map +1 -1
- package/lib/commonjs/utils/getDistanceForDirection.js +3 -4
- package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js +1 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/commonjs/utils/memoize.js +1 -1
- package/lib/commonjs/utils/memoize.js.map +1 -1
- package/lib/commonjs/utils/useCardAnimation.js +3 -4
- package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js +3 -4
- 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.map +1 -1
- package/lib/commonjs/views/GestureHandlerNative.js +2 -3
- package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
- package/lib/commonjs/views/Header/Header.js +9 -10
- package/lib/commonjs/views/Header/Header.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderContainer.js +3 -4
- package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderSegment.js +3 -4
- package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
- package/lib/commonjs/views/ModalStatusBarManager.js +1 -1
- package/lib/commonjs/views/ModalStatusBarManager.js.map +1 -1
- package/lib/commonjs/views/Screens.js.map +1 -1
- package/lib/commonjs/views/Stack/Card.js +206 -211
- package/lib/commonjs/views/Stack/Card.js.map +1 -1
- package/lib/commonjs/views/Stack/CardContainer.js +10 -11
- package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
- package/lib/commonjs/views/Stack/CardSheet.js +3 -3
- package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
- package/lib/commonjs/views/Stack/CardStack.js +75 -78
- package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
- package/lib/commonjs/views/Stack/StackView.js +151 -158
- package/lib/commonjs/views/Stack/StackView.js.map +1 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +1 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/module/index.js +7 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createStackNavigator.js +2 -2
- package/lib/module/navigators/createStackNavigator.js.map +1 -1
- package/lib/module/utils/CardAnimationContext.js +1 -1
- package/lib/module/utils/CardAnimationContext.js.map +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/module/utils/ModalPresentationContext.js +1 -2
- package/lib/module/utils/ModalPresentationContext.js.map +1 -1
- package/lib/module/utils/conditional.js +1 -1
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/debounce.js +1 -1
- package/lib/module/utils/debounce.js.map +1 -1
- package/lib/module/utils/findLastIndex.js +1 -1
- package/lib/module/utils/findLastIndex.js.map +1 -1
- package/lib/module/utils/getDistanceForDirection.js +2 -2
- package/lib/module/utils/getDistanceForDirection.js.map +1 -1
- package/lib/module/utils/getInvertedMultiplier.js +1 -1
- package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/module/utils/memoize.js +1 -1
- package/lib/module/utils/memoize.js.map +1 -1
- package/lib/module/utils/useCardAnimation.js +2 -2
- package/lib/module/utils/useCardAnimation.js.map +1 -1
- package/lib/module/utils/useGestureHandlerRef.js +3 -3
- package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/module/utils/useKeyboardManager.js +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.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 +4 -4
- package/lib/module/views/Header/Header.js.map +1 -1
- package/lib/module/views/Header/HeaderContainer.js +2 -2
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js +2 -2
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/ModalStatusBarManager.js +1 -1
- package/lib/module/views/ModalStatusBarManager.js.map +1 -1
- package/lib/module/views/Screens.js.map +1 -1
- package/lib/module/views/Stack/Card.js +200 -205
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardContainer.js +5 -5
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardSheet.js +1 -1
- package/lib/module/views/Stack/CardSheet.js.map +1 -1
- package/lib/module/views/Stack/CardStack.js +71 -74
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +149 -155
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/src/index.d.ts +7 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts +2 -3
- package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/utils/CardAnimationContext.d.ts +1 -2
- package/lib/typescript/src/utils/CardAnimationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts +1 -2
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts +1 -2
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/conditional.d.ts +1 -1
- package/lib/typescript/src/utils/conditional.d.ts.map +1 -1
- package/lib/typescript/src/utils/debounce.d.ts +1 -1
- package/lib/typescript/src/utils/debounce.d.ts.map +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts.map +1 -1
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts +1 -1
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +1 -1
- package/lib/typescript/src/utils/memoize.d.ts +1 -1
- package/lib/typescript/src/utils/memoize.d.ts.map +1 -1
- package/lib/typescript/src/utils/useCardAnimation.d.ts +1 -1
- package/lib/typescript/src/utils/useCardAnimation.d.ts.map +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts.map +1 -1
- package/lib/typescript/src/views/GestureHandlerNative.d.ts +0 -1
- package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/Header.d.ts +1 -2
- package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts +1 -2
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts +1 -2
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts +1 -2
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/Card.d.ts +1 -1
- package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardContainer.d.ts +3 -3
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts +1 -2
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts +1 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/TransitionConfigs/CardStyleInterpolators.tsx +1 -1
- package/src/index.tsx +7 -7
- package/src/navigators/createStackNavigator.tsx +2 -2
- package/src/utils/CardAnimationContext.tsx +3 -3
- package/src/utils/GestureHandlerRefContext.tsx +1 -1
- package/src/utils/ModalPresentationContext.tsx +1 -3
- package/src/utils/conditional.tsx +1 -1
- package/src/utils/debounce.tsx +1 -1
- package/src/utils/findLastIndex.tsx +1 -4
- package/src/utils/getDistanceForDirection.tsx +2 -2
- package/src/utils/getInvertedMultiplier.tsx +1 -1
- package/src/utils/memoize.tsx +1 -1
- package/src/utils/useCardAnimation.tsx +2 -2
- package/src/utils/useGestureHandlerRef.tsx +3 -3
- package/src/utils/useKeyboardManager.tsx +1 -1
- package/src/views/GestureHandlerNative.tsx +1 -1
- package/src/views/Header/Header.tsx +4 -4
- package/src/views/Header/HeaderContainer.tsx +2 -2
- package/src/views/Header/HeaderSegment.tsx +2 -2
- package/src/views/ModalStatusBarManager.tsx +1 -6
- package/src/views/Stack/Card.tsx +7 -7
- package/src/views/Stack/CardContainer.tsx +5 -5
- package/src/views/Stack/CardSheet.tsx +33 -34
- package/src/views/Stack/CardStack.tsx +4 -4
- package/src/views/Stack/StackView.tsx +5 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GestureDirection, Layout } from '../types';
|
|
2
|
-
import getInvertedMultiplier from './getInvertedMultiplier';
|
|
2
|
+
import { getInvertedMultiplier } from './getInvertedMultiplier';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function getDistanceForDirection(
|
|
5
5
|
layout: Layout,
|
|
6
6
|
gestureDirection: GestureDirection
|
|
7
7
|
): number {
|
|
@@ -2,7 +2,7 @@ import { I18nManager } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
import type { GestureDirection } from '../types';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function getInvertedMultiplier(
|
|
6
6
|
gestureDirection: GestureDirection
|
|
7
7
|
): 1 | -1 {
|
|
8
8
|
switch (gestureDirection) {
|
package/src/utils/memoize.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import CardAnimationContext from './CardAnimationContext';
|
|
3
|
+
import { CardAnimationContext } from './CardAnimationContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function useCardAnimation() {
|
|
6
6
|
const animation = React.useContext(CardAnimationContext);
|
|
7
7
|
|
|
8
8
|
if (animation === undefined) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { GestureHandlerRefContext } from './GestureHandlerRefContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
const ref = React.useContext(
|
|
5
|
+
export function useGestureHandlerRef() {
|
|
6
|
+
const ref = React.useContext(GestureHandlerRefContext);
|
|
7
7
|
|
|
8
8
|
if (ref === undefined) {
|
|
9
9
|
throw new Error(
|
|
@@ -3,7 +3,7 @@ import { HostComponent, Keyboard, TextInput } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
type InputRef = React.ElementRef<HostComponent<unknown>> | undefined;
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export function useKeyboardManager(isEnabled: () => boolean) {
|
|
7
7
|
// Numeric id of the previously focused text input
|
|
8
8
|
// When a gesture didn't change the tab, we can restore the focused input with this
|
|
9
9
|
const previouslyFocusedTextInputRef = React.useRef<InputRef>(undefined);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
PanGestureHandlerProperties,
|
|
5
5
|
} from 'react-native-gesture-handler';
|
|
6
6
|
|
|
7
|
-
import GestureHandlerRefContext from '../utils/GestureHandlerRefContext';
|
|
7
|
+
import { GestureHandlerRefContext } from '../utils/GestureHandlerRefContext';
|
|
8
8
|
|
|
9
9
|
export function PanGestureHandler(props: PanGestureHandlerProperties) {
|
|
10
10
|
const gestureRef = React.useRef<PanGestureHandlerNative>(null);
|
|
@@ -4,11 +4,11 @@ import * as React from 'react';
|
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
5
|
|
|
6
6
|
import type { StackHeaderProps } from '../../types';
|
|
7
|
-
import debounce from '../../utils/debounce';
|
|
8
|
-
import ModalPresentationContext from '../../utils/ModalPresentationContext';
|
|
9
|
-
import HeaderSegment from './HeaderSegment';
|
|
7
|
+
import { debounce } from '../../utils/debounce';
|
|
8
|
+
import { ModalPresentationContext } from '../../utils/ModalPresentationContext';
|
|
9
|
+
import { HeaderSegment } from './HeaderSegment';
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export const Header = React.memo(function Header({
|
|
12
12
|
back,
|
|
13
13
|
layout,
|
|
14
14
|
progress,
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
StackHeaderProps,
|
|
22
22
|
StackNavigationProp,
|
|
23
23
|
} from '../../types';
|
|
24
|
-
import Header from './Header';
|
|
24
|
+
import { Header } from './Header';
|
|
25
25
|
|
|
26
26
|
export type Props = {
|
|
27
27
|
mode: StackHeaderMode;
|
|
@@ -36,7 +36,7 @@ export type Props = {
|
|
|
36
36
|
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export
|
|
39
|
+
export function HeaderContainer({
|
|
40
40
|
mode,
|
|
41
41
|
scenes,
|
|
42
42
|
layout,
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
StackHeaderOptions,
|
|
21
21
|
StackHeaderStyleInterpolator,
|
|
22
22
|
} from '../../types';
|
|
23
|
-
import memoize from '../../utils/memoize';
|
|
23
|
+
import { memoize } from '../../utils/memoize';
|
|
24
24
|
|
|
25
25
|
type Props = Omit<StackHeaderOptions, 'headerStatusBarHeight'> & {
|
|
26
26
|
headerStatusBarHeight: number;
|
|
@@ -32,7 +32,7 @@ type Props = Omit<StackHeaderOptions, 'headerStatusBarHeight'> & {
|
|
|
32
32
|
styleInterpolator: StackHeaderStyleInterpolator;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export
|
|
35
|
+
export function HeaderSegment(props: Props) {
|
|
36
36
|
const [leftLabelLayout, setLeftLabelLayout] = React.useState<
|
|
37
37
|
Layout | undefined
|
|
38
38
|
>(undefined);
|
|
@@ -12,12 +12,7 @@ type Props = {
|
|
|
12
12
|
style: any;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
dark,
|
|
17
|
-
layout,
|
|
18
|
-
insets,
|
|
19
|
-
style,
|
|
20
|
-
}: Props) {
|
|
15
|
+
export function ModalStatusBarManager({ dark, layout, insets, style }: Props) {
|
|
21
16
|
const { dark: darkTheme } = useTheme();
|
|
22
17
|
const [overlapping, setOverlapping] = React.useState(true);
|
|
23
18
|
|
package/src/views/Stack/Card.tsx
CHANGED
|
@@ -20,17 +20,17 @@ import type {
|
|
|
20
20
|
StackCardStyleInterpolator,
|
|
21
21
|
TransitionSpec,
|
|
22
22
|
} from '../../types';
|
|
23
|
-
import CardAnimationContext from '../../utils/CardAnimationContext';
|
|
24
|
-
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
|
25
|
-
import getInvertedMultiplier from '../../utils/getInvertedMultiplier';
|
|
26
|
-
import memoize from '../../utils/memoize';
|
|
23
|
+
import { CardAnimationContext } from '../../utils/CardAnimationContext';
|
|
24
|
+
import { getDistanceForDirection } from '../../utils/getDistanceForDirection';
|
|
25
|
+
import { getInvertedMultiplier } from '../../utils/getInvertedMultiplier';
|
|
26
|
+
import { memoize } from '../../utils/memoize';
|
|
27
27
|
import {
|
|
28
28
|
GestureState,
|
|
29
29
|
PanGestureHandler,
|
|
30
30
|
PanGestureHandlerGestureEvent,
|
|
31
31
|
} from '../GestureHandler';
|
|
32
|
-
import ModalStatusBarManager from '../ModalStatusBarManager';
|
|
33
|
-
import CardSheet,
|
|
32
|
+
import { ModalStatusBarManager } from '../ModalStatusBarManager';
|
|
33
|
+
import { CardSheet, CardSheetRef } from './CardSheet';
|
|
34
34
|
|
|
35
35
|
type Props = ViewProps & {
|
|
36
36
|
interpolationIndex: number;
|
|
@@ -89,7 +89,7 @@ const hasOpacityStyle = (style: any) => {
|
|
|
89
89
|
return false;
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
export
|
|
92
|
+
export class Card extends React.Component<Props> {
|
|
93
93
|
static defaultProps = {
|
|
94
94
|
shadowEnabled: false,
|
|
95
95
|
gestureEnabled: true,
|
|
@@ -9,10 +9,10 @@ import * as React from 'react';
|
|
|
9
9
|
import { Animated, StyleSheet, View } from 'react-native';
|
|
10
10
|
|
|
11
11
|
import type { Layout, Scene } from '../../types';
|
|
12
|
-
import ModalPresentationContext from '../../utils/ModalPresentationContext';
|
|
13
|
-
import useKeyboardManager from '../../utils/useKeyboardManager';
|
|
12
|
+
import { ModalPresentationContext } from '../../utils/ModalPresentationContext';
|
|
13
|
+
import { useKeyboardManager } from '../../utils/useKeyboardManager';
|
|
14
14
|
import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
|
15
|
-
import Card from './Card';
|
|
15
|
+
import { Card } from './Card';
|
|
16
16
|
|
|
17
17
|
type Props = {
|
|
18
18
|
interpolationIndex: number;
|
|
@@ -56,7 +56,7 @@ type Props = {
|
|
|
56
56
|
|
|
57
57
|
const EPSILON = 0.1;
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function CardContainerInner({
|
|
60
60
|
interpolationIndex,
|
|
61
61
|
index,
|
|
62
62
|
active,
|
|
@@ -307,7 +307,7 @@ function CardContainer({
|
|
|
307
307
|
);
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
export
|
|
310
|
+
export const CardContainer = React.memo(CardContainerInner);
|
|
311
311
|
|
|
312
312
|
const styles = StyleSheet.create({
|
|
313
313
|
container: {
|
|
@@ -15,40 +15,39 @@ export type CardSheetRef = {
|
|
|
15
15
|
// if the container fills the body by comparing the size
|
|
16
16
|
// This lets the document.body handle scrolling of the content
|
|
17
17
|
// It's necessary for mobile browsers to be able to hide address bar on scroll
|
|
18
|
-
export
|
|
19
|
-
{ enabled, layout, style, ...rest },
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
React.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
18
|
+
export const CardSheet = React.forwardRef<CardSheetRef, Props>(
|
|
19
|
+
function CardSheet({ enabled, layout, style, ...rest }, ref) {
|
|
20
|
+
const [fill, setFill] = React.useState(false);
|
|
21
|
+
// To avoid triggering a rerender in Card during animation we had to move
|
|
22
|
+
// the state to CardSheet. The `setPointerEvents` is then hoisted back to the Card.
|
|
23
|
+
const [pointerEvents, setPointerEvents] =
|
|
24
|
+
React.useState<ViewProps['pointerEvents']>('auto');
|
|
25
|
+
|
|
26
|
+
React.useImperativeHandle(ref, () => {
|
|
27
|
+
return { setPointerEvents };
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (typeof document === 'undefined' || !document.body) {
|
|
32
|
+
// Only run when DOM is available
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const width = document.body.clientWidth;
|
|
37
|
+
const height = document.body.clientHeight;
|
|
38
|
+
|
|
39
|
+
setFill(width === layout.width && height === layout.height);
|
|
40
|
+
}, [layout.height, layout.width]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View
|
|
44
|
+
{...rest}
|
|
45
|
+
pointerEvents={pointerEvents}
|
|
46
|
+
style={[enabled && fill ? styles.page : styles.card, style]}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
52
51
|
|
|
53
52
|
const styles = StyleSheet.create({
|
|
54
53
|
page: {
|
|
@@ -35,12 +35,12 @@ import type {
|
|
|
35
35
|
StackHeaderMode,
|
|
36
36
|
StackNavigationOptions,
|
|
37
37
|
} from '../../types';
|
|
38
|
-
import findLastIndex from '../../utils/findLastIndex';
|
|
39
|
-
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
|
38
|
+
import { findLastIndex } from '../../utils/findLastIndex';
|
|
39
|
+
import { getDistanceForDirection } from '../../utils/getDistanceForDirection';
|
|
40
40
|
import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
|
41
41
|
import { MaybeScreen, MaybeScreenContainer } from '../Screens';
|
|
42
42
|
import { getIsModalPresentation } from './Card';
|
|
43
|
-
import CardContainer from './CardContainer';
|
|
43
|
+
import { CardContainer } from './CardContainer';
|
|
44
44
|
|
|
45
45
|
type GestureValues = {
|
|
46
46
|
[key: string]: Animated.Value;
|
|
@@ -202,7 +202,7 @@ const getProgressFromGesture = (
|
|
|
202
202
|
});
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
export
|
|
205
|
+
export class CardStack extends React.Component<Props, State> {
|
|
206
206
|
static getDerivedStateFromProps(
|
|
207
207
|
props: Props,
|
|
208
208
|
state: State
|
|
@@ -21,12 +21,13 @@ import type {
|
|
|
21
21
|
StackNavigationConfig,
|
|
22
22
|
StackNavigationHelpers,
|
|
23
23
|
} from '../../types';
|
|
24
|
-
import ModalPresentationContext from '../../utils/ModalPresentationContext';
|
|
24
|
+
import { ModalPresentationContext } from '../../utils/ModalPresentationContext';
|
|
25
25
|
import { GestureHandlerRootView } from '../GestureHandler';
|
|
26
|
-
import
|
|
26
|
+
import {
|
|
27
|
+
HeaderContainer,
|
|
27
28
|
Props as HeaderContainerProps,
|
|
28
29
|
} from '../Header/HeaderContainer';
|
|
29
|
-
import CardStack from './CardStack';
|
|
30
|
+
import { CardStack } from './CardStack';
|
|
30
31
|
|
|
31
32
|
type Props = StackNavigationConfig & {
|
|
32
33
|
state: StackNavigationState<ParamListBase>;
|
|
@@ -61,7 +62,7 @@ const GestureHandlerWrapper = GestureHandlerRootView ?? View;
|
|
|
61
62
|
const isArrayEqual = (a: any[], b: any[]) =>
|
|
62
63
|
a.length === b.length && a.every((it, index) => it === b[index]);
|
|
63
64
|
|
|
64
|
-
export
|
|
65
|
+
export class StackView extends React.Component<Props, State> {
|
|
65
66
|
static getDerivedStateFromProps(
|
|
66
67
|
props: Readonly<Props>,
|
|
67
68
|
state: Readonly<State>
|