@react-navigation/stack 8.0.0-alpha.30 → 8.0.0-alpha.32
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/module/views/Header/HeaderContainer.js +30 -12
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Stack/CardContainer.js +53 -81
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardStack.js +102 -51
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts +6 -2
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardContainer.d.ts +3 -5
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts +3 -2
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/views/Header/HeaderContainer.tsx +44 -20
- package/src/views/Stack/CardContainer.tsx +73 -108
- package/src/views/Stack/CardStack.tsx +121 -61
- package/lib/module/views/Stack/CardA11yWrapper.js +0 -42
- package/lib/module/views/Stack/CardA11yWrapper.js.map +0 -1
- package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts +0 -15
- package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts.map +0 -1
- package/src/views/Stack/CardA11yWrapper.tsx +0 -56
|
@@ -24,7 +24,7 @@ export function HeaderContainer({
|
|
|
24
24
|
} = useLinkBuilder();
|
|
25
25
|
return /*#__PURE__*/_jsx(View, {
|
|
26
26
|
style: [styles.container, style],
|
|
27
|
-
children: scenes.
|
|
27
|
+
children: scenes.map((scene, i, self) => {
|
|
28
28
|
if (mode === 'screen' && i !== self.length - 1 || !scene) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -62,6 +62,9 @@ export function HeaderContainer({
|
|
|
62
62
|
headerShown: previousHeaderShown = true,
|
|
63
63
|
headerMode: previousHeaderMode
|
|
64
64
|
} = previousDescriptor?.options || {};
|
|
65
|
+
const {
|
|
66
|
+
headerTransparent: nextHeaderTransparent
|
|
67
|
+
} = nextDescriptor?.options || {};
|
|
65
68
|
|
|
66
69
|
// If any of the next screens don't have a header or header is part of the screen
|
|
67
70
|
// Then we need to move this header offscreen so that it doesn't cover it
|
|
@@ -78,7 +81,10 @@ export function HeaderContainer({
|
|
|
78
81
|
const isHeaderStatic = (previousHeaderShown === false || previousHeaderMode === 'screen') &&
|
|
79
82
|
// We still need to animate when coming back from next scene
|
|
80
83
|
// A hacky way to check this is if the next scene exists
|
|
81
|
-
!nextDescriptor ||
|
|
84
|
+
!nextDescriptor ||
|
|
85
|
+
// If next header is tranparent, we want to treat this header as static
|
|
86
|
+
// Otherwise it may show through the next header
|
|
87
|
+
nextHeaderTransparent || nextHeaderlessScene;
|
|
82
88
|
const props = {
|
|
83
89
|
back: headerBack,
|
|
84
90
|
progress: scene.progress,
|
|
@@ -87,6 +93,25 @@ export function HeaderContainer({
|
|
|
87
93
|
navigation: scene.descriptor.navigation,
|
|
88
94
|
styleInterpolator: mode === 'float' ? isHeaderStatic ? nextHeaderlessGestureDirection === 'vertical' || nextHeaderlessGestureDirection === 'vertical-inverted' ? forSlideUp : nextHeaderlessGestureDirection === 'horizontal-inverted' ? forSlideRight : forSlideLeft : headerStyleInterpolator : forNoAnimation
|
|
89
95
|
};
|
|
96
|
+
const onRef = node => {
|
|
97
|
+
node?.measure((_x, _y, _width, height) => {
|
|
98
|
+
if (height && !contentHeight?.measured) {
|
|
99
|
+
onContentHeightChange({
|
|
100
|
+
route: scene.descriptor.route,
|
|
101
|
+
height
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const onLayout = e => {
|
|
107
|
+
const {
|
|
108
|
+
height
|
|
109
|
+
} = e.nativeEvent.layout;
|
|
110
|
+
onContentHeightChange({
|
|
111
|
+
route: scene.descriptor.route,
|
|
112
|
+
height
|
|
113
|
+
});
|
|
114
|
+
};
|
|
90
115
|
return /*#__PURE__*/_jsx(NavigationProvider, {
|
|
91
116
|
navigation: scene.descriptor.navigation,
|
|
92
117
|
route: scene.descriptor.route,
|
|
@@ -99,20 +124,13 @@ export function HeaderContainer({
|
|
|
99
124
|
// This is needed for screen readers, and testing tools on Android
|
|
100
125
|
// For float header, it's handled in CardStack
|
|
101
126
|
{
|
|
102
|
-
minHeight: contentHeight
|
|
127
|
+
minHeight: contentHeight?.value
|
|
103
128
|
} : null] : null, {
|
|
104
129
|
pointerEvents: isFocused ? 'box-none' : 'none'
|
|
105
130
|
}],
|
|
106
131
|
children: /*#__PURE__*/_jsx(View, {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
height
|
|
110
|
-
} = e.nativeEvent.layout;
|
|
111
|
-
onContentHeightChange({
|
|
112
|
-
route: scene.descriptor.route,
|
|
113
|
-
height
|
|
114
|
-
});
|
|
115
|
-
} : undefined,
|
|
132
|
+
ref: onRef,
|
|
133
|
+
onLayout: onLayout,
|
|
116
134
|
style: {
|
|
117
135
|
pointerEvents: 'box-none'
|
|
118
136
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getHeaderTitle","HeaderBackContext","ActivityView","NavigationProvider","useLinkBuilder","React","StyleSheet","View","forNoAnimation","forSlideLeft","forSlideRight","forSlideUp","Header","jsx","_jsx","HeaderContainer","mode","scenes","getPreviousScene","getFocusedRoute","contentHeight","onContentHeightChange","style","focusedRoute","parentHeaderBack","use","buildHref","styles","container","children","
|
|
1
|
+
{"version":3,"names":["getHeaderTitle","HeaderBackContext","ActivityView","NavigationProvider","useLinkBuilder","React","StyleSheet","View","forNoAnimation","forSlideLeft","forSlideRight","forSlideUp","Header","jsx","_jsx","HeaderContainer","mode","scenes","getPreviousScene","getFocusedRoute","contentHeight","onContentHeightChange","style","focusedRoute","parentHeaderBack","use","buildHref","styles","container","children","map","scene","i","self","length","header","headerMode","headerShown","headerTransparent","headerStyleInterpolator","descriptor","options","isFocused","key","route","previousScene","headerBack","title","name","href","params","previousDescriptor","nextDescriptor","previousHeaderShown","previousHeaderMode","nextHeaderTransparent","nextHeaderlessScene","slice","find","currentHeaderShown","currentHeaderMode","gestureDirection","nextHeaderlessGestureDirection","isHeaderStatic","props","back","progress","navigation","styleInterpolator","onRef","node","measure","_x","_y","_width","height","measured","onLayout","e","nativeEvent","layout","absolute","minHeight","value","pointerEvents","ref","visible","undefined","create","position","top","start","end"],"sourceRoot":"../../../../src","sources":["views/Header/HeaderContainer.tsx"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,iBAAiB,QAAQ,4BAA4B;AAC9E,SAASC,YAAY,QAAQ,qCAAqC;AAClE,SACEC,kBAAkB,EAGlBC,cAAc,QACT,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAGEC,UAAU,EACVC,IAAI,QAEC,cAAc;AAErB,SACEC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,UAAU,QACL,qDAAkD;AAOzD,SAASC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAoBlC,OAAO,SAASC,eAAeA,CAAC;EAC9BC,IAAI;EACJC,MAAM;EACNC,gBAAgB;EAChBC,eAAe;EACfC,aAAa;EACbC,qBAAqB;EACrBC;AACK,CAAC,EAAE;EACR,MAAMC,YAAY,GAAGJ,eAAe,CAAC,CAAC;EACtC,MAAMK,gBAAgB,GAAGnB,KAAK,CAACoB,GAAG,CAACxB,iBAAiB,CAAC;EACrD,MAAM;IAAEyB;EAAU,CAAC,GAAGtB,cAAc,CAAC,CAAC;EAEtC,oBACEU,IAAA,CAACP,IAAI;IAACe,KAAK,EAAE,CAACK,MAAM,CAACC,SAAS,EAAEN,KAAK,CAAE;IAAAO,QAAA,EACpCZ,MAAM,CAACa,GAAG,CAAC,CAACC,KAAK,EAAEC,CAAC,EAAEC,IAAI,KAAK;MAC9B,IAAKjB,IAAI,KA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QAAA,EAEbM,MAAM,KAAKoD,SAAS,GAAGpD,MAAM,CAAC6B,KAAK,CAAC,gBAAGlD,IAAA,CAACF,MAAM;gBAAA,GAAKoD;cAAK,CAAG;YAAC,CACjD;UAAC,CACX;QAAC,CACH;MAAC,GApCFjC,KAAK,CAACS,UAAU,CAACI,KAAK,CAACD,GAqCV,CAAC;IAEzB,CAAC;EAAC,CACE,CAAC;AAEX;AAEA,MAAMhB,MAAM,GAAGrB,UAAU,CAACkF,MAAM,CAAC;EAC/B5D,SAAS,EAAE;IACTwD,aAAa,EAAE;EACjB,CAAC;EACDH,QAAQ,EAAE;IACRQ,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,GAAG,EAAE;EACP;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -7,9 +7,7 @@ import { StyleSheet, View } from 'react-native';
|
|
|
7
7
|
import { ModalPresentationContext } from "../../utils/ModalPresentationContext.js";
|
|
8
8
|
import { useKeyboardManager } from "../../utils/useKeyboardManager.js";
|
|
9
9
|
import { Card } from "./Card.js";
|
|
10
|
-
import { CardA11yWrapper } from "./CardA11yWrapper.js";
|
|
11
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const EPSILON = 0.1;
|
|
13
11
|
function CardContainerInner({
|
|
14
12
|
interpolationIndex,
|
|
15
13
|
index,
|
|
@@ -21,11 +19,9 @@ function CardContainerInner({
|
|
|
21
19
|
modal,
|
|
22
20
|
getPreviousScene,
|
|
23
21
|
getFocusedRoute,
|
|
24
|
-
hasAbsoluteFloatHeader,
|
|
25
22
|
headerHeight,
|
|
26
23
|
onHeaderHeightChange,
|
|
27
24
|
isParentHeaderShown,
|
|
28
|
-
isNextScreenTransparent,
|
|
29
25
|
layout,
|
|
30
26
|
onCloseRoute,
|
|
31
27
|
onOpenRoute,
|
|
@@ -43,7 +39,6 @@ function CardContainerInner({
|
|
|
43
39
|
scene,
|
|
44
40
|
children
|
|
45
41
|
}) {
|
|
46
|
-
const wrapperRef = React.useRef(null);
|
|
47
42
|
const {
|
|
48
43
|
direction
|
|
49
44
|
} = useLocale();
|
|
@@ -112,7 +107,6 @@ function CardContainerInner({
|
|
|
112
107
|
closing,
|
|
113
108
|
gesture
|
|
114
109
|
}) => {
|
|
115
|
-
wrapperRef.current?.setInert(closing);
|
|
116
110
|
const {
|
|
117
111
|
route
|
|
118
112
|
} = scene.descriptor;
|
|
@@ -134,18 +128,6 @@ function CardContainerInner({
|
|
|
134
128
|
const {
|
|
135
129
|
colors
|
|
136
130
|
} = useTheme();
|
|
137
|
-
React.useEffect(() => {
|
|
138
|
-
const listener = scene.progress.next?.addListener?.(({
|
|
139
|
-
value
|
|
140
|
-
}) => {
|
|
141
|
-
wrapperRef.current?.setInert(value > EPSILON);
|
|
142
|
-
});
|
|
143
|
-
return () => {
|
|
144
|
-
if (listener) {
|
|
145
|
-
scene.progress.next?.removeListener?.(listener);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}, [scene.progress.next]);
|
|
149
131
|
const {
|
|
150
132
|
presentation,
|
|
151
133
|
animation,
|
|
@@ -189,72 +171,62 @@ function CardContainerInner({
|
|
|
189
171
|
return undefined;
|
|
190
172
|
}, [canGoBack, backTitle, href]);
|
|
191
173
|
const animated = animation !== 'none';
|
|
192
|
-
return /*#__PURE__*/_jsx(
|
|
193
|
-
ref: wrapperRef,
|
|
194
|
-
focused: focused,
|
|
195
|
-
active: active,
|
|
174
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
196
175
|
animated: animated,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
value: headerBack,
|
|
248
|
-
children: /*#__PURE__*/_jsx(HeaderShownContext.Provider, {
|
|
249
|
-
value: isParentHeaderShown || headerShown !== false,
|
|
250
|
-
children: /*#__PURE__*/_jsx(HeaderHeightContext.Provider, {
|
|
251
|
-
value: headerShown !== false ? headerHeight : parentHeaderHeight ?? 0,
|
|
252
|
-
children: children
|
|
253
|
-
})
|
|
176
|
+
interpolationIndex: interpolationIndex,
|
|
177
|
+
gestureDirection: gestureDirection,
|
|
178
|
+
layout: layout,
|
|
179
|
+
insets: insets,
|
|
180
|
+
direction: direction,
|
|
181
|
+
gesture: gesture,
|
|
182
|
+
current: scene.progress.current,
|
|
183
|
+
next: scene.progress.next,
|
|
184
|
+
opening: opening,
|
|
185
|
+
closing: closing,
|
|
186
|
+
onOpen: handleOpen,
|
|
187
|
+
onClose: handleClose,
|
|
188
|
+
overlay: cardOverlay,
|
|
189
|
+
overlayEnabled: cardOverlayEnabled,
|
|
190
|
+
shadowEnabled: cardShadowEnabled,
|
|
191
|
+
onTransition: handleTransition,
|
|
192
|
+
onGestureBegin: handleGestureBegin,
|
|
193
|
+
onGestureCanceled: handleGestureCanceled,
|
|
194
|
+
onGestureEnd: handleGestureEnd,
|
|
195
|
+
gestureEnabled: index === 0 ? false : gestureEnabled,
|
|
196
|
+
gestureResponseDistance: gestureResponseDistance,
|
|
197
|
+
gestureVelocityImpact: gestureVelocityImpact,
|
|
198
|
+
transitionSpec: transitionSpec,
|
|
199
|
+
styleInterpolator: cardStyleInterpolator,
|
|
200
|
+
pageOverflowEnabled: headerMode !== 'float' && presentation !== 'modal',
|
|
201
|
+
preloaded: preloaded,
|
|
202
|
+
contentStyle: [{
|
|
203
|
+
backgroundColor: presentation === 'transparentModal' ? 'transparent' : colors.background
|
|
204
|
+
}, cardStyle],
|
|
205
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
206
|
+
style: styles.container,
|
|
207
|
+
children: /*#__PURE__*/_jsxs(ModalPresentationContext.Provider, {
|
|
208
|
+
value: modal,
|
|
209
|
+
children: [headerMode !== 'float' ? renderHeader({
|
|
210
|
+
mode: 'screen',
|
|
211
|
+
scenes: [previousScene, scene],
|
|
212
|
+
getPreviousScene,
|
|
213
|
+
getFocusedRoute,
|
|
214
|
+
contentHeight: headerHeight,
|
|
215
|
+
onContentHeightChange: onHeaderHeightChange,
|
|
216
|
+
style: styles.header
|
|
217
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
218
|
+
style: styles.scene,
|
|
219
|
+
children: /*#__PURE__*/_jsx(HeaderBackContext.Provider, {
|
|
220
|
+
value: headerBack,
|
|
221
|
+
children: /*#__PURE__*/_jsx(HeaderShownContext.Provider, {
|
|
222
|
+
value: isParentHeaderShown || headerShown !== false,
|
|
223
|
+
children: /*#__PURE__*/_jsx(HeaderHeightContext.Provider, {
|
|
224
|
+
value: headerShown !== false ? headerHeight?.value ?? 0 : parentHeaderHeight ?? 0,
|
|
225
|
+
children: children
|
|
254
226
|
})
|
|
255
227
|
})
|
|
256
|
-
})
|
|
257
|
-
})
|
|
228
|
+
})
|
|
229
|
+
})]
|
|
258
230
|
})
|
|
259
231
|
})
|
|
260
232
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getHeaderTitle","HeaderBackContext","HeaderHeightContext","HeaderShownContext","useLinkBuilder","useLocale","useTheme","React","StyleSheet","View","ModalPresentationContext","useKeyboardManager","Card","
|
|
1
|
+
{"version":3,"names":["getHeaderTitle","HeaderBackContext","HeaderHeightContext","HeaderShownContext","useLinkBuilder","useLocale","useTheme","React","StyleSheet","View","ModalPresentationContext","useKeyboardManager","Card","jsx","_jsx","jsxs","_jsxs","CardContainerInner","interpolationIndex","index","active","opening","closing","gesture","focused","modal","getPreviousScene","getFocusedRoute","headerHeight","onHeaderHeightChange","isParentHeaderShown","layout","onCloseRoute","onOpenRoute","onGestureCancel","onGestureEnd","onGestureStart","onTransitionEnd","onTransitionStart","preloaded","renderHeader","safeAreaInsetBottom","safeAreaInsetLeft","safeAreaInsetRight","safeAreaInsetTop","scene","children","direction","parentHeaderHeight","use","options","descriptor","enabled","keyboardHandlingEnabled","onPageChangeStart","onPageChangeCancel","onPageChangeConfirm","handleOpen","route","handleClose","handleGestureBegin","handleGestureCanceled","handleGestureEnd","handleTransition","insets","top","right","bottom","left","colors","presentation","animation","cardOverlay","cardOverlayEnabled","cardShadowEnabled","cardStyle","cardStyleInterpolator","gestureDirection","gestureEnabled","gestureResponseDistance","gestureVelocityImpact","headerMode","headerShown","transitionSpec","buildHref","previousScene","backTitle","href","name","params","canGoBack","headerBack","useMemo","title","undefined","animated","current","progress","next","onOpen","onClose","overlay","overlayEnabled","shadowEnabled","onTransition","onGestureBegin","onGestureCanceled","styleInterpolator","pageOverflowEnabled","contentStyle","backgroundColor","background","style","styles","container","Provider","value","mode","scenes","contentHeight","onContentHeightChange","header","CardContainer","memo","create","flex","zIndex"],"sourceRoot":"../../../../src","sources":["views/Stack/CardContainer.tsx"],"mappings":";;AAAA,SACEA,cAAc,EACdC,iBAAiB,EACjBC,mBAAmB,EACnBC,kBAAkB,QACb,4BAA4B;AACnC,SAEEC,cAAc,EACdC,SAAS,EACTC,QAAQ,QACH,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAAmBC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAGzD,SAASC,wBAAwB,QAAQ,yCAAs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qBAAqB,EAAE3F,oBAAoB;UAC3CmF,KAAK,EAAEC,MAAM,CAACQ;QAChB,CAAC,CAAC,GACF,IAAI,eACR3G,IAAA,CAACL,IAAI;UAACuG,KAAK,EAAEC,MAAM,CAACpE,KAAM;UAAAC,QAAA,eACxBhC,IAAA,CAACb,iBAAiB,CAACkH,QAAQ;YAACC,KAAK,EAAEzB,UAAW;YAAA7C,QAAA,eAC5ChC,IAAA,CAACX,kBAAkB,CAACgH,QAAQ;cAC1BC,KAAK,EAAEtF,mBAAmB,IAAIoD,WAAW,KAAK,KAAM;cAAApC,QAAA,eAEpDhC,IAAA,CAACZ,mBAAmB,CAACiH,QAAQ;gBAC3BC,KAAK,EACHlC,WAAW,KAAK,KAAK,GAChBtD,YAAY,EAAEwF,KAAK,IAAI,CAAC,GACxBpE,kBAAkB,IAAI,CAC5B;gBAAAF,QAAA,EAEAA;cAAQ,CACmB;YAAC,CACJ;UAAC,CACJ;QAAC,CACzB,CAAC;MAAA,CAC0B;IAAC,CAChC;EAAC,CACH,CAAC;AAEX;AAEA,OAAO,MAAM4E,aAAa,gBAAGnH,KAAK,CAACoH,IAAI,CAAC1G,kBAAkB,CAAC;AAE3D,MAAMgG,MAAM,GAAGzG,UAAU,CAACoH,MAAM,CAAC;EAC/BV,SAAS,EAAE;IACTW,IAAI,EAAE;EACR,CAAC;EACDJ,MAAM,EAAE;IACNK,MAAM,EAAE;EACV,CAAC;EACDjF,KAAK,EAAE;IACLgF,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -28,6 +28,10 @@ const NAMED_TRANSITIONS_PRESETS = {
|
|
|
28
28
|
const FALLBACK_DESCRIPTOR = Object.freeze({
|
|
29
29
|
options: {}
|
|
30
30
|
});
|
|
31
|
+
const HIDDEN_HEADER_HEIGHT = {
|
|
32
|
+
measured: false,
|
|
33
|
+
value: 0
|
|
34
|
+
};
|
|
31
35
|
const getInterpolationIndex = (scenes, index) => {
|
|
32
36
|
const {
|
|
33
37
|
cardStyleInterpolator
|
|
@@ -67,14 +71,32 @@ const getHeaderHeights = (scenes, insets, isParentHeaderShown, isParentModal, la
|
|
|
67
71
|
headerStyle
|
|
68
72
|
} = curr.descriptor.options;
|
|
69
73
|
const style = StyleSheet.flatten(headerStyle || {});
|
|
70
|
-
const height = 'height' in style && typeof style.height === 'number' ? style.height :
|
|
74
|
+
const height = 'height' in style && typeof style.height === 'number' ? style.height : undefined;
|
|
71
75
|
const interpolationIndex = getInterpolationIndex(scenes, index);
|
|
72
76
|
const isModal = getIsModal(curr, interpolationIndex, isParentModal);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
if (typeof height === 'number') {
|
|
78
|
+
acc[curr.route.key] = {
|
|
79
|
+
measured: true,
|
|
80
|
+
value: height
|
|
81
|
+
};
|
|
82
|
+
} else {
|
|
83
|
+
const previousHeight = previous[curr.route.key];
|
|
84
|
+
const defaultHeight = getDefaultHeaderHeight({
|
|
85
|
+
landscape: layout.width > layout.height,
|
|
86
|
+
modalPresentation: isModal,
|
|
87
|
+
topInset: headerStatusBarHeight
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// If we hadn't measured before, use re-computed default height
|
|
91
|
+
if (!previousHeight?.measured && defaultHeight !== previousHeight?.value) {
|
|
92
|
+
acc[curr.route.key] = {
|
|
93
|
+
measured: false,
|
|
94
|
+
value: defaultHeight
|
|
95
|
+
};
|
|
96
|
+
} else if (previousHeight) {
|
|
97
|
+
acc[curr.route.key] = previousHeight;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
78
100
|
return acc;
|
|
79
101
|
}, {});
|
|
80
102
|
};
|
|
@@ -259,13 +281,16 @@ export class CardStack extends React.Component {
|
|
|
259
281
|
headerHeights
|
|
260
282
|
}) => {
|
|
261
283
|
const previousHeight = headerHeights[route.key];
|
|
262
|
-
if (previousHeight === height) {
|
|
284
|
+
if (previousHeight?.value === height) {
|
|
263
285
|
return null;
|
|
264
286
|
}
|
|
265
287
|
return {
|
|
266
288
|
headerHeights: {
|
|
267
289
|
...headerHeights,
|
|
268
|
-
[route.key]:
|
|
290
|
+
[route.key]: {
|
|
291
|
+
measured: true,
|
|
292
|
+
value: height
|
|
293
|
+
}
|
|
269
294
|
}
|
|
270
295
|
};
|
|
271
296
|
});
|
|
@@ -321,7 +346,12 @@ export class CardStack extends React.Component {
|
|
|
321
346
|
} = this.state;
|
|
322
347
|
const allRoutes = getAllRoutes(routes, state);
|
|
323
348
|
const focusedRoute = state.routes[state.index];
|
|
324
|
-
|
|
349
|
+
|
|
350
|
+
// Render only two top-most active headers as a workaround for
|
|
351
|
+
// https://github.com/react-navigation/react-navigation/issues/12456.
|
|
352
|
+
// If the header is persisted, it might be placed incorrectly when navigating back
|
|
353
|
+
const activeHeaderScenes = scenes.filter(scene => !isInactiveRoute(scene.route, routes)).slice(-2);
|
|
354
|
+
const isFloatHeaderAbsolute = activeHeaderScenes.some(scene => {
|
|
325
355
|
const options = scene.descriptor.options ?? {};
|
|
326
356
|
const {
|
|
327
357
|
headerMode,
|
|
@@ -334,11 +364,12 @@ export class CardStack extends React.Component {
|
|
|
334
364
|
return false;
|
|
335
365
|
});
|
|
336
366
|
const isFloatHeaderFocused = scenes.findLast(scene => scene.route.key === focusedRoute.key)?.descriptor.options.headerMode === 'float';
|
|
367
|
+
const focusedHeaderHeight = headerHeights[focusedRoute.key];
|
|
337
368
|
return /*#__PURE__*/_jsxs(View, {
|
|
338
369
|
style: styles.container,
|
|
339
370
|
children: [renderHeader({
|
|
340
371
|
mode: 'float',
|
|
341
|
-
scenes,
|
|
372
|
+
scenes: activeHeaderScenes,
|
|
342
373
|
getPreviousScene: this.getPreviousScene,
|
|
343
374
|
getFocusedRoute: this.getFocusedRoute,
|
|
344
375
|
contentHeight: headerHeights[focusedRoute.key],
|
|
@@ -347,7 +378,7 @@ export class CardStack extends React.Component {
|
|
|
347
378
|
// The header title can't be found with maestro without this
|
|
348
379
|
// In some cases, header buttons may not be touchable as well
|
|
349
380
|
isFloatHeaderFocused && {
|
|
350
|
-
height:
|
|
381
|
+
height: focusedHeaderHeight?.value
|
|
351
382
|
}]]
|
|
352
383
|
}), /*#__PURE__*/_jsx(View, {
|
|
353
384
|
style: styles.container,
|
|
@@ -356,18 +387,18 @@ export class CardStack extends React.Component {
|
|
|
356
387
|
const focused = focusedRoute.key === route.key;
|
|
357
388
|
const gesture = gestures[route.key];
|
|
358
389
|
const scene = scenes[index];
|
|
359
|
-
const isInactive = isInactiveRoute(route, this.props.routes);
|
|
360
390
|
const {
|
|
361
391
|
inactiveBehavior = 'pause',
|
|
362
392
|
animation,
|
|
363
393
|
headerShown = true,
|
|
394
|
+
headerMode,
|
|
364
395
|
headerTransparent
|
|
365
396
|
} = scene.descriptor.options;
|
|
366
397
|
const safeAreaInsetTop = insets.top;
|
|
367
398
|
const safeAreaInsetRight = insets.right;
|
|
368
399
|
const safeAreaInsetBottom = insets.bottom;
|
|
369
400
|
const safeAreaInsetLeft = insets.left;
|
|
370
|
-
const headerHeight = headerShown !== false ? headerHeights[route.key] :
|
|
401
|
+
const headerHeight = headerShown !== false ? headerHeights[route.key] : HIDDEN_HEADER_HEIGHT;
|
|
371
402
|
|
|
372
403
|
// Start from current card and count backwards the number of cards with same interpolation
|
|
373
404
|
const interpolationIndex = getInterpolationIndex(scenes, index);
|
|
@@ -379,19 +410,28 @@ export class CardStack extends React.Component {
|
|
|
379
410
|
const isNextScreenTransparent = scenes[index + 1]?.descriptor.options.presentation === 'transparentModal';
|
|
380
411
|
const isRemoving = replacingRouteKeys.includes(route.key) || closingRouteKeys.includes(route.key);
|
|
381
412
|
const isFocusing = openingRouteKeys.includes(route.key) || [...closingRouteKeys, ...replacingRouteKeys].includes(self[index + 1]?.key);
|
|
413
|
+
const isInactive = isInactiveRoute(route, this.props.routes);
|
|
414
|
+
const isRetained = state.retainedRouteKeys?.includes(route.key);
|
|
415
|
+
const isPreloaded = isInactive && !isRetained;
|
|
416
|
+
const isTopmost = index === routes.length - 1;
|
|
382
417
|
const isBeforeLast = index === routes.length - 2;
|
|
383
418
|
|
|
384
419
|
// Keep animating and the last two rendered routes visible for smoother transitions
|
|
385
420
|
const isVisible = focused || isNextScreenTransparent ||
|
|
421
|
+
// React native destroys the view when hidden
|
|
422
|
+
// So we keep retained screens visible
|
|
423
|
+
// This makes sure any videos being played don't stop etc.
|
|
424
|
+
isRetained ||
|
|
386
425
|
// We only need to keep other screens visible when animation is enabled
|
|
387
426
|
isAnimationEnabled && (isFocusing || isRemoving ||
|
|
388
|
-
// Preloaded
|
|
389
|
-
!
|
|
427
|
+
// Preloaded screens should stay mounted, but remain hidden until focused
|
|
428
|
+
!isPreloaded && index >= routes.length - 2);
|
|
390
429
|
const activityMode =
|
|
391
430
|
// Render focused and animating screens normally
|
|
392
431
|
focused || isFocusing ? 'normal' : inactiveBehavior === 'none' ||
|
|
393
432
|
// Unpause preloaded or retained screens so updates are visible
|
|
394
|
-
isInactive
|
|
433
|
+
// Handle retained explicitly as isInactive won't be updated until animation end
|
|
434
|
+
isInactive || isRetained ||
|
|
395
435
|
// Keep the screen before transparent screen active
|
|
396
436
|
// This lets the screen under the transparent screen update and animate
|
|
397
437
|
isNextScreenTransparent ||
|
|
@@ -406,41 +446,52 @@ export class CardStack extends React.Component {
|
|
|
406
446
|
if (activityMode === 'unmounted') {
|
|
407
447
|
return null;
|
|
408
448
|
}
|
|
409
|
-
return /*#__PURE__*/_jsx(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
449
|
+
return /*#__PURE__*/_jsx(ActivityView, {
|
|
450
|
+
mode: activityMode,
|
|
451
|
+
visible: isVisible,
|
|
452
|
+
style: {
|
|
453
|
+
...StyleSheet.absoluteFill,
|
|
454
|
+
// Avoid unfocused larger pages increasing scroll area
|
|
455
|
+
// e.g. when a smaller screen is pushed over a larger one on web
|
|
456
|
+
overflow: isTopmost ? undefined : 'hidden',
|
|
457
|
+
marginTop: headerTransparent || headerMode === 'screen' ? 0 :
|
|
458
|
+
// Add offset for non-transparent floating header
|
|
459
|
+
isFloatHeaderAbsolute ?
|
|
460
|
+
// If header is absolute, offset the card by the header height
|
|
461
|
+
headerHeight?.value :
|
|
462
|
+
// Otherwise, the in-flow float header already takes the
|
|
463
|
+
// focused header's space, so offset by the difference
|
|
464
|
+
headerHeight && focusedHeaderHeight ? headerHeight.value - focusedHeaderHeight.value : 0
|
|
465
|
+
},
|
|
466
|
+
children: /*#__PURE__*/_jsx(CardContainer, {
|
|
467
|
+
index: index,
|
|
468
|
+
interpolationIndex: interpolationIndex,
|
|
469
|
+
modal: isModal,
|
|
470
|
+
active: isTopmost,
|
|
471
|
+
focused: focused,
|
|
472
|
+
opening: openingRouteKeys.includes(route.key),
|
|
473
|
+
closing: closingRouteKeys.includes(route.key),
|
|
474
|
+
layout: layout,
|
|
475
|
+
gesture: gesture,
|
|
476
|
+
scene: scene,
|
|
477
|
+
safeAreaInsetTop: safeAreaInsetTop,
|
|
478
|
+
safeAreaInsetRight: safeAreaInsetRight,
|
|
479
|
+
safeAreaInsetBottom: safeAreaInsetBottom,
|
|
480
|
+
safeAreaInsetLeft: safeAreaInsetLeft,
|
|
481
|
+
onGestureStart: onGestureStart,
|
|
482
|
+
onGestureCancel: onGestureCancel,
|
|
483
|
+
onGestureEnd: onGestureEnd,
|
|
484
|
+
headerHeight: headerHeight,
|
|
485
|
+
isParentHeaderShown: isParentHeaderShown,
|
|
486
|
+
onHeaderHeightChange: this.handleHeaderLayout,
|
|
487
|
+
getPreviousScene: this.getPreviousScene,
|
|
488
|
+
getFocusedRoute: this.getFocusedRoute,
|
|
489
|
+
renderHeader: renderHeader,
|
|
490
|
+
onOpenRoute: onOpenRoute,
|
|
491
|
+
onCloseRoute: onCloseRoute,
|
|
492
|
+
onTransitionStart: onTransitionStart,
|
|
493
|
+
onTransitionEnd: onTransitionEnd,
|
|
494
|
+
preloaded: isInactive,
|
|
444
495
|
children: scene.descriptor.render()
|
|
445
496
|
})
|
|
446
497
|
}, route.key);
|