@react-navigation/stack 7.4.7 → 7.4.9
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/HeaderSegment.js +19 -20
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/Stack/CardA11yWrapper.js +2 -3
- package/lib/module/views/Stack/CardA11yWrapper.js.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/views/Header/HeaderSegment.tsx +27 -36
- package/src/views/Stack/CardA11yWrapper.tsx +14 -12
|
@@ -4,7 +4,6 @@ import { getDefaultHeaderHeight, Header, HeaderBackButton, HeaderTitle } from '@
|
|
|
4
4
|
import { useLocale } from '@react-navigation/native';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Platform, StyleSheet } from 'react-native';
|
|
7
|
-
import { memoize } from "../../utils/memoize.js";
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
8
|
export function HeaderSegment(props) {
|
|
10
9
|
const {
|
|
@@ -40,24 +39,6 @@ export function HeaderSegment(props) {
|
|
|
40
39
|
width
|
|
41
40
|
});
|
|
42
41
|
};
|
|
43
|
-
const getInterpolatedStyle = memoize((styleInterpolator, layout, current, next, titleLayout, leftLabelLayout, headerHeight) => styleInterpolator({
|
|
44
|
-
current: {
|
|
45
|
-
progress: current
|
|
46
|
-
},
|
|
47
|
-
next: next && {
|
|
48
|
-
progress: next
|
|
49
|
-
},
|
|
50
|
-
direction,
|
|
51
|
-
layouts: {
|
|
52
|
-
header: {
|
|
53
|
-
height: headerHeight,
|
|
54
|
-
width: layout.width
|
|
55
|
-
},
|
|
56
|
-
screen: layout,
|
|
57
|
-
title: titleLayout,
|
|
58
|
-
leftLabel: leftLabelLayout
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
42
|
const {
|
|
62
43
|
progress,
|
|
63
44
|
layout,
|
|
@@ -90,13 +71,31 @@ export function HeaderSegment(props) {
|
|
|
90
71
|
const {
|
|
91
72
|
height = defaultHeight
|
|
92
73
|
} = StyleSheet.flatten(customHeaderStyle || {});
|
|
74
|
+
const headerHeight = typeof height === 'number' ? height : defaultHeight;
|
|
93
75
|
const {
|
|
94
76
|
titleStyle,
|
|
95
77
|
leftButtonStyle,
|
|
96
78
|
leftLabelStyle,
|
|
97
79
|
rightButtonStyle,
|
|
98
80
|
backgroundStyle
|
|
99
|
-
} =
|
|
81
|
+
} = React.useMemo(() => styleInterpolator({
|
|
82
|
+
current: {
|
|
83
|
+
progress: progress.current
|
|
84
|
+
},
|
|
85
|
+
next: progress.next && {
|
|
86
|
+
progress: progress.next
|
|
87
|
+
},
|
|
88
|
+
direction,
|
|
89
|
+
layouts: {
|
|
90
|
+
header: {
|
|
91
|
+
height: headerHeight,
|
|
92
|
+
width: layout.width
|
|
93
|
+
},
|
|
94
|
+
screen: layout,
|
|
95
|
+
title: titleLayout,
|
|
96
|
+
leftLabel: leftLabelLayout
|
|
97
|
+
}
|
|
98
|
+
}), [styleInterpolator, progress, direction, headerHeight, layout, titleLayout, leftLabelLayout]);
|
|
100
99
|
const headerLeft = left ? props => left({
|
|
101
100
|
...props,
|
|
102
101
|
href: backHref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDefaultHeaderHeight","Header","HeaderBackButton","HeaderTitle","useLocale","React","Platform","StyleSheet","
|
|
1
|
+
{"version":3,"names":["getDefaultHeaderHeight","Header","HeaderBackButton","HeaderTitle","useLocale","React","Platform","StyleSheet","jsx","_jsx","HeaderSegment","props","direction","leftLabelLayout","setLeftLabelLayout","useState","undefined","titleLayout","setTitleLayout","handleTitleLayout","e","height","width","nativeEvent","layout","handleLeftLabelLayout","progress","modal","onGoBack","backHref","headerTitle","title","headerLeft","left","headerRight","right","headerBackImage","headerBackTitle","headerBackButtonDisplayMode","OS","headerBackTruncatedTitle","headerBackAccessibilityLabel","headerBackTestID","headerBackAllowFontScaling","headerBackTitleStyle","headerTitleContainerStyle","headerLeftContainerStyle","headerRightContainerStyle","headerBackgroundContainerStyle","headerStyle","customHeaderStyle","headerStatusBarHeight","styleInterpolator","rest","defaultHeight","flatten","headerHeight","titleStyle","leftButtonStyle","leftLabelStyle","rightButtonStyle","backgroundStyle","useMemo","current","next","layouts","header","screen","leftLabel","href","backImage","accessibilityLabel","testID","allowFontScaling","onPress","label","truncatedLabel","labelStyle","onLabelLayout","screenLayout","canGoBack","Boolean","onLayout"],"sourceRoot":"../../../../src","sources":["views/Header/HeaderSegment.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,MAAM,EACNC,gBAAgB,EAEhBC,WAAW,QACN,4BAA4B;AACnC,SAASC,SAAS,QAAQ,0BAA0B;AACpD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAEEC,QAAQ,EACRC,UAAU,QAEL,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAoBtB,OAAO,SAASC,aAAaA,CAACC,KAAY,EAAE;EAC1C,MAAM;IAAEC;EAAU,CAAC,GAAGR,SAAS,CAAC,CAAC;EAEjC,MAAM,CAACS,eAAe,EAAEC,kBAAkB,CAAC,GAAGT,KAAK,CAACU,QAAQ,CAE1DC,SAAS,CAAC;EAEZ,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGb,KAAK,CAACU,QAAQ,CAClDC,SACF,CAAC;EAED,MAAMG,iBAAiB,GAAIC,CAAoB,IAAK;IAClD,MAAM;MAAEC,MAAM;MAAEC;IAAM,CAAC,GAAGF,CAAC,CAACG,WAAW,CAACC,MAAM;IAE9CN,cAAc,CAAED,WAAW,IAAK;MAC9B,IACEA,WAAW,IACXI,MAAM,KAAKJ,WAAW,CAACI,MAAM,IAC7BC,KAAK,KAAKL,WAAW,CAACK,KAAK,EAC3B;QACA,OAAOL,WAAW;MACpB;MAEA,OAAO;QAAEI,MAAM;QAA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,KAAK,CAAC;IACJ,GAAGxB,KAAK;IACRqE,SAAS,EAAEC,OAAO,CAACrD,QAAQ;EAC7B,CAAC,CAAC,GACJZ,SAAS;EAEb,MAAMc,WAA8C,GAClD,OAAOC,KAAK,KAAK,UAAU,GACtBpB,KAAK,iBAAKF,IAAA,CAACN,WAAW;IAAA,GAAKQ,KAAK;IAAEuE,QAAQ,EAAE/D;EAAkB,CAAE,CAAC,GACjER,KAAK,IAAKoB,KAAK,CAAC;IAAE,GAAGpB,KAAK;IAAEuE,QAAQ,EAAE/D;EAAkB,CAAC,CAAC;EAEjE,oBACEV,IAAA,CAACR,MAAM;IACL0B,KAAK,EAAEA,KAAM;IACbH,MAAM,EAAEA,MAAO;IACfM,WAAW,EAAEA,WAAY;IACzBE,UAAU,EAAEA,UAAW;IACvBE,WAAW,EAAEA,WAAY;IACzBW,yBAAyB,EAAE,CAACY,UAAU,EAAEZ,yBAAyB,CAAE;IACnEC,wBAAwB,EAAE,CAACY,eAAe,EAAEZ,wBAAwB,CAAE;IACtEC,yBAAyB,EAAE,CAACa,gBAAgB,EAAEb,yBAAyB,CAAE;IACzET,2BAA2B,EAAEA,2BAA4B;IACzDU,8BAA8B,EAAE,CAC9Ba,eAAe,EACfb,8BAA8B,CAC9B;IACFC,WAAW,EAAEC,iBAAkB;IAC/BC,qBAAqB,EAAEA,qBAAsB;IAAA,GACzCE;EAAI,CACT,CAAC;AAEN","ignoreList":[]}
|
|
@@ -21,8 +21,7 @@ export const CardA11yWrapper = /*#__PURE__*/React.forwardRef(({
|
|
|
21
21
|
return /*#__PURE__*/_jsx(View, {
|
|
22
22
|
"aria-hidden": !focused,
|
|
23
23
|
pointerEvents: (animated ? inert : !focused) ? 'none' : 'box-none',
|
|
24
|
-
style: {
|
|
25
|
-
...StyleSheet.absoluteFillObject,
|
|
24
|
+
style: [StyleSheet.absoluteFill, {
|
|
26
25
|
// This is necessary to avoid unfocused larger pages increasing scroll area
|
|
27
26
|
// The issue can be seen on the web when a smaller screen is pushed over a larger one
|
|
28
27
|
overflow: active ? undefined : 'hidden',
|
|
@@ -32,7 +31,7 @@ export const CardA11yWrapper = /*#__PURE__*/React.forwardRef(({
|
|
|
32
31
|
// This is also necessary for a11y on web
|
|
33
32
|
// @ts-expect-error visibility is only available on web
|
|
34
33
|
visibility: isHidden ? 'hidden' : 'visible'
|
|
35
|
-
}
|
|
34
|
+
}]
|
|
36
35
|
// Make sure this view is not removed on the new architecture, as it causes focus loss during navigation on Android.
|
|
37
36
|
// This can happen when the view flattening results in different trees - due to `overflow` style changing in a parent.
|
|
38
37
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","StyleSheet","View","jsx","_jsx","CardA11yWrapper","forwardRef","focused","active","animated","isNextScreenTransparent","detachCurrentScreen","children","ref","inert","setInert","useState","useImperativeHandle","isHidden","pointerEvents","style","
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","View","jsx","_jsx","CardA11yWrapper","forwardRef","focused","active","animated","isNextScreenTransparent","detachCurrentScreen","children","ref","inert","setInert","useState","useImperativeHandle","isHidden","pointerEvents","style","absoluteFill","overflow","undefined","display","OS","visibility","collapsable","displayName"],"sourceRoot":"../../../../src","sources":["views/Stack/CardA11yWrapper.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAa1D,OAAO,MAAMC,eAAe,gBAAGN,KAAK,CAACO,UAAU,CAC7C,CACE;EACEC,OAAO;EACPC,MAAM;EACNC,QAAQ;EACRC,uBAAuB;EACvBC,mBAAmB;EACnBC;AACK,CAAC,EACRC,GAAkC,KAC/B;EACH;EACA;EACA,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGhB,KAAK,CAACiB,QAAQ,CAAC,KAAK,CAAC;EAE/CjB,KAAK,CAACkB,mBAAmB,CAACJ,GAAG,EAAE,OAAO;IAAEE;EAAS,CAAC,CAAC,EAAE,EAAE,CAAC;EAExD,MAAMG,QAAQ,GACZ,CAACT,QAAQ,IACTC,uBAAuB,KAAK,KAAK,IACjCC,mBAAmB,KAAK,KAAK,IAC7B,CAACJ,OAAO;EAEV,oBACEH,IAAA,CAACF,IAAI;IACH,eAAa,CAACK,OAAQ;IACtBY,aAAa,EAAE,CAACV,QAAQ,GAAGK,KAAK,GAAG,CAACP,OAAO,IAAI,MAAM,GAAG,UAAW;IACnEa,KAAK,EAAE,CACLnB,UAAU,CAACoB,YAAY,EACvB;MACE;MACA;MACAC,QAAQ,EAAEd,MAAM,GAAGe,SAAS,GAAG,QAAQ;MACvC;MACAC,OAAO,EAAExB,QAAQ,CAACyB,EAAE,KAAK,KAAK,IAAIP,QAAQ,GAAG,MAAM,GAAG,MAAM;MAC5D;MACA;MACA;MACAQ,UAAU,EAAER,QAAQ,GAAG,QAAQ,GAAG;IACpC,CAAC;IAEH;IACA;IAAA;IACAS,WAAW,EAAE,KAAM;IAAAf,QAAA,EAElBA;EAAQ,CACL,CAAC;AAEX,CACF,CAAC;AAEDP,eAAe,CAACuB,WAAW,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderSegment.d.ts","sourceRoot":"","sources":["../../../../../src/views/Header/HeaderSegment.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HeaderSegment.d.ts","sourceRoot":"","sources":["../../../../../src/views/Header/HeaderSegment.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,KAAK,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,GAAG;IAC/D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,iBAAiB,EAAE,4BAA4B,CAAC;CACjD,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,2CAwKzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardA11yWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/CardA11yWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,EAAE,OAAO,CAAC;IACjC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,CAAC;AAExE,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"CardA11yWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/CardA11yWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,EAAE,OAAO,CAAC;IACjC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,CAAC;AAExE,eAAO,MAAM,eAAe,kFAkD3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/stack",
|
|
3
3
|
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
|
4
|
-
"version": "7.4.
|
|
4
|
+
"version": "7.4.9",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"clean": "del lib"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@react-navigation/elements": "^2.6.
|
|
48
|
+
"@react-navigation/elements": "^2.6.5",
|
|
49
49
|
"color": "^4.2.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@jest/globals": "^30.0.0",
|
|
53
|
-
"@react-navigation/native": "^7.1.
|
|
53
|
+
"@react-navigation/native": "^7.1.18",
|
|
54
54
|
"@testing-library/react-native": "^13.2.0",
|
|
55
55
|
"@types/color": "^4.2.0",
|
|
56
56
|
"@types/react": "~19.0.10",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"typescript": "^5.8.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@react-navigation/native": "^7.1.
|
|
68
|
+
"@react-navigation/native": "^7.1.18",
|
|
69
69
|
"react": ">= 18.2.0",
|
|
70
70
|
"react-native": "*",
|
|
71
71
|
"react-native-gesture-handler": ">= 2.0.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
]
|
|
91
91
|
]
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "5a0c91b7102ea2a005f705d08d5b05719a1cc066"
|
|
94
94
|
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
import { useLocale } from '@react-navigation/native';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import {
|
|
11
|
-
Animated,
|
|
12
11
|
type LayoutChangeEvent,
|
|
13
12
|
Platform,
|
|
14
13
|
StyleSheet,
|
|
@@ -21,7 +20,6 @@ import type {
|
|
|
21
20
|
StackHeaderOptions,
|
|
22
21
|
StackHeaderStyleInterpolator,
|
|
23
22
|
} from '../../types';
|
|
24
|
-
import { memoize } from '../../utils/memoize';
|
|
25
23
|
|
|
26
24
|
type Props = Omit<StackHeaderOptions, 'headerStatusBarHeight'> & {
|
|
27
25
|
headerStatusBarHeight: number;
|
|
@@ -75,32 +73,6 @@ export function HeaderSegment(props: Props) {
|
|
|
75
73
|
setLeftLabelLayout({ height, width });
|
|
76
74
|
};
|
|
77
75
|
|
|
78
|
-
const getInterpolatedStyle = memoize(
|
|
79
|
-
(
|
|
80
|
-
styleInterpolator: StackHeaderStyleInterpolator,
|
|
81
|
-
layout: Layout,
|
|
82
|
-
current: Animated.AnimatedInterpolation<number>,
|
|
83
|
-
next: Animated.AnimatedInterpolation<number> | undefined,
|
|
84
|
-
titleLayout: Layout | undefined,
|
|
85
|
-
leftLabelLayout: Layout | undefined,
|
|
86
|
-
headerHeight: number
|
|
87
|
-
) =>
|
|
88
|
-
styleInterpolator({
|
|
89
|
-
current: { progress: current },
|
|
90
|
-
next: next && { progress: next },
|
|
91
|
-
direction,
|
|
92
|
-
layouts: {
|
|
93
|
-
header: {
|
|
94
|
-
height: headerHeight,
|
|
95
|
-
width: layout.width,
|
|
96
|
-
},
|
|
97
|
-
screen: layout,
|
|
98
|
-
title: titleLayout,
|
|
99
|
-
leftLabel: leftLabelLayout,
|
|
100
|
-
},
|
|
101
|
-
})
|
|
102
|
-
);
|
|
103
|
-
|
|
104
76
|
const {
|
|
105
77
|
progress,
|
|
106
78
|
layout,
|
|
@@ -140,20 +112,39 @@ export function HeaderSegment(props: Props) {
|
|
|
140
112
|
customHeaderStyle || {}
|
|
141
113
|
) as ViewStyle;
|
|
142
114
|
|
|
115
|
+
const headerHeight = typeof height === 'number' ? height : defaultHeight;
|
|
116
|
+
|
|
143
117
|
const {
|
|
144
118
|
titleStyle,
|
|
145
119
|
leftButtonStyle,
|
|
146
120
|
leftLabelStyle,
|
|
147
121
|
rightButtonStyle,
|
|
148
122
|
backgroundStyle,
|
|
149
|
-
} =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
123
|
+
} = React.useMemo(
|
|
124
|
+
() =>
|
|
125
|
+
styleInterpolator({
|
|
126
|
+
current: { progress: progress.current },
|
|
127
|
+
next: progress.next && { progress: progress.next },
|
|
128
|
+
direction,
|
|
129
|
+
layouts: {
|
|
130
|
+
header: {
|
|
131
|
+
height: headerHeight,
|
|
132
|
+
width: layout.width,
|
|
133
|
+
},
|
|
134
|
+
screen: layout,
|
|
135
|
+
title: titleLayout,
|
|
136
|
+
leftLabel: leftLabelLayout,
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
139
|
+
[
|
|
140
|
+
styleInterpolator,
|
|
141
|
+
progress,
|
|
142
|
+
direction,
|
|
143
|
+
headerHeight,
|
|
144
|
+
layout,
|
|
145
|
+
titleLayout,
|
|
146
|
+
leftLabelLayout,
|
|
147
|
+
]
|
|
157
148
|
);
|
|
158
149
|
|
|
159
150
|
const headerLeft: StackHeaderOptions['headerLeft'] = left
|
|
@@ -40,18 +40,20 @@ export const CardA11yWrapper = React.forwardRef(
|
|
|
40
40
|
<View
|
|
41
41
|
aria-hidden={!focused}
|
|
42
42
|
pointerEvents={(animated ? inert : !focused) ? 'none' : 'box-none'}
|
|
43
|
-
style={
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
style={[
|
|
44
|
+
StyleSheet.absoluteFill,
|
|
45
|
+
{
|
|
46
|
+
// This is necessary to avoid unfocused larger pages increasing scroll area
|
|
47
|
+
// The issue can be seen on the web when a smaller screen is pushed over a larger one
|
|
48
|
+
overflow: active ? undefined : 'hidden',
|
|
49
|
+
// We use visibility on web
|
|
50
|
+
display: Platform.OS !== 'web' && isHidden ? 'none' : 'flex',
|
|
51
|
+
// Hide unfocused screens when animation isn't enabled
|
|
52
|
+
// This is also necessary for a11y on web
|
|
53
|
+
// @ts-expect-error visibility is only available on web
|
|
54
|
+
visibility: isHidden ? 'hidden' : 'visible',
|
|
55
|
+
},
|
|
56
|
+
]}
|
|
55
57
|
// Make sure this view is not removed on the new architecture, as it causes focus loss during navigation on Android.
|
|
56
58
|
// This can happen when the view flattening results in different trees - due to `overflow` style changing in a parent.
|
|
57
59
|
collapsable={false}
|