1+ diff --git a/node_modules/@react-navigation/stack/lib/typescript/src/index.d.ts b/node_modules/@react-navigation/stack/lib/typescript/src/index.d.ts
2+ index 35a863b..66239cd 100644
3+ --- a/node_modules/@react-navigation/stack/lib/typescript/src/index.d.ts
4+ +++ b/node_modules/@react-navigation/stack/lib/typescript/src/index.d.ts
5+ @@ -22,6 +22,8 @@ export { default as CardAnimationContext } from './utils/CardAnimationContext';
6+ export { default as GestureHandlerRefContext } from './utils/GestureHandlerRefContext';
7+ export { default as useCardAnimation } from './utils/useCardAnimation';
8+ export { default as useGestureHandlerRef } from './utils/useGestureHandlerRef';
9+ + export { CardModalGestureContext } from './utils/CardModalGestureContext';
10+ +
11+ /**
12+ * Types
13+ */
14+ diff --git a/node_modules/@react-navigation/stack/lib/typescript/src/utils/CardModalGestureContext.d.ts b/node_modules/@react-navigation/stack/lib/typescript/src/utils/CardModalGestureContext.d.ts
15+ new file mode 100644
16+ index 0000000..590bf05
17+ --- /dev/null
18+ +++ b/node_modules/@react-navigation/stack/lib/typescript/src/utils/CardModalGestureContext.d.ts
19+ @@ -0,0 +1,9 @@
20+ + import * as React from 'react';
21+ + import type { Animated } from 'react-native';
22+ +
23+ + export interface CardModalGestureContextType {
24+ + scrollableGestureRef: React.RefObject<any>;
25+ + cardModalTranslateY: Animated.Value;
26+ + }
27+ +
28+ + export declare const CardModalGestureContext: React.Context<CardModalGestureContextType>;
29+ diff --git a/node_modules/@react-navigation/stack/src/index.tsx b/node_modules/@react-navigation/stack/src/index.tsx
30+ index f20d3fb..d914384 100644
31+ --- a/node_modules/@react-navigation/stack/src/index.tsx
32+ +++ b/node_modules/@react-navigation/stack/src/index.tsx
33+ @@ -31,6 +31,7 @@ export { default as CardAnimationContext } from './utils/CardAnimationContext';
34+ export { default as GestureHandlerRefContext } from './utils/GestureHandlerRefContext';
35+ export { default as useCardAnimation } from './utils/useCardAnimation';
36+ export { default as useGestureHandlerRef } from './utils/useGestureHandlerRef';
37+ + export { CardModalGestureContext } from './utils/CardModalGestureContext';
38+ 39+ /**
40+ * Types
41+ diff --git a/node_modules/@react-navigation/stack/src/utils/CardModalGestureContext.ts b/node_modules/@react-navigation/stack/src/utils/CardModalGestureContext.ts
42+ new file mode 100644
43+ index 0000000..c2e32db
44+ --- /dev/null
45+ +++ b/node_modules/@react-navigation/stack/src/utils/CardModalGestureContext.ts
46+ @@ -0,0 +1,9 @@
47+ + import React from 'react';
48+ + import { Animated } from 'react-native';
49+ +
50+ + interface CardModalGestureContextType {
51+ + scrollableGestureRef: React.RefObject<any>;
52+ + cardModalTranslateY: Animated.Value;
53+ + }
54+ +
55+ + export const CardModalGestureContext = React.createContext<CardModalGestureContextType | null>(null)
56+ \ No newline at end of file
157diff --git a/node_modules/@react-navigation/stack/src/views/Stack/Card.tsx b/node_modules/@react-navigation/stack/src/views/Stack/Card.tsx
2- index a013ff9..c99c5ab 100755
58+ index a013ff9..6a6e5f9 100755
359--- a/node_modules/@react-navigation/stack/src/views/Stack/Card.tsx
460+++ b/node_modules/@react-navigation/stack/src/views/Stack/Card.tsx
5- @@ -89,6 +89,8 @@ const hasOpacityStyle = (style: any) => {
6- return false;
7- };
61+ @@ -21,6 +21,7 @@ import type {
62+ TransitionSpec,
63+ } from '../../types';
64+ import CardAnimationContext from '../../utils/CardAnimationContext';
65+ + import { CardModalGestureContext } from '../../utils/CardModalGestureContext';
66+ import getDistanceForDirection from '../../utils/getDistanceForDirection';
67+ import getInvertedMultiplier from '../../utils/getInvertedMultiplier';
68+ import memoize from '../../utils/memoize';
69+ @@ -294,6 +295,8 @@ export default class Card extends React.Component<Props> {
70+ case GestureState.END: {
71+ this.isSwiping.setValue(FALSE);
872
9- + export const CardContext = React.createContext(null)
73+ + this.isSwiping.removeListener
1074+
11- export default class Card extends React.Component<Props> {
12- static defaultProps = {
13- shadowEnabled: false,
14- @@ -303,8 +305,15 @@ export default class Card extends React.Component<Props> {
75+ let distance;
76+ let translation;
77+ let velocity;
78+ @@ -303,8 +306,16 @@ export default class Card extends React.Component<Props> {
1579 gestureDirection === 'vertical-inverted'
1680 ) {
1781 distance = layout.height;
1882- translation = nativeEvent.translationY;
1983- velocity = nativeEvent.velocityY;
20- + // translation = nativeEvent.translationY;
84+ + // @ts-ignore
2185+ if(this.props.gesture._offset < 0) {
86+ + // @ts-ignore
2287+ translation = this.props.gesture._offset - this.props.gesture._value;
2388+ velocity = nativeEvent.velocityY / 2;
2489+ }else{
90+ + // @ts-ignore
2591+ translation = this.props.gesture._value;
2692+ velocity = nativeEvent.velocityY;
2793+ }
2894 } else {
2995 distance = layout.width;
3096 translation = nativeEvent.translationX;
31- @@ -392,7 +401 ,7 @@ export default class Card extends React.Component<Props> {
97+ @@ -392,7 +403 ,7 @@ export default class Card extends React.Component<Props> {
3298 return {
3399 maxDeltaX: 15,
34100 minOffsetY: 5,
@@ -37,19 +103,19 @@ index a013ff9..c99c5ab 100755
37103 enableTrackpadTwoFingerGesture,
38104 };
39105 } else if (gestureDirection === 'vertical-inverted') {
40- @@ -425,6 +434 ,7 @@ export default class Card extends React.Component<Props> {
106+ @@ -425,6 +436 ,7 @@ export default class Card extends React.Component<Props> {
41107 }
42108
43109 private contentRef = React.createRef<View>();
44110+ private scrollableGestureRef = React.createRef<any>();
45111
46112 render() {
47113 const {
48- @@ -526,10 +536 ,12 @@ export default class Card extends React.Component<Props> {
114+ @@ -526,10 +538 ,12 @@ export default class Card extends React.Component<Props> {
49115 style={[styles.container, containerStyle, customContainerStyle]}
50116 pointerEvents="box-none"
51117 >
52- + <CardContext .Provider value={{ scrollableGestureRef: this.scrollableGestureRef, cardPanTranslateY : gesture }}>
118+ + <CardModalGestureContext .Provider value={{ scrollableGestureRef: this.scrollableGestureRef, cardModalTranslateY : gesture }}>
53119 <PanGestureHandler
54120 enabled={layout.width !== 0 && gestureEnabled}
55121 onGestureEvent={handleGestureEvent}
@@ -58,11 +124,11 @@ index a013ff9..c99c5ab 100755
58124 {...this.gestureActivationCriteria()}
59125 >
60126 <Animated.View
61- @@ -563,6 +575 ,7 @@ export default class Card extends React.Component<Props> {
127+ @@ -563,6 +577 ,7 @@ export default class Card extends React.Component<Props> {
62128 </CardSheet>
63129 </Animated.View>
64130 </PanGestureHandler>
65- + </CardContext .Provider>
131+ + </CardModalGestureContext .Provider>
66132 </Animated.View>
67133 </View>
68134 </CardAnimationContext.Provider>
0 commit comments