@react-navigation/native-stack 7.3.8 → 7.3.10
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/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/debounce.d.ts.map +1 -0
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/src/utils/useDismissedRouteError.d.ts.map +1 -0
- package/lib/typescript/src/utils/useInvalidPreventRemoveError.d.ts.map +1 -0
- package/lib/typescript/src/views/FontProcessor.d.ts.map +1 -0
- package/lib/typescript/src/views/FontProcessor.native.d.ts.map +1 -0
- package/lib/typescript/src/views/FooterComponent.d.ts.map +1 -0
- package/lib/typescript/src/views/NativeStackView.d.ts.map +1 -0
- package/lib/typescript/src/views/NativeStackView.native.d.ts.map +1 -0
- package/lib/typescript/src/views/useHeaderConfigProps.d.ts.map +1 -0
- package/package.json +14 -26
- package/lib/commonjs/index.js +0 -27
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/navigators/createNativeStackNavigator.js +0 -71
- package/lib/commonjs/navigators/createNativeStackNavigator.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/types.js +0 -6
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/debounce.js +0 -16
- package/lib/commonjs/utils/debounce.js.map +0 -1
- package/lib/commonjs/utils/getModalRoutesKeys.js +0 -17
- package/lib/commonjs/utils/getModalRoutesKeys.js.map +0 -1
- package/lib/commonjs/utils/useAnimatedHeaderHeight.js +0 -19
- package/lib/commonjs/utils/useAnimatedHeaderHeight.js.map +0 -1
- package/lib/commonjs/utils/useDismissedRouteError.js +0 -23
- package/lib/commonjs/utils/useDismissedRouteError.js.map +0 -1
- package/lib/commonjs/utils/useInvalidPreventRemoveError.js +0 -26
- package/lib/commonjs/utils/useInvalidPreventRemoveError.js.map +0 -1
- package/lib/commonjs/views/FontProcessor.js +0 -10
- package/lib/commonjs/views/FontProcessor.js.map +0 -1
- package/lib/commonjs/views/FontProcessor.native.js +0 -18
- package/lib/commonjs/views/FontProcessor.native.js.map +0 -1
- package/lib/commonjs/views/FooterComponent.js +0 -19
- package/lib/commonjs/views/FooterComponent.js.map +0 -1
- package/lib/commonjs/views/NativeStackView.js +0 -139
- package/lib/commonjs/views/NativeStackView.js.map +0 -1
- package/lib/commonjs/views/NativeStackView.native.js +0 -478
- package/lib/commonjs/views/NativeStackView.native.js.map +0 -1
- package/lib/commonjs/views/useHeaderConfigProps.js +0 -211
- package/lib/commonjs/views/useHeaderConfigProps.js.map +0 -1
- package/lib/typescript/commonjs/package.json +0 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/navigators/createNativeStackNavigator.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/debounce.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/getModalRoutesKeys.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/useAnimatedHeaderHeight.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/useDismissedRouteError.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/useInvalidPreventRemoveError.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/views/FontProcessor.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/views/FontProcessor.native.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/views/FooterComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/views/NativeStackView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/views/NativeStackView.native.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/views/useHeaderConfigProps.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -17
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/navigators/createNativeStackNavigator.d.ts +0 -16
- package/lib/typescript/module/src/navigators/createNativeStackNavigator.d.ts.map +0 -1
- package/lib/typescript/module/src/types.d.ts +0 -623
- package/lib/typescript/module/src/types.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/debounce.d.ts +0 -2
- package/lib/typescript/module/src/utils/debounce.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/getModalRoutesKeys.d.ts +0 -4
- package/lib/typescript/module/src/utils/getModalRoutesKeys.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/useAnimatedHeaderHeight.d.ts +0 -5
- package/lib/typescript/module/src/utils/useAnimatedHeaderHeight.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/useDismissedRouteError.d.ts +0 -6
- package/lib/typescript/module/src/utils/useDismissedRouteError.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/useInvalidPreventRemoveError.d.ts +0 -3
- package/lib/typescript/module/src/utils/useInvalidPreventRemoveError.d.ts.map +0 -1
- package/lib/typescript/module/src/views/FontProcessor.d.ts +0 -2
- package/lib/typescript/module/src/views/FontProcessor.d.ts.map +0 -1
- package/lib/typescript/module/src/views/FontProcessor.native.d.ts +0 -2
- package/lib/typescript/module/src/views/FontProcessor.native.d.ts.map +0 -1
- package/lib/typescript/module/src/views/FooterComponent.d.ts +0 -7
- package/lib/typescript/module/src/views/FooterComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/views/NativeStackView.d.ts +0 -11
- package/lib/typescript/module/src/views/NativeStackView.d.ts.map +0 -1
- package/lib/typescript/module/src/views/NativeStackView.native.d.ts +0 -11
- package/lib/typescript/module/src/views/NativeStackView.native.d.ts.map +0 -1
- package/lib/typescript/module/src/views/useHeaderConfigProps.d.ts +0 -44
- package/lib/typescript/module/src/views/useHeaderConfigProps.d.ts.map +0 -1
- /package/lib/typescript/{module/package.json → package.json} +0 -0
- /package/lib/typescript/{commonjs/src → src}/index.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/navigators/createNativeStackNavigator.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/utils/debounce.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/utils/getModalRoutesKeys.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/utils/useAnimatedHeaderHeight.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/utils/useDismissedRouteError.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/utils/useInvalidPreventRemoveError.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/views/FontProcessor.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/views/FontProcessor.native.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/views/FooterComponent.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/views/NativeStackView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/views/NativeStackView.native.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/views/useHeaderConfigProps.d.ts +0 -0
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NativeStackView = NativeStackView;
|
|
7
|
-
var _elements = require("@react-navigation/elements");
|
|
8
|
-
var _native = require("@react-navigation/native");
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
var _useAnimatedHeaderHeight = require("../utils/useAnimatedHeaderHeight.js");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
-
const TRANSPARENT_PRESENTATIONS = ['transparentModal', 'containedTransparentModal'];
|
|
16
|
-
function NativeStackView({
|
|
17
|
-
state,
|
|
18
|
-
descriptors,
|
|
19
|
-
describe
|
|
20
|
-
}) {
|
|
21
|
-
const parentHeaderBack = React.useContext(_elements.HeaderBackContext);
|
|
22
|
-
const {
|
|
23
|
-
buildHref
|
|
24
|
-
} = (0, _native.useLinkBuilder)();
|
|
25
|
-
const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {
|
|
26
|
-
acc[route.key] = acc[route.key] || describe(route, true);
|
|
27
|
-
return acc;
|
|
28
|
-
}, {});
|
|
29
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.SafeAreaProviderCompat, {
|
|
30
|
-
children: state.routes.concat(state.preloadedRoutes).map((route, i) => {
|
|
31
|
-
const isFocused = state.index === i;
|
|
32
|
-
const previousKey = state.routes[i - 1]?.key;
|
|
33
|
-
const nextKey = state.routes[i + 1]?.key;
|
|
34
|
-
const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
|
|
35
|
-
const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
|
|
36
|
-
const {
|
|
37
|
-
options,
|
|
38
|
-
navigation,
|
|
39
|
-
render
|
|
40
|
-
} = descriptors[route.key] ?? preloadedDescriptors[route.key];
|
|
41
|
-
const headerBack = previousDescriptor ? {
|
|
42
|
-
title: (0, _elements.getHeaderTitle)(previousDescriptor.options, previousDescriptor.route.name),
|
|
43
|
-
href: buildHref(previousDescriptor.route.name, previousDescriptor.route.params)
|
|
44
|
-
} : parentHeaderBack;
|
|
45
|
-
const canGoBack = headerBack != null;
|
|
46
|
-
const {
|
|
47
|
-
header,
|
|
48
|
-
headerShown,
|
|
49
|
-
headerBackImageSource,
|
|
50
|
-
headerLeft,
|
|
51
|
-
headerTransparent,
|
|
52
|
-
headerBackTitle,
|
|
53
|
-
presentation,
|
|
54
|
-
contentStyle,
|
|
55
|
-
...rest
|
|
56
|
-
} = options;
|
|
57
|
-
const nextPresentation = nextDescriptor?.options.presentation;
|
|
58
|
-
const isPreloaded = preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;
|
|
59
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.Screen, {
|
|
60
|
-
focused: isFocused,
|
|
61
|
-
route: route,
|
|
62
|
-
navigation: navigation,
|
|
63
|
-
headerShown: headerShown,
|
|
64
|
-
headerTransparent: headerTransparent,
|
|
65
|
-
header: header !== undefined ? header({
|
|
66
|
-
back: headerBack,
|
|
67
|
-
options,
|
|
68
|
-
route,
|
|
69
|
-
navigation
|
|
70
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.Header, {
|
|
71
|
-
...rest,
|
|
72
|
-
back: headerBack,
|
|
73
|
-
title: (0, _elements.getHeaderTitle)(options, route.name),
|
|
74
|
-
headerLeft: typeof headerLeft === 'function' ? ({
|
|
75
|
-
label,
|
|
76
|
-
...rest
|
|
77
|
-
}) => headerLeft({
|
|
78
|
-
...rest,
|
|
79
|
-
label: headerBackTitle ?? label
|
|
80
|
-
}) : headerLeft === undefined && canGoBack ? ({
|
|
81
|
-
tintColor,
|
|
82
|
-
label,
|
|
83
|
-
...rest
|
|
84
|
-
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.HeaderBackButton, {
|
|
85
|
-
...rest,
|
|
86
|
-
label: headerBackTitle ?? label,
|
|
87
|
-
tintColor: tintColor,
|
|
88
|
-
backImage: headerBackImageSource !== undefined ? () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
89
|
-
source: headerBackImageSource,
|
|
90
|
-
resizeMode: "contain",
|
|
91
|
-
tintColor: tintColor,
|
|
92
|
-
style: styles.backImage
|
|
93
|
-
}) : undefined,
|
|
94
|
-
onPress: navigation.goBack
|
|
95
|
-
}) : headerLeft,
|
|
96
|
-
headerTransparent: headerTransparent
|
|
97
|
-
}),
|
|
98
|
-
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
99
|
-
display: (isFocused || nextPresentation != null && TRANSPARENT_PRESENTATIONS.includes(nextPresentation)) && !isPreloaded ? 'flex' : 'none'
|
|
100
|
-
}, presentation != null && TRANSPARENT_PRESENTATIONS.includes(presentation) ? {
|
|
101
|
-
backgroundColor: 'transparent'
|
|
102
|
-
} : null],
|
|
103
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.HeaderBackContext.Provider, {
|
|
104
|
-
value: headerBack,
|
|
105
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedHeaderHeightProvider, {
|
|
106
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
107
|
-
style: [styles.contentContainer, contentStyle],
|
|
108
|
-
children: render()
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
}, route.key);
|
|
113
|
-
})
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
const AnimatedHeaderHeightProvider = ({
|
|
117
|
-
children
|
|
118
|
-
}) => {
|
|
119
|
-
const headerHeight = (0, _elements.useHeaderHeight)();
|
|
120
|
-
const [animatedHeaderHeight] = React.useState(() => new _reactNative.Animated.Value(headerHeight));
|
|
121
|
-
React.useEffect(() => {
|
|
122
|
-
animatedHeaderHeight.setValue(headerHeight);
|
|
123
|
-
}, [animatedHeaderHeight, headerHeight]);
|
|
124
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_useAnimatedHeaderHeight.AnimatedHeaderHeightContext.Provider, {
|
|
125
|
-
value: animatedHeaderHeight,
|
|
126
|
-
children: children
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
const styles = _reactNative.StyleSheet.create({
|
|
130
|
-
contentContainer: {
|
|
131
|
-
flex: 1
|
|
132
|
-
},
|
|
133
|
-
backImage: {
|
|
134
|
-
height: 24,
|
|
135
|
-
width: 24,
|
|
136
|
-
margin: 3
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
//# sourceMappingURL=NativeStackView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_elements","require","_native","React","_interopRequireWildcard","_reactNative","_useAnimatedHeaderHeight","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TRANSPARENT_PRESENTATIONS","NativeStackView","state","descriptors","describe","parentHeaderBack","useContext","HeaderBackContext","buildHref","useLinkBuilder","preloadedDescriptors","preloadedRoutes","reduce","acc","route","key","jsx","SafeAreaProviderCompat","children","routes","concat","map","isFocused","index","previousKey","nextKey","previousDescriptor","undefined","nextDescriptor","options","navigation","render","headerBack","title","getHeaderTitle","name","href","params","canGoBack","header","headerShown","headerBackImageSource","headerLeft","headerTransparent","headerBackTitle","presentation","contentStyle","rest","nextPresentation","isPreloaded","Screen","focused","back","Header","label","tintColor","HeaderBackButton","backImage","Image","source","resizeMode","style","styles","onPress","goBack","StyleSheet","absoluteFill","display","includes","backgroundColor","Provider","value","AnimatedHeaderHeightProvider","View","contentContainer","headerHeight","useHeaderHeight","animatedHeaderHeight","useState","Animated","Value","useEffect","setValue","AnimatedHeaderHeightContext","create","flex","height","width","margin"],"sourceRoot":"../../../src","sources":["views/NativeStackView.tsx"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AASA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAC,uBAAA,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1,478 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NativeStackView = NativeStackView;
|
|
7
|
-
var _elements = require("@react-navigation/elements");
|
|
8
|
-
var _native = require("@react-navigation/native");
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
12
|
-
var _reactNativeScreens = require("react-native-screens");
|
|
13
|
-
var _debounce = require("../utils/debounce.js");
|
|
14
|
-
var _getModalRoutesKeys = require("../utils/getModalRoutesKeys.js");
|
|
15
|
-
var _useAnimatedHeaderHeight = require("../utils/useAnimatedHeaderHeight.js");
|
|
16
|
-
var _useDismissedRouteError = require("../utils/useDismissedRouteError.js");
|
|
17
|
-
var _useInvalidPreventRemoveError = require("../utils/useInvalidPreventRemoveError.js");
|
|
18
|
-
var _useHeaderConfigProps = require("./useHeaderConfigProps.js");
|
|
19
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
-
const ANDROID_DEFAULT_HEADER_HEIGHT = 56;
|
|
23
|
-
function isFabric() {
|
|
24
|
-
return 'nativeFabricUIManager' in global;
|
|
25
|
-
}
|
|
26
|
-
const useNativeDriver = _reactNative.Platform.OS !== 'web';
|
|
27
|
-
const SceneView = ({
|
|
28
|
-
index,
|
|
29
|
-
focused,
|
|
30
|
-
shouldFreeze,
|
|
31
|
-
descriptor,
|
|
32
|
-
previousDescriptor,
|
|
33
|
-
nextDescriptor,
|
|
34
|
-
isPresentationModal,
|
|
35
|
-
isPreloaded,
|
|
36
|
-
onWillDisappear,
|
|
37
|
-
onWillAppear,
|
|
38
|
-
onAppear,
|
|
39
|
-
onDisappear,
|
|
40
|
-
onDismissed,
|
|
41
|
-
onHeaderBackButtonClicked,
|
|
42
|
-
onNativeDismissCancelled,
|
|
43
|
-
onGestureCancel,
|
|
44
|
-
onSheetDetentChanged
|
|
45
|
-
}) => {
|
|
46
|
-
const {
|
|
47
|
-
route,
|
|
48
|
-
navigation,
|
|
49
|
-
options,
|
|
50
|
-
render
|
|
51
|
-
} = descriptor;
|
|
52
|
-
let {
|
|
53
|
-
animation,
|
|
54
|
-
animationMatchesGesture,
|
|
55
|
-
presentation = isPresentationModal ? 'modal' : 'card',
|
|
56
|
-
fullScreenGestureEnabled
|
|
57
|
-
} = options;
|
|
58
|
-
const {
|
|
59
|
-
animationDuration,
|
|
60
|
-
animationTypeForReplace = 'push',
|
|
61
|
-
fullScreenGestureShadowEnabled = true,
|
|
62
|
-
gestureEnabled,
|
|
63
|
-
gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',
|
|
64
|
-
gestureResponseDistance,
|
|
65
|
-
header,
|
|
66
|
-
headerBackButtonMenuEnabled,
|
|
67
|
-
headerShown,
|
|
68
|
-
headerBackground,
|
|
69
|
-
headerTransparent,
|
|
70
|
-
autoHideHomeIndicator,
|
|
71
|
-
keyboardHandlingEnabled,
|
|
72
|
-
navigationBarColor,
|
|
73
|
-
navigationBarTranslucent,
|
|
74
|
-
navigationBarHidden,
|
|
75
|
-
orientation,
|
|
76
|
-
sheetAllowedDetents = [1.0],
|
|
77
|
-
sheetLargestUndimmedDetentIndex = -1,
|
|
78
|
-
sheetGrabberVisible = false,
|
|
79
|
-
sheetCornerRadius = -1.0,
|
|
80
|
-
sheetElevation = 24,
|
|
81
|
-
sheetExpandsWhenScrolledToEdge = true,
|
|
82
|
-
sheetInitialDetentIndex = 0,
|
|
83
|
-
statusBarAnimation,
|
|
84
|
-
statusBarHidden,
|
|
85
|
-
statusBarStyle,
|
|
86
|
-
statusBarTranslucent,
|
|
87
|
-
statusBarBackgroundColor,
|
|
88
|
-
unstable_sheetFooter,
|
|
89
|
-
freezeOnBlur,
|
|
90
|
-
contentStyle
|
|
91
|
-
} = options;
|
|
92
|
-
if (gestureDirection === 'vertical' && _reactNative.Platform.OS === 'ios') {
|
|
93
|
-
// for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`
|
|
94
|
-
// so the screen can be dismissed from any point on screen.
|
|
95
|
-
// `animationMatchesGesture` needs to be set to `true` so the `animation` set by user can be used,
|
|
96
|
-
// otherwise `simple_push` will be used.
|
|
97
|
-
// Also, the default animation for this direction seems to be `slide_from_bottom`.
|
|
98
|
-
if (fullScreenGestureEnabled === undefined) {
|
|
99
|
-
fullScreenGestureEnabled = true;
|
|
100
|
-
}
|
|
101
|
-
if (animationMatchesGesture === undefined) {
|
|
102
|
-
animationMatchesGesture = true;
|
|
103
|
-
}
|
|
104
|
-
if (animation === undefined) {
|
|
105
|
-
animation = 'slide_from_bottom';
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// workaround for rn-screens where gestureDirection has to be set on both
|
|
110
|
-
// current and previous screen - software-mansion/react-native-screens/pull/1509
|
|
111
|
-
const nextGestureDirection = nextDescriptor?.options.gestureDirection;
|
|
112
|
-
const gestureDirectionOverride = nextGestureDirection != null ? nextGestureDirection : gestureDirection;
|
|
113
|
-
if (index === 0) {
|
|
114
|
-
// first screen should always be treated as `card`, it resolves problems with no header animation
|
|
115
|
-
// for navigator with first screen as `modal` and the next as `card`
|
|
116
|
-
presentation = 'card';
|
|
117
|
-
}
|
|
118
|
-
const {
|
|
119
|
-
colors
|
|
120
|
-
} = (0, _native.useTheme)();
|
|
121
|
-
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
122
|
-
const frame = (0, _reactNativeSafeAreaContext.useSafeAreaFrame)();
|
|
123
|
-
|
|
124
|
-
// `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.
|
|
125
|
-
const isModal = presentation === 'modal' || presentation === 'formSheet';
|
|
126
|
-
|
|
127
|
-
// Modals are fullscreen in landscape only on iPhone
|
|
128
|
-
const isIPhone = _reactNative.Platform.OS === 'ios' && !(_reactNative.Platform.isPad || _reactNative.Platform.isTV);
|
|
129
|
-
const isLandscape = frame.width > frame.height;
|
|
130
|
-
const isParentHeaderShown = React.useContext(_elements.HeaderShownContext);
|
|
131
|
-
const parentHeaderHeight = React.useContext(_elements.HeaderHeightContext);
|
|
132
|
-
const parentHeaderBack = React.useContext(_elements.HeaderBackContext);
|
|
133
|
-
const topInset = isParentHeaderShown || _reactNative.Platform.OS === 'ios' && isModal || isIPhone && isLandscape ? 0 : insets.top;
|
|
134
|
-
const {
|
|
135
|
-
preventedRoutes
|
|
136
|
-
} = (0, _native.usePreventRemoveContext)();
|
|
137
|
-
const defaultHeaderHeight = _reactNative.Platform.select({
|
|
138
|
-
// FIXME: Currently screens isn't using Material 3
|
|
139
|
-
// So our `getDefaultHeaderHeight` doesn't return the correct value
|
|
140
|
-
// So we hardcode the value here for now until screens is updated
|
|
141
|
-
android: ANDROID_DEFAULT_HEADER_HEIGHT + topInset,
|
|
142
|
-
default: (0, _elements.getDefaultHeaderHeight)(frame, isModal, topInset)
|
|
143
|
-
});
|
|
144
|
-
const [headerHeight, setHeaderHeight] = React.useState(defaultHeaderHeight);
|
|
145
|
-
|
|
146
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
|
-
const setHeaderHeightDebounced = React.useCallback(
|
|
148
|
-
// Debounce the header height updates to avoid excessive re-renders
|
|
149
|
-
(0, _debounce.debounce)(setHeaderHeight, 100), []);
|
|
150
|
-
const hasCustomHeader = header !== undefined;
|
|
151
|
-
let headerHeightCorrectionOffset = 0;
|
|
152
|
-
if (_reactNative.Platform.OS === 'android' && !hasCustomHeader) {
|
|
153
|
-
const statusBarHeight = _reactNative.StatusBar.currentHeight ?? 0;
|
|
154
|
-
|
|
155
|
-
// FIXME: On Android, the native header height is not correctly calculated
|
|
156
|
-
// It includes status bar height even if statusbar is not translucent
|
|
157
|
-
// And the statusbar value itself doesn't match the actual status bar height
|
|
158
|
-
// So we subtract the bogus status bar height and add the actual top inset
|
|
159
|
-
headerHeightCorrectionOffset = -statusBarHeight + topInset;
|
|
160
|
-
}
|
|
161
|
-
const rawAnimatedHeaderHeight = (0, _reactNative.useAnimatedValue)(defaultHeaderHeight);
|
|
162
|
-
const animatedHeaderHeight = React.useMemo(() => _reactNative.Animated.add(rawAnimatedHeaderHeight, headerHeightCorrectionOffset), [headerHeightCorrectionOffset, rawAnimatedHeaderHeight]);
|
|
163
|
-
|
|
164
|
-
// During the very first render topInset is > 0 when running
|
|
165
|
-
// in non edge-to-edge mode on Android, while on every consecutive render
|
|
166
|
-
// topInset === 0, causing header content to jump, as we add padding on the first frame,
|
|
167
|
-
// just to remove it in next one. To prevent this, when statusBarTranslucent is set,
|
|
168
|
-
// we apply additional padding in header only if its true.
|
|
169
|
-
// For more details see: https://github.com/react-navigation/react-navigation/pull/12014
|
|
170
|
-
const headerTopInsetEnabled = typeof statusBarTranslucent === 'boolean' ? statusBarTranslucent : topInset !== 0;
|
|
171
|
-
const canGoBack = previousDescriptor != null || parentHeaderBack != null;
|
|
172
|
-
const backTitle = previousDescriptor ? (0, _elements.getHeaderTitle)(previousDescriptor.options, previousDescriptor.route.name) : parentHeaderBack?.title;
|
|
173
|
-
const headerBack = React.useMemo(() => {
|
|
174
|
-
if (canGoBack) {
|
|
175
|
-
return {
|
|
176
|
-
href: undefined,
|
|
177
|
-
// No href needed for native
|
|
178
|
-
title: backTitle
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
return undefined;
|
|
182
|
-
}, [canGoBack, backTitle]);
|
|
183
|
-
const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;
|
|
184
|
-
const headerConfig = (0, _useHeaderConfigProps.useHeaderConfigProps)({
|
|
185
|
-
...options,
|
|
186
|
-
route,
|
|
187
|
-
headerBackButtonMenuEnabled: isRemovePrevented !== undefined ? !isRemovePrevented : headerBackButtonMenuEnabled,
|
|
188
|
-
headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : undefined,
|
|
189
|
-
headerHeight,
|
|
190
|
-
headerShown: header !== undefined ? false : headerShown,
|
|
191
|
-
headerTopInsetEnabled,
|
|
192
|
-
headerBack
|
|
193
|
-
});
|
|
194
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.NavigationContext.Provider, {
|
|
195
|
-
value: navigation,
|
|
196
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.NavigationRouteContext.Provider, {
|
|
197
|
-
value: route,
|
|
198
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeScreens.ScreenStackItem, {
|
|
199
|
-
screenId: route.key,
|
|
200
|
-
activityState: isPreloaded ? 0 : 2,
|
|
201
|
-
style: _reactNative.StyleSheet.absoluteFill,
|
|
202
|
-
accessibilityElementsHidden: !focused,
|
|
203
|
-
importantForAccessibility: focused ? 'auto' : 'no-hide-descendants',
|
|
204
|
-
customAnimationOnSwipe: animationMatchesGesture,
|
|
205
|
-
fullScreenSwipeEnabled: fullScreenGestureEnabled,
|
|
206
|
-
fullScreenSwipeShadowEnabled: fullScreenGestureShadowEnabled,
|
|
207
|
-
freezeOnBlur: freezeOnBlur,
|
|
208
|
-
gestureEnabled: _reactNative.Platform.OS === 'android' ?
|
|
209
|
-
// This prop enables handling of system back gestures on Android
|
|
210
|
-
// Since we handle them in JS side, we disable this
|
|
211
|
-
false : gestureEnabled,
|
|
212
|
-
homeIndicatorHidden: autoHideHomeIndicator,
|
|
213
|
-
hideKeyboardOnSwipe: keyboardHandlingEnabled,
|
|
214
|
-
navigationBarColor: navigationBarColor,
|
|
215
|
-
navigationBarTranslucent: navigationBarTranslucent,
|
|
216
|
-
navigationBarHidden: navigationBarHidden,
|
|
217
|
-
replaceAnimation: animationTypeForReplace,
|
|
218
|
-
stackPresentation: presentation === 'card' ? 'push' : presentation,
|
|
219
|
-
stackAnimation: animation,
|
|
220
|
-
screenOrientation: orientation,
|
|
221
|
-
sheetAllowedDetents: sheetAllowedDetents,
|
|
222
|
-
sheetLargestUndimmedDetentIndex: sheetLargestUndimmedDetentIndex,
|
|
223
|
-
sheetGrabberVisible: sheetGrabberVisible,
|
|
224
|
-
sheetInitialDetentIndex: sheetInitialDetentIndex,
|
|
225
|
-
sheetCornerRadius: sheetCornerRadius,
|
|
226
|
-
sheetElevation: sheetElevation,
|
|
227
|
-
sheetExpandsWhenScrolledToEdge: sheetExpandsWhenScrolledToEdge,
|
|
228
|
-
statusBarAnimation: statusBarAnimation,
|
|
229
|
-
statusBarHidden: statusBarHidden,
|
|
230
|
-
statusBarStyle: statusBarStyle,
|
|
231
|
-
statusBarColor: statusBarBackgroundColor,
|
|
232
|
-
statusBarTranslucent: statusBarTranslucent,
|
|
233
|
-
swipeDirection: gestureDirectionOverride,
|
|
234
|
-
transitionDuration: animationDuration,
|
|
235
|
-
onWillAppear: onWillAppear,
|
|
236
|
-
onWillDisappear: onWillDisappear,
|
|
237
|
-
onAppear: onAppear,
|
|
238
|
-
onDisappear: onDisappear,
|
|
239
|
-
onDismissed: onDismissed,
|
|
240
|
-
onGestureCancel: onGestureCancel,
|
|
241
|
-
onSheetDetentChanged: onSheetDetentChanged,
|
|
242
|
-
gestureResponseDistance: gestureResponseDistance,
|
|
243
|
-
nativeBackButtonDismissalEnabled: false // on Android
|
|
244
|
-
,
|
|
245
|
-
onHeaderBackButtonClicked: onHeaderBackButtonClicked,
|
|
246
|
-
preventNativeDismiss: isRemovePrevented // on iOS
|
|
247
|
-
,
|
|
248
|
-
onNativeDismissCancelled: onNativeDismissCancelled
|
|
249
|
-
// Unfortunately, because of the bug that exists on Fabric, where native event drivers
|
|
250
|
-
// for Animated objects are being created after the first notifications about the header height
|
|
251
|
-
// from the native side, `onHeaderHeightChange` event does not notify
|
|
252
|
-
// `animatedHeaderHeight` about initial values on appearing screens at the moment.
|
|
253
|
-
,
|
|
254
|
-
onHeaderHeightChange: _reactNative.Animated.event([{
|
|
255
|
-
nativeEvent: {
|
|
256
|
-
headerHeight: rawAnimatedHeaderHeight
|
|
257
|
-
}
|
|
258
|
-
}], {
|
|
259
|
-
useNativeDriver,
|
|
260
|
-
listener: e => {
|
|
261
|
-
if (_reactNative.Platform.OS === 'android' && (options.headerBackground != null || options.headerTransparent)) {
|
|
262
|
-
// FIXME: On Android, we get 0 if the header is translucent
|
|
263
|
-
// So we set a default height in that case
|
|
264
|
-
setHeaderHeight(ANDROID_DEFAULT_HEADER_HEIGHT + topInset);
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
if (e.nativeEvent && typeof e.nativeEvent === 'object' && 'headerHeight' in e.nativeEvent && typeof e.nativeEvent.headerHeight === 'number') {
|
|
268
|
-
const headerHeight = e.nativeEvent.headerHeight + headerHeightCorrectionOffset;
|
|
269
|
-
|
|
270
|
-
// Only debounce if header has large title or search bar
|
|
271
|
-
// As it's the only case where the header height can change frequently
|
|
272
|
-
const doesHeaderAnimate = _reactNative.Platform.OS === 'ios' && (options.headerLargeTitle || options.headerSearchBarOptions);
|
|
273
|
-
if (doesHeaderAnimate) {
|
|
274
|
-
setHeaderHeightDebounced(headerHeight);
|
|
275
|
-
} else {
|
|
276
|
-
setHeaderHeight(headerHeight);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}),
|
|
281
|
-
contentStyle: [presentation !== 'transparentModal' && presentation !== 'containedTransparentModal' && {
|
|
282
|
-
backgroundColor: colors.background
|
|
283
|
-
}, contentStyle],
|
|
284
|
-
headerConfig: headerConfig,
|
|
285
|
-
unstable_sheetFooter: unstable_sheetFooter
|
|
286
|
-
// When ts-expect-error is added, it affects all the props below it
|
|
287
|
-
// So we keep any props that need it at the end
|
|
288
|
-
// Otherwise invalid props may not be caught by TypeScript
|
|
289
|
-
// @ts-expect-error: `shouldFreeze` is not available in lower RNScreens versions
|
|
290
|
-
,
|
|
291
|
-
shouldFreeze: shouldFreeze,
|
|
292
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_useAnimatedHeaderHeight.AnimatedHeaderHeightContext.Provider, {
|
|
293
|
-
value: animatedHeaderHeight,
|
|
294
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_elements.HeaderHeightContext.Provider, {
|
|
295
|
-
value: headerShown !== false ? headerHeight : parentHeaderHeight ?? 0,
|
|
296
|
-
children: [headerBackground != null ?
|
|
297
|
-
/*#__PURE__*/
|
|
298
|
-
/**
|
|
299
|
-
* To show a custom header background, we render it at the top of the screen below the header
|
|
300
|
-
* The header also needs to be positioned absolutely (with `translucent` style)
|
|
301
|
-
*/
|
|
302
|
-
(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
303
|
-
style: [styles.background, headerTransparent ? styles.translucent : null, {
|
|
304
|
-
height: headerHeight
|
|
305
|
-
}],
|
|
306
|
-
children: headerBackground()
|
|
307
|
-
}) : null, header !== undefined && headerShown !== false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
308
|
-
onLayout: e => {
|
|
309
|
-
const headerHeight = e.nativeEvent.layout.height;
|
|
310
|
-
setHeaderHeight(headerHeight);
|
|
311
|
-
rawAnimatedHeaderHeight.setValue(headerHeight);
|
|
312
|
-
},
|
|
313
|
-
style: [styles.header, headerTransparent ? styles.absolute : null],
|
|
314
|
-
children: header({
|
|
315
|
-
back: headerBack,
|
|
316
|
-
options,
|
|
317
|
-
route,
|
|
318
|
-
navigation
|
|
319
|
-
})
|
|
320
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.HeaderShownContext.Provider, {
|
|
321
|
-
value: isParentHeaderShown || headerShown !== false,
|
|
322
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.HeaderBackContext.Provider, {
|
|
323
|
-
value: headerBack,
|
|
324
|
-
children: render()
|
|
325
|
-
})
|
|
326
|
-
})]
|
|
327
|
-
})
|
|
328
|
-
})
|
|
329
|
-
}, route.key)
|
|
330
|
-
})
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
function NativeStackView({
|
|
334
|
-
state,
|
|
335
|
-
navigation,
|
|
336
|
-
descriptors,
|
|
337
|
-
describe
|
|
338
|
-
}) {
|
|
339
|
-
const {
|
|
340
|
-
setNextDismissedKey
|
|
341
|
-
} = (0, _useDismissedRouteError.useDismissedRouteError)(state);
|
|
342
|
-
(0, _useInvalidPreventRemoveError.useInvalidPreventRemoveError)(descriptors);
|
|
343
|
-
const modalRouteKeys = (0, _getModalRoutesKeys.getModalRouteKeys)(state.routes, descriptors);
|
|
344
|
-
const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {
|
|
345
|
-
acc[route.key] = acc[route.key] || describe(route, true);
|
|
346
|
-
return acc;
|
|
347
|
-
}, {});
|
|
348
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.SafeAreaProviderCompat, {
|
|
349
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeScreens.ScreenStack, {
|
|
350
|
-
style: styles.container,
|
|
351
|
-
children: state.routes.concat(state.preloadedRoutes).map((route, index) => {
|
|
352
|
-
const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key];
|
|
353
|
-
const isFocused = state.index === index;
|
|
354
|
-
const isBelowFocused = state.index - 1 === index;
|
|
355
|
-
const previousKey = state.routes[index - 1]?.key;
|
|
356
|
-
const nextKey = state.routes[index + 1]?.key;
|
|
357
|
-
const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
|
|
358
|
-
const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
|
|
359
|
-
const isModal = modalRouteKeys.includes(route.key);
|
|
360
|
-
const isPreloaded = preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;
|
|
361
|
-
|
|
362
|
-
// On Fabric, when screen is frozen, animated and reanimated values are not updated
|
|
363
|
-
// due to component being unmounted. To avoid this, we don't freeze the previous screen there
|
|
364
|
-
const shouldFreeze = isFabric() ? !isPreloaded && !isFocused && !isBelowFocused : !isPreloaded && !isFocused;
|
|
365
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SceneView, {
|
|
366
|
-
index: index,
|
|
367
|
-
focused: isFocused,
|
|
368
|
-
shouldFreeze: shouldFreeze,
|
|
369
|
-
descriptor: descriptor,
|
|
370
|
-
previousDescriptor: previousDescriptor,
|
|
371
|
-
nextDescriptor: nextDescriptor,
|
|
372
|
-
isPresentationModal: isModal,
|
|
373
|
-
isPreloaded: isPreloaded,
|
|
374
|
-
onWillDisappear: () => {
|
|
375
|
-
navigation.emit({
|
|
376
|
-
type: 'transitionStart',
|
|
377
|
-
data: {
|
|
378
|
-
closing: true
|
|
379
|
-
},
|
|
380
|
-
target: route.key
|
|
381
|
-
});
|
|
382
|
-
},
|
|
383
|
-
onWillAppear: () => {
|
|
384
|
-
navigation.emit({
|
|
385
|
-
type: 'transitionStart',
|
|
386
|
-
data: {
|
|
387
|
-
closing: false
|
|
388
|
-
},
|
|
389
|
-
target: route.key
|
|
390
|
-
});
|
|
391
|
-
},
|
|
392
|
-
onAppear: () => {
|
|
393
|
-
navigation.emit({
|
|
394
|
-
type: 'transitionEnd',
|
|
395
|
-
data: {
|
|
396
|
-
closing: false
|
|
397
|
-
},
|
|
398
|
-
target: route.key
|
|
399
|
-
});
|
|
400
|
-
},
|
|
401
|
-
onDisappear: () => {
|
|
402
|
-
navigation.emit({
|
|
403
|
-
type: 'transitionEnd',
|
|
404
|
-
data: {
|
|
405
|
-
closing: true
|
|
406
|
-
},
|
|
407
|
-
target: route.key
|
|
408
|
-
});
|
|
409
|
-
},
|
|
410
|
-
onDismissed: event => {
|
|
411
|
-
navigation.dispatch({
|
|
412
|
-
..._native.StackActions.pop(event.nativeEvent.dismissCount),
|
|
413
|
-
source: route.key,
|
|
414
|
-
target: state.key
|
|
415
|
-
});
|
|
416
|
-
setNextDismissedKey(route.key);
|
|
417
|
-
},
|
|
418
|
-
onHeaderBackButtonClicked: () => {
|
|
419
|
-
navigation.dispatch({
|
|
420
|
-
..._native.StackActions.pop(),
|
|
421
|
-
source: route.key,
|
|
422
|
-
target: state.key
|
|
423
|
-
});
|
|
424
|
-
},
|
|
425
|
-
onNativeDismissCancelled: event => {
|
|
426
|
-
navigation.dispatch({
|
|
427
|
-
..._native.StackActions.pop(event.nativeEvent.dismissCount),
|
|
428
|
-
source: route.key,
|
|
429
|
-
target: state.key
|
|
430
|
-
});
|
|
431
|
-
},
|
|
432
|
-
onGestureCancel: () => {
|
|
433
|
-
navigation.emit({
|
|
434
|
-
type: 'gestureCancel',
|
|
435
|
-
target: route.key
|
|
436
|
-
});
|
|
437
|
-
},
|
|
438
|
-
onSheetDetentChanged: event => {
|
|
439
|
-
navigation.emit({
|
|
440
|
-
type: 'sheetDetentChange',
|
|
441
|
-
target: route.key,
|
|
442
|
-
data: {
|
|
443
|
-
index: event.nativeEvent.index,
|
|
444
|
-
stable: event.nativeEvent.isStable
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}, route.key);
|
|
449
|
-
})
|
|
450
|
-
})
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
const styles = _reactNative.StyleSheet.create({
|
|
454
|
-
container: {
|
|
455
|
-
flex: 1
|
|
456
|
-
},
|
|
457
|
-
header: {
|
|
458
|
-
zIndex: 1
|
|
459
|
-
},
|
|
460
|
-
absolute: {
|
|
461
|
-
position: 'absolute',
|
|
462
|
-
top: 0,
|
|
463
|
-
start: 0,
|
|
464
|
-
end: 0
|
|
465
|
-
},
|
|
466
|
-
translucent: {
|
|
467
|
-
position: 'absolute',
|
|
468
|
-
top: 0,
|
|
469
|
-
start: 0,
|
|
470
|
-
end: 0,
|
|
471
|
-
zIndex: 1,
|
|
472
|
-
elevation: 1
|
|
473
|
-
},
|
|
474
|
-
background: {
|
|
475
|
-
overflow: 'hidden'
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
//# sourceMappingURL=NativeStackView.native.js.map
|