@react-navigation/native-stack 7.0.0-alpha.1 → 7.0.0-alpha.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/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createNativeStackNavigator.js +24 -24
- package/lib/commonjs/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/useAnimatedHeaderHeight.js +19 -0
- package/lib/commonjs/utils/useAnimatedHeaderHeight.js.map +1 -0
- package/lib/commonjs/utils/useDismissedRouteError.js +3 -4
- package/lib/commonjs/utils/useDismissedRouteError.js.map +1 -1
- package/lib/commonjs/utils/useInvalidPreventRemoveError.js +4 -5
- package/lib/commonjs/utils/useInvalidPreventRemoveError.js.map +1 -1
- package/lib/commonjs/views/DebugContainer.js +2 -2
- package/lib/commonjs/views/DebugContainer.js.map +1 -1
- package/lib/commonjs/views/DebugContainer.native.js +19 -7
- package/lib/commonjs/views/DebugContainer.native.js.map +1 -1
- package/lib/commonjs/views/FontProcessor.js.map +1 -1
- package/lib/commonjs/views/FontProcessor.native.js +2 -4
- package/lib/commonjs/views/FontProcessor.native.js.map +1 -1
- package/lib/commonjs/views/HeaderConfig.js +10 -23
- package/lib/commonjs/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.js +23 -11
- package/lib/commonjs/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.native.js +120 -42
- package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createNativeStackNavigator.js +21 -20
- package/lib/module/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/useAnimatedHeaderHeight.js +10 -0
- package/lib/module/utils/useAnimatedHeaderHeight.js.map +1 -0
- package/lib/module/utils/useDismissedRouteError.js +1 -2
- package/lib/module/utils/useDismissedRouteError.js.map +1 -1
- package/lib/module/utils/useInvalidPreventRemoveError.js +2 -3
- package/lib/module/utils/useInvalidPreventRemoveError.js.map +1 -1
- package/lib/module/views/DebugContainer.js.map +1 -1
- package/lib/module/views/DebugContainer.native.js +18 -4
- package/lib/module/views/DebugContainer.native.js.map +1 -1
- package/lib/module/views/FontProcessor.js.map +1 -1
- package/lib/module/views/FontProcessor.native.js +2 -4
- package/lib/module/views/FontProcessor.native.js.map +1 -1
- package/lib/module/views/HeaderConfig.js +10 -23
- package/lib/module/views/HeaderConfig.js.map +1 -1
- package/lib/module/views/NativeStackView.js +21 -9
- package/lib/module/views/NativeStackView.js.map +1 -1
- package/lib/module/views/NativeStackView.native.js +119 -41
- package/lib/module/views/NativeStackView.native.js.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts +4 -4
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +88 -10
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts +5 -0
- package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/src/views/DebugContainer.d.ts +2 -2
- package/lib/typescript/src/views/DebugContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/DebugContainer.native.d.ts +7 -2
- package/lib/typescript/src/views/DebugContainer.native.d.ts.map +1 -1
- package/lib/typescript/src/views/FontProcessor.native.d.ts.map +1 -1
- package/lib/typescript/src/views/HeaderConfig.d.ts +2 -3
- package/lib/typescript/src/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/src/views/NativeStackView.d.ts +3 -3
- package/lib/typescript/src/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/src/views/NativeStackView.native.d.ts +3 -3
- package/lib/typescript/src/views/NativeStackView.native.d.ts.map +1 -1
- package/package.json +16 -17
- package/src/index.tsx +5 -0
- package/src/navigators/createNativeStackNavigator.tsx +9 -5
- package/src/types.tsx +88 -11
- package/src/utils/useAnimatedHeaderHeight.tsx +18 -0
- package/src/views/DebugContainer.native.tsx +12 -6
- package/src/views/DebugContainer.tsx +1 -1
- package/src/views/FontProcessor.native.tsx +1 -2
- package/src/views/HeaderConfig.tsx +101 -131
- package/src/views/NativeStackView.native.tsx +198 -92
- package/src/views/NativeStackView.tsx +40 -26
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { Platform, View } from 'react-native';
|
|
3
|
-
// @ts-
|
|
4
|
+
// @ts-expect-error Getting private component
|
|
4
5
|
import AppContainer from 'react-native/Libraries/ReactNative/AppContainer';
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* This view must *not* be flattened.
|
|
8
|
+
* See https://github.com/software-mansion/react-native-screens/pull/1825
|
|
9
|
+
* for detailed explanation.
|
|
10
|
+
*/
|
|
11
|
+
export let DebugContainer = props => {
|
|
12
|
+
return /*#__PURE__*/React.createElement(View, _extends({}, props, {
|
|
13
|
+
collapsable: false
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
6
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
7
17
|
DebugContainer = props => {
|
|
8
18
|
const {
|
|
@@ -11,9 +21,13 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
11
21
|
} = props;
|
|
12
22
|
if (Platform.OS === 'ios' && stackPresentation !== 'push') {
|
|
13
23
|
// This is necessary for LogBox
|
|
14
|
-
return /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(View, rest
|
|
24
|
+
return /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(View, _extends({}, rest, {
|
|
25
|
+
collapsable: false
|
|
26
|
+
})));
|
|
15
27
|
}
|
|
16
|
-
return /*#__PURE__*/React.createElement(View, rest
|
|
28
|
+
return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
|
|
29
|
+
collapsable: false
|
|
30
|
+
}));
|
|
17
31
|
};
|
|
18
32
|
}
|
|
19
33
|
//# sourceMappingURL=DebugContainer.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","View","AppContainer","DebugContainer","process","env","NODE_ENV","
|
|
1
|
+
{"version":3,"names":["React","Platform","View","AppContainer","DebugContainer","props","createElement","_extends","collapsable","process","env","NODE_ENV","stackPresentation","rest","OS"],"sourceRoot":"../../../src","sources":["views/DebugContainer.native.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,IAAI,QAAwB,cAAc;AAC7D;AACA,OAAOC,YAAY,MAAM,iDAAiD;AAQ1E;AACA;AACA;AACA;AACA;AACA,OAAO,IAAIC,cAAc,GAAIC,KAAqB,IAAK;EACrD,oBAAOL,KAAA,CAAAM,aAAA,CAACJ,IAAI,EAAAK,QAAA,KAAKF,KAAK;IAAEG,WAAW,EAAE;EAAM,EAAE,CAAC;AAChD,CAAC;AAED,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzCP,cAAc,GAAIC,KAAqB,IAAK;IAC1C,MAAM;MAAEO,iBAAiB;MAAE,GAAGC;IAAK,CAAC,GAAGR,KAAK;IAE5C,IAAIJ,QAAQ,CAACa,EAAE,KAAK,KAAK,IAAIF,iBAAiB,KAAK,MAAM,EAAE;MACzD;MACA,oBACEZ,KAAA,CAAAM,aAAA,CAACH,YAAY,qBACXH,KAAA,CAAAM,aAAA,CAACJ,IAAI,EAAAK,QAAA,KAAKM,IAAI;QAAEL,WAAW,EAAE;MAAM,EAAE,CACzB,CAAC;IAEnB;IAEA,oBAAOR,KAAA,CAAAM,aAAA,CAACJ,IAAI,EAAAK,QAAA,KAAKM,IAAI;MAAEL,WAAW,EAAE;IAAM,EAAE,CAAC;EAC/C,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["processFonts","_","Error"],"sourceRoot":"../../../src","sources":["views/FontProcessor.tsx"],"mappings":"AAAA,OAAO,SAASA,
|
|
1
|
+
{"version":3,"names":["processFonts","_","Error"],"sourceRoot":"../../../src","sources":["views/FontProcessor.tsx"],"mappings":"AAAA,OAAO,SAASA,YAAYA,CAC1BC,CAAyB,EACD;EACxB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;AACzC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
// @ts-
|
|
1
|
+
// @ts-expect-error importing private module
|
|
2
2
|
import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
|
|
3
3
|
export function processFonts(fontFamilies) {
|
|
4
|
-
|
|
5
|
-
// @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value
|
|
6
|
-
const fontFamilyProcessor = (_ReactNativeStyleAttr = ReactNativeStyleAttributes.fontFamily) === null || _ReactNativeStyleAttr === void 0 ? void 0 : _ReactNativeStyleAttr.process;
|
|
4
|
+
const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;
|
|
7
5
|
if (typeof fontFamilyProcessor === 'function') {
|
|
8
6
|
return fontFamilies.map(fontFamilyProcessor);
|
|
9
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactNativeStyleAttributes","processFonts","fontFamilies","fontFamilyProcessor","fontFamily","process","map"],"sourceRoot":"../../../src","sources":["views/FontProcessor.native.tsx"],"mappings":"AAAA;AACA,OAAOA,0BAA0B,MAAM,mEAAmE;AAE1G,OAAO,SAASC,
|
|
1
|
+
{"version":3,"names":["ReactNativeStyleAttributes","processFonts","fontFamilies","fontFamilyProcessor","fontFamily","process","map"],"sourceRoot":"../../../src","sources":["views/FontProcessor.native.tsx"],"mappings":"AAAA;AACA,OAAOA,0BAA0B,MAAM,mEAAmE;AAE1G,OAAO,SAASC,YAAYA,CAC1BC,YAAoC,EACZ;EACxB,MAAMC,mBAAmB,GAAGH,0BAA0B,CAACI,UAAU,EAAEC,OAAO;EAC1E,IAAI,OAAOF,mBAAmB,KAAK,UAAU,EAAE;IAC7C,OAAOD,YAAY,CAACI,GAAG,CAACH,mBAAmB,CAAC;EAC9C;EACA,OAAOD,YAAY;AACrB"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { getHeaderTitle, HeaderTitle } from '@react-navigation/elements';
|
|
2
|
-
import { useTheme } from '@react-navigation/native';
|
|
2
|
+
import { useLocale, useTheme } from '@react-navigation/native';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
5
5
|
import { isSearchBarAvailableForCurrentPlatform, ScreenStackHeaderBackButtonImage, ScreenStackHeaderCenterView, ScreenStackHeaderConfig, ScreenStackHeaderLeftView, ScreenStackHeaderRightView, ScreenStackHeaderSearchBarView, SearchBar } from 'react-native-screens';
|
|
6
6
|
import { processFonts } from './FontProcessor';
|
|
7
7
|
export function HeaderConfig(_ref) {
|
|
8
8
|
let {
|
|
9
|
-
headerHeight,
|
|
10
9
|
headerBackImageSource,
|
|
11
10
|
headerBackButtonMenuEnabled,
|
|
12
11
|
headerBackTitle,
|
|
@@ -35,6 +34,9 @@ export function HeaderConfig(_ref) {
|
|
|
35
34
|
title,
|
|
36
35
|
canGoBack
|
|
37
36
|
} = _ref;
|
|
37
|
+
const {
|
|
38
|
+
direction
|
|
39
|
+
} = useLocale();
|
|
38
40
|
const {
|
|
39
41
|
colors,
|
|
40
42
|
fonts
|
|
@@ -77,12 +79,12 @@ export function HeaderConfig(_ref) {
|
|
|
77
79
|
headerTitleStyleSupported.fontWeight = titleFontWeight;
|
|
78
80
|
}
|
|
79
81
|
const headerBackgroundColor = headerStyleFlattened.backgroundColor ?? (headerBackground != null || headerTransparent ? 'transparent' : colors.card);
|
|
80
|
-
const headerLeftElement = headerLeft
|
|
82
|
+
const headerLeftElement = headerLeft?.({
|
|
81
83
|
tintColor,
|
|
82
84
|
canGoBack,
|
|
83
85
|
label: headerBackTitle
|
|
84
86
|
});
|
|
85
|
-
const headerRightElement = headerRight
|
|
87
|
+
const headerRightElement = headerRight?.({
|
|
86
88
|
tintColor,
|
|
87
89
|
canGoBack
|
|
88
90
|
});
|
|
@@ -107,11 +109,7 @@ export function HeaderConfig(_ref) {
|
|
|
107
109
|
const translucent = headerBackground != null || headerTransparent ||
|
|
108
110
|
// When using a SearchBar or large title, the header needs to be translucent for it to work on iOS
|
|
109
111
|
(hasHeaderSearchBar || headerLargeTitle) && Platform.OS === 'ios' && headerTransparent !== false;
|
|
110
|
-
return /*#__PURE__*/React.createElement(
|
|
111
|
-
style: [styles.background, headerTransparent ? styles.translucent : null, {
|
|
112
|
-
height: headerHeight
|
|
113
|
-
}]
|
|
114
|
-
}, headerBackground()) : null, /*#__PURE__*/React.createElement(ScreenStackHeaderConfig, {
|
|
112
|
+
return /*#__PURE__*/React.createElement(ScreenStackHeaderConfig, {
|
|
115
113
|
backButtonInCustomView: backButtonInCustomView,
|
|
116
114
|
backgroundColor: headerBackgroundColor,
|
|
117
115
|
backTitle: headerBackTitleVisible ? headerBackTitle : ' ',
|
|
@@ -119,7 +117,7 @@ export function HeaderConfig(_ref) {
|
|
|
119
117
|
backTitleFontSize: backTitleFontSize,
|
|
120
118
|
blurEffect: headerBlurEffect,
|
|
121
119
|
color: tintColor,
|
|
122
|
-
direction:
|
|
120
|
+
direction: direction,
|
|
123
121
|
disableBackButtonMenu: headerBackButtonMenuEnabled === false,
|
|
124
122
|
hidden: headerShown === false,
|
|
125
123
|
hideBackButton: headerBackVisible === false,
|
|
@@ -150,23 +148,12 @@ export function HeaderConfig(_ref) {
|
|
|
150
148
|
style: headerTitleStyleSupported
|
|
151
149
|
}, titleText)) : null), headerBackImageSource !== undefined ? /*#__PURE__*/React.createElement(ScreenStackHeaderBackButtonImage, {
|
|
152
150
|
source: headerBackImageSource
|
|
153
|
-
}) : null, headerRightElement != null ? /*#__PURE__*/React.createElement(ScreenStackHeaderRightView, null, headerRightElement) : null, hasHeaderSearchBar ? /*#__PURE__*/React.createElement(ScreenStackHeaderSearchBarView, null, /*#__PURE__*/React.createElement(SearchBar, headerSearchBarOptions)) : null)
|
|
151
|
+
}) : null, headerRightElement != null ? /*#__PURE__*/React.createElement(ScreenStackHeaderRightView, null, headerRightElement) : null, hasHeaderSearchBar ? /*#__PURE__*/React.createElement(ScreenStackHeaderSearchBarView, null, /*#__PURE__*/React.createElement(SearchBar, headerSearchBarOptions)) : null);
|
|
154
152
|
}
|
|
155
153
|
const styles = StyleSheet.create({
|
|
156
154
|
row: {
|
|
157
155
|
flexDirection: 'row',
|
|
158
156
|
alignItems: 'center'
|
|
159
|
-
},
|
|
160
|
-
translucent: {
|
|
161
|
-
position: 'absolute',
|
|
162
|
-
top: 0,
|
|
163
|
-
left: 0,
|
|
164
|
-
right: 0,
|
|
165
|
-
zIndex: 1,
|
|
166
|
-
elevation: 1
|
|
167
|
-
},
|
|
168
|
-
background: {
|
|
169
|
-
overflow: 'hidden'
|
|
170
157
|
}
|
|
171
158
|
});
|
|
172
159
|
//# sourceMappingURL=HeaderConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getHeaderTitle","HeaderTitle","
|
|
1
|
+
{"version":3,"names":["getHeaderTitle","HeaderTitle","useLocale","useTheme","React","Platform","StyleSheet","View","isSearchBarAvailableForCurrentPlatform","ScreenStackHeaderBackButtonImage","ScreenStackHeaderCenterView","ScreenStackHeaderConfig","ScreenStackHeaderLeftView","ScreenStackHeaderRightView","ScreenStackHeaderSearchBarView","SearchBar","processFonts","HeaderConfig","_ref","headerBackImageSource","headerBackButtonMenuEnabled","headerBackTitle","headerBackTitleStyle","headerBackTitleVisible","headerBackVisible","headerShadowVisible","headerLargeStyle","headerLargeTitle","headerLargeTitleShadowVisible","headerLargeTitleStyle","headerBackground","headerLeft","headerRight","headerShown","headerStyle","headerBlurEffect","headerTintColor","headerTitle","headerTitleAlign","headerTitleStyle","headerTransparent","headerSearchBarOptions","headerTopInsetEnabled","route","title","canGoBack","direction","colors","fonts","tintColor","OS","primary","text","headerBackTitleStyleFlattened","flatten","regular","headerLargeTitleStyleFlattened","select","ios","heavy","default","medium","headerTitleStyleFlattened","bold","headerStyleFlattened","headerLargeStyleFlattened","backTitleFontFamily","largeTitleFontFamily","titleFontFamily","fontFamily","backTitleFontSize","fontSize","undefined","titleText","name","titleColor","color","titleFontSize","titleFontWeight","fontWeight","largeTitleBackgroundColor","backgroundColor","largeTitleColor","largeTitleFontSize","largeTitleFontWeight","headerTitleStyleSupported","headerBackgroundColor","card","headerLeftElement","label","headerRightElement","headerTitleElement","children","supportsHeaderSearchBar","hasHeaderSearchBar","Error","backButtonInCustomView","translucent","createElement","backTitle","blurEffect","disableBackButtonMenu","hidden","hideBackButton","hideShadow","largeTitle","largeTitleHideShadow","topInsetEnabled","Fragment","style","styles","row","source","create","flexDirection","alignItems"],"sourceRoot":"../../../src","sources":["views/HeaderConfig.tsx"],"mappings":"AAAA,SAASA,cAAc,EAAEC,WAAW,QAAQ,4BAA4B;AACxE,SAAqBC,SAAS,EAAEC,QAAQ,QAAQ,0BAA0B;AAC1E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,UAAU,EAAkBC,IAAI,QAAQ,cAAc;AACzE,SACEC,sCAAsC,EACtCC,gCAAgC,EAChCC,2BAA2B,EAC3BC,uBAAuB,EACvBC,yBAAyB,EACzBC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,SAAS,QACJ,sBAAsB;AAG7B,SAASC,YAAY,QAAQ,iBAAiB;AAS9C,OA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AAI,IAAI,gBACzBtF,KAAA,CAAA8F,aAAA,CAACrF,0BAA0B,QACxB6E,kBACyB,CAAC,GAC3B,IAAI,EACPI,kBAAkB,gBACjB1F,KAAA,CAAA8F,aAAA,CAACpF,8BAA8B,qBAC7BV,KAAA,CAAA8F,aAAA,CAACnF,SAAS,EAAK0B,sBAAyB,CACV,CAAC,GAC/B,IACmB,CAAC;AAE9B;AAEA,MAAMqE,MAAM,GAAGxG,UAAU,CAAC2G,MAAM,CAAC;EAC/BF,GAAG,EAAE;IACHG,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getHeaderTitle, Header, HeaderBackButton, HeaderBackContext, SafeAreaProviderCompat, Screen } from '@react-navigation/elements';
|
|
2
|
+
import { useLinkBuilder, useTheme } from '@react-navigation/native';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { Image, StyleSheet, View } from 'react-native';
|
|
4
5
|
const TRANSPARENT_PRESENTATIONS = ['transparentModal', 'containedTransparentModal'];
|
|
@@ -8,13 +9,23 @@ export function NativeStackView(_ref) {
|
|
|
8
9
|
descriptors
|
|
9
10
|
} = _ref;
|
|
10
11
|
const parentHeaderBack = React.useContext(HeaderBackContext);
|
|
12
|
+
const {
|
|
13
|
+
buildHref
|
|
14
|
+
} = useLinkBuilder();
|
|
15
|
+
const {
|
|
16
|
+
colors
|
|
17
|
+
} = useTheme();
|
|
18
|
+
if (state.preloadedRoutes.length !== 0) {
|
|
19
|
+
throw new Error('Preloading routes is not supported in the NativeStackNavigator navigator.');
|
|
20
|
+
}
|
|
11
21
|
return /*#__PURE__*/React.createElement(SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(View, {
|
|
12
|
-
style: styles.container
|
|
22
|
+
style: [styles.container, {
|
|
23
|
+
backgroundColor: colors.background
|
|
24
|
+
}]
|
|
13
25
|
}, state.routes.map((route, i) => {
|
|
14
|
-
var _state$routes, _state$routes2;
|
|
15
26
|
const isFocused = state.index === i;
|
|
16
|
-
const previousKey =
|
|
17
|
-
const nextKey =
|
|
27
|
+
const previousKey = state.routes[i - 1]?.key;
|
|
28
|
+
const nextKey = state.routes[i + 1]?.key;
|
|
18
29
|
const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
|
|
19
30
|
const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
|
|
20
31
|
const {
|
|
@@ -23,7 +34,8 @@ export function NativeStackView(_ref) {
|
|
|
23
34
|
render
|
|
24
35
|
} = descriptors[route.key];
|
|
25
36
|
const headerBack = previousDescriptor ? {
|
|
26
|
-
title: getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name)
|
|
37
|
+
title: getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name),
|
|
38
|
+
href: buildHref(previousDescriptor.route.name, previousDescriptor.route.params)
|
|
27
39
|
} : parentHeaderBack;
|
|
28
40
|
const canGoBack = headerBack !== undefined;
|
|
29
41
|
const {
|
|
@@ -44,7 +56,7 @@ export function NativeStackView(_ref) {
|
|
|
44
56
|
presentation,
|
|
45
57
|
contentStyle
|
|
46
58
|
} = options;
|
|
47
|
-
const nextPresentation = nextDescriptor
|
|
59
|
+
const nextPresentation = nextDescriptor?.options.presentation;
|
|
48
60
|
return /*#__PURE__*/React.createElement(Screen, {
|
|
49
61
|
key: route.key,
|
|
50
62
|
focused: isFocused,
|
|
@@ -77,12 +89,13 @@ export function NativeStackView(_ref) {
|
|
|
77
89
|
tintColor: tintColor,
|
|
78
90
|
backImage: headerBackImageSource !== undefined ? () => /*#__PURE__*/React.createElement(Image, {
|
|
79
91
|
source: headerBackImageSource,
|
|
92
|
+
resizeMode: "contain",
|
|
80
93
|
style: [styles.backImage, {
|
|
81
94
|
tintColor
|
|
82
95
|
}]
|
|
83
96
|
}) : undefined,
|
|
84
97
|
onPress: navigation.goBack,
|
|
85
|
-
|
|
98
|
+
href: headerBack.href
|
|
86
99
|
});
|
|
87
100
|
} : headerLeft,
|
|
88
101
|
headerRight: typeof headerRight === 'function' ? _ref4 => {
|
|
@@ -133,8 +146,7 @@ const styles = StyleSheet.create({
|
|
|
133
146
|
backImage: {
|
|
134
147
|
height: 24,
|
|
135
148
|
width: 24,
|
|
136
|
-
margin: 3
|
|
137
|
-
resizeMode: 'contain'
|
|
149
|
+
margin: 3
|
|
138
150
|
}
|
|
139
151
|
});
|
|
140
152
|
//# sourceMappingURL=NativeStackView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","SafeAreaProviderCompat","Screen","React","Image","StyleSheet","View","TRANSPARENT_PRESENTATIONS","NativeStackView","state","descriptors","parentHeaderBack","useContext","styles","container","routes","map","route","i","isFocused","index","previousKey","key","nextKey","previousDescriptor","undefined","nextDescriptor","options","navigation","render","headerBack","title","name","canGoBack","header","headerShown","headerTintColor","headerBackImageSource","headerLeft","headerRight","headerTitle","headerTitleAlign","headerTitleStyle","headerStyle","headerShadowVisible","headerTransparent","headerBackground","headerBackTitle","presentation","contentStyle","nextPresentation","back","tintColor","label","backImage","goBack","children","absoluteFill","display","includes","
|
|
1
|
+
{"version":3,"names":["getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","SafeAreaProviderCompat","Screen","useLinkBuilder","useTheme","React","Image","StyleSheet","View","TRANSPARENT_PRESENTATIONS","NativeStackView","_ref","state","descriptors","parentHeaderBack","useContext","buildHref","colors","preloadedRoutes","length","Error","createElement","style","styles","container","backgroundColor","background","routes","map","route","i","isFocused","index","previousKey","key","nextKey","previousDescriptor","undefined","nextDescriptor","options","navigation","render","headerBack","title","name","href","params","canGoBack","header","headerShown","headerTintColor","headerBackImageSource","headerLeft","headerRight","headerTitle","headerTitleAlign","headerTitleStyle","headerStyle","headerShadowVisible","headerTransparent","headerBackground","headerBackTitle","presentation","contentStyle","nextPresentation","focused","back","_ref2","tintColor","label","_ref3","backImage","source","resizeMode","onPress","goBack","_ref4","_ref5","children","absoluteFill","display","includes","Provider","value","contentContainer","create","flex","height","width","margin"],"sourceRoot":"../../../src","sources":["views/NativeStackView.tsx"],"mappings":"AAAA,SACEA,cAAc,EACdC,MAAM,EACNC,gBAAgB,EAChBC,iBAAiB,EACjBC,sBAAsB,EACtBC,MAAM,QACD,4BAA4B;AACnC,SAGEC,cAAc,EACdC,QAAQ,QACH,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,KAAK,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAetD,MAAMC,yBAAyB,GAAG,CAChC,kBAAkB,EAClB,2BAA2B,CAC5B;AAED,OAAO,SAASC,eAAeA,CAAAC,IAAA,EAAgC;EAAA,IAA/B;IAAEC,KAAK;IAAEC;EAAmB,CAAC,GAAAF,IAAA;EAC3D,MAAMG,gBAAgB,GAAGT,KAAK,CAACU,UAAU,CAACf,iBAAiB,CAAC;EAC5D,MAAM;IAAEgB;EAAU,CAAC,GAAGb,cAAc,CAAC,CAAC;EACtC,MAAM;IAAEc;EAAO,CAAC,GAAGb,QAAQ,CAAC,CAAC;EAE7B,IAAIQ,KAAK,CAACM,eAAe,CAACC,MAAM,KAAK,CAAC,EAAE;IACtC,MAAM,IAAIC,KAAK,CACb,2EACF,CAAC;EACH;EAEA,oBACEf,KAAA,CAAAgB,aAAA,CAACpB,sBAAsB,qBACrBI,KAAA,CAAAgB,aAAA,CAACb,IAAI;IAACc,KAAK,EAAE,CAACC,MAAM,CAACC,SAAS,EAAE;MAAEC,eAAe,EAAER,MAAM,CAACS;IAAW,CAAC;EAAE,GACrEd,KAAK,CAACe,MAAM,CAACC,GAAG,CAAC,CAACC,KAAK,EAAEC,CAAC,KAAK;IAC9B,MAAMC,SAAS,GAAGnB,KAAK,CAACoB,KAAK,KAAKF,CAAC;IACnC,MAAMG,WAAW,GAAGrB,KAAK,CAACe,MAAM,CAACG,CAAC,GAAG,CAAC,CAAC,EAAEI,GAAG;IAC5C,MAAMC,OAA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.bind() : function
|
|
|
2
2
|
import { getDefaultHeaderHeight, getHeaderTitle, HeaderBackContext, HeaderHeightContext, HeaderShownContext, SafeAreaProviderCompat } from '@react-navigation/elements';
|
|
3
3
|
import { NavigationContext, NavigationRouteContext, StackActions, usePreventRemoveContext, useTheme } from '@react-navigation/native';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { Platform, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { Animated, Platform, StyleSheet, useAnimatedValue, View } from 'react-native';
|
|
6
6
|
import { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
7
|
import { Screen, ScreenStack } from 'react-native-screens';
|
|
8
8
|
import warnOnce from 'warn-once';
|
|
9
|
+
import { AnimatedHeaderHeightContext } from '../utils/useAnimatedHeaderHeight';
|
|
9
10
|
import { useDismissedRouteError } from '../utils/useDismissedRouteError';
|
|
10
11
|
import { useInvalidPreventRemoveError } from '../utils/useInvalidPreventRemoveError';
|
|
11
12
|
import { DebugContainer } from './DebugContainer';
|
|
@@ -45,18 +46,19 @@ const MaybeNestedStack = _ref => {
|
|
|
45
46
|
style: styles.container
|
|
46
47
|
}, /*#__PURE__*/React.createElement(Screen, {
|
|
47
48
|
enabled: true,
|
|
49
|
+
isNativeStack: true,
|
|
50
|
+
hasLargeHeader: options.headerLargeTitle ?? false,
|
|
48
51
|
style: StyleSheet.absoluteFill
|
|
49
|
-
}, /*#__PURE__*/React.createElement(HeaderConfig, _extends({}, options, {
|
|
52
|
+
}, content, /*#__PURE__*/React.createElement(HeaderConfig, _extends({}, options, {
|
|
50
53
|
route: route,
|
|
51
54
|
headerHeight: headerHeight,
|
|
52
55
|
headerTopInsetEnabled: headerTopInsetEnabled,
|
|
53
56
|
canGoBack: true
|
|
54
|
-
}))
|
|
57
|
+
}))));
|
|
55
58
|
}
|
|
56
59
|
return content;
|
|
57
60
|
};
|
|
58
61
|
const SceneView = _ref2 => {
|
|
59
|
-
var _preventedRoutes$rout;
|
|
60
62
|
let {
|
|
61
63
|
index,
|
|
62
64
|
focused,
|
|
@@ -64,11 +66,13 @@ const SceneView = _ref2 => {
|
|
|
64
66
|
previousDescriptor,
|
|
65
67
|
nextDescriptor,
|
|
66
68
|
onWillDisappear,
|
|
69
|
+
onWillAppear,
|
|
67
70
|
onAppear,
|
|
68
71
|
onDisappear,
|
|
69
72
|
onDismissed,
|
|
70
73
|
onHeaderBackButtonClicked,
|
|
71
|
-
onNativeDismissCancelled
|
|
74
|
+
onNativeDismissCancelled,
|
|
75
|
+
onGestureCancel
|
|
72
76
|
} = _ref2;
|
|
73
77
|
const {
|
|
74
78
|
route,
|
|
@@ -76,43 +80,51 @@ const SceneView = _ref2 => {
|
|
|
76
80
|
options,
|
|
77
81
|
render
|
|
78
82
|
} = descriptor;
|
|
83
|
+
let {
|
|
84
|
+
animation,
|
|
85
|
+
animationMatchesGesture,
|
|
86
|
+
fullScreenGestureEnabled,
|
|
87
|
+
presentation = 'card'
|
|
88
|
+
} = options;
|
|
79
89
|
const {
|
|
80
90
|
animationDuration,
|
|
81
91
|
animationTypeForReplace = 'push',
|
|
82
92
|
gestureEnabled,
|
|
93
|
+
gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',
|
|
94
|
+
gestureResponseDistance,
|
|
83
95
|
header,
|
|
84
96
|
headerBackButtonMenuEnabled,
|
|
85
97
|
headerShown,
|
|
98
|
+
headerBackground,
|
|
86
99
|
headerTransparent,
|
|
87
100
|
autoHideHomeIndicator,
|
|
101
|
+
keyboardHandlingEnabled,
|
|
88
102
|
navigationBarColor,
|
|
89
103
|
navigationBarHidden,
|
|
90
104
|
orientation,
|
|
105
|
+
sheetAllowedDetents = 'large',
|
|
106
|
+
sheetLargestUndimmedDetent = 'all',
|
|
107
|
+
sheetGrabberVisible = false,
|
|
108
|
+
sheetCornerRadius = -1.0,
|
|
109
|
+
sheetExpandsWhenScrolledToEdge = true,
|
|
91
110
|
statusBarAnimation,
|
|
92
111
|
statusBarHidden,
|
|
93
112
|
statusBarStyle,
|
|
94
113
|
statusBarTranslucent,
|
|
95
|
-
|
|
114
|
+
statusBarBackgroundColor,
|
|
96
115
|
freezeOnBlur
|
|
97
116
|
} = options;
|
|
98
|
-
let {
|
|
99
|
-
animation,
|
|
100
|
-
customAnimationOnGesture,
|
|
101
|
-
fullScreenGestureEnabled,
|
|
102
|
-
presentation = 'card',
|
|
103
|
-
gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical'
|
|
104
|
-
} = options;
|
|
105
117
|
if (gestureDirection === 'vertical' && Platform.OS === 'ios') {
|
|
106
118
|
// for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`
|
|
107
119
|
// so the screen can be dismissed from any point on screen.
|
|
108
|
-
// `
|
|
120
|
+
// `animationMatchesGesture` needs to be set to `true` so the `animation` set by user can be used,
|
|
109
121
|
// otherwise `simple_push` will be used.
|
|
110
122
|
// Also, the default animation for this direction seems to be `slide_from_bottom`.
|
|
111
123
|
if (fullScreenGestureEnabled === undefined) {
|
|
112
124
|
fullScreenGestureEnabled = true;
|
|
113
125
|
}
|
|
114
|
-
if (
|
|
115
|
-
|
|
126
|
+
if (animationMatchesGesture === undefined) {
|
|
127
|
+
animationMatchesGesture = true;
|
|
116
128
|
}
|
|
117
129
|
if (animation === undefined) {
|
|
118
130
|
animation = 'slide_from_bottom';
|
|
@@ -121,7 +133,7 @@ const SceneView = _ref2 => {
|
|
|
121
133
|
|
|
122
134
|
// workaround for rn-screens where gestureDirection has to be set on both
|
|
123
135
|
// current and previous screen - software-mansion/react-native-screens/pull/1509
|
|
124
|
-
const nextGestureDirection = nextDescriptor
|
|
136
|
+
const nextGestureDirection = nextDescriptor?.options.gestureDirection;
|
|
125
137
|
const gestureDirectionOverride = nextGestureDirection != null ? nextGestureDirection : gestureDirection;
|
|
126
138
|
if (index === 0) {
|
|
127
139
|
// first screen should always be treated as `card`, it resolves problems with no header animation
|
|
@@ -146,49 +158,73 @@ const SceneView = _ref2 => {
|
|
|
146
158
|
} = usePreventRemoveContext();
|
|
147
159
|
const defaultHeaderHeight = getDefaultHeaderHeight(frame, isModal, topInset);
|
|
148
160
|
const [customHeaderHeight, setCustomHeaderHeight] = React.useState(defaultHeaderHeight);
|
|
161
|
+
const animatedHeaderHeight = useAnimatedValue(defaultHeaderHeight);
|
|
149
162
|
const headerTopInsetEnabled = topInset !== 0;
|
|
150
163
|
const headerHeight = header ? customHeaderHeight : defaultHeaderHeight;
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
const backTitle = previousDescriptor ? getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name) : parentHeaderBack?.title;
|
|
165
|
+
const headerBack = React.useMemo(() => ({
|
|
166
|
+
// No href needed for native
|
|
167
|
+
href: undefined,
|
|
168
|
+
title: backTitle
|
|
169
|
+
}), [backTitle]);
|
|
170
|
+
const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;
|
|
155
171
|
return /*#__PURE__*/React.createElement(Screen, {
|
|
156
172
|
key: route.key,
|
|
157
173
|
enabled: true,
|
|
174
|
+
isNativeStack: true,
|
|
158
175
|
style: StyleSheet.absoluteFill,
|
|
159
|
-
|
|
176
|
+
hasLargeHeader: options.headerLargeTitle ?? false,
|
|
177
|
+
customAnimationOnSwipe: animationMatchesGesture,
|
|
160
178
|
fullScreenSwipeEnabled: fullScreenGestureEnabled,
|
|
161
179
|
gestureEnabled: isAndroid ?
|
|
162
180
|
// This prop enables handling of system back gestures on Android
|
|
163
181
|
// Since we handle them in JS side, we disable this
|
|
164
182
|
false : gestureEnabled,
|
|
165
183
|
homeIndicatorHidden: autoHideHomeIndicator,
|
|
184
|
+
hideKeyboardOnSwipe: keyboardHandlingEnabled,
|
|
166
185
|
navigationBarColor: navigationBarColor,
|
|
167
186
|
navigationBarHidden: navigationBarHidden,
|
|
168
187
|
replaceAnimation: animationTypeForReplace,
|
|
169
188
|
stackPresentation: presentation === 'card' ? 'push' : presentation,
|
|
170
189
|
stackAnimation: animation,
|
|
171
190
|
screenOrientation: orientation,
|
|
191
|
+
sheetAllowedDetents: sheetAllowedDetents,
|
|
192
|
+
sheetLargestUndimmedDetent: sheetLargestUndimmedDetent,
|
|
193
|
+
sheetGrabberVisible: sheetGrabberVisible,
|
|
194
|
+
sheetCornerRadius: sheetCornerRadius,
|
|
195
|
+
sheetExpandsWhenScrolledToEdge: sheetExpandsWhenScrolledToEdge,
|
|
172
196
|
statusBarAnimation: statusBarAnimation,
|
|
173
197
|
statusBarHidden: statusBarHidden,
|
|
174
198
|
statusBarStyle: statusBarStyle,
|
|
175
|
-
statusBarColor:
|
|
199
|
+
statusBarColor: statusBarBackgroundColor,
|
|
176
200
|
statusBarTranslucent: statusBarTranslucent,
|
|
177
201
|
swipeDirection: gestureDirectionOverride,
|
|
178
202
|
transitionDuration: animationDuration,
|
|
203
|
+
onWillAppear: onWillAppear,
|
|
179
204
|
onWillDisappear: onWillDisappear,
|
|
180
205
|
onAppear: onAppear,
|
|
181
206
|
onDisappear: onDisappear,
|
|
182
207
|
onDismissed: onDismissed,
|
|
183
|
-
|
|
208
|
+
onGestureCancel: onGestureCancel,
|
|
209
|
+
gestureResponseDistance: gestureResponseDistance,
|
|
184
210
|
nativeBackButtonDismissalEnabled: false // on Android
|
|
185
211
|
,
|
|
186
|
-
onHeaderBackButtonClicked: onHeaderBackButtonClicked
|
|
187
|
-
// @ts-ignore props not exported from rn-screens
|
|
188
|
-
,
|
|
212
|
+
onHeaderBackButtonClicked: onHeaderBackButtonClicked,
|
|
189
213
|
preventNativeDismiss: isRemovePrevented // on iOS
|
|
190
214
|
,
|
|
191
215
|
onNativeDismissCancelled: onNativeDismissCancelled
|
|
216
|
+
// Unfortunately, because of the bug that exists on Fabric, where native event drivers
|
|
217
|
+
// for Animated objects are being created after the first notifications about the header height
|
|
218
|
+
// from the native side, `onHeaderHeightChange` event does not notify
|
|
219
|
+
// `animatedHeaderHeight` about initial values on appearing screens at the moment.
|
|
220
|
+
,
|
|
221
|
+
onHeaderHeightChange: Animated.event([{
|
|
222
|
+
nativeEvent: {
|
|
223
|
+
headerHeight: animatedHeaderHeight
|
|
224
|
+
}
|
|
225
|
+
}], {
|
|
226
|
+
useNativeDriver: true
|
|
227
|
+
})
|
|
192
228
|
// this prop is available since rn-screens 3.16
|
|
193
229
|
,
|
|
194
230
|
freezeOnBlur: freezeOnBlur
|
|
@@ -198,17 +234,21 @@ const SceneView = _ref2 => {
|
|
|
198
234
|
value: route
|
|
199
235
|
}, /*#__PURE__*/React.createElement(HeaderShownContext.Provider, {
|
|
200
236
|
value: isParentHeaderShown || headerShown !== false
|
|
237
|
+
}, /*#__PURE__*/React.createElement(AnimatedHeaderHeightContext.Provider, {
|
|
238
|
+
value: animatedHeaderHeight
|
|
201
239
|
}, /*#__PURE__*/React.createElement(HeaderHeightContext.Provider, {
|
|
202
240
|
value: headerShown !== false ? headerHeight : parentHeaderHeight ?? 0
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
241
|
+
}, headerBackground != null ?
|
|
242
|
+
/*#__PURE__*/
|
|
243
|
+
/**
|
|
244
|
+
* To show a custom header background, we render it at the top of the screen below the header
|
|
245
|
+
* The header also needs to be positioned absolutely (with `translucent` style)
|
|
246
|
+
*/
|
|
247
|
+
React.createElement(View, {
|
|
248
|
+
style: [styles.background, headerTransparent ? styles.translucent : null, {
|
|
249
|
+
height: headerHeight
|
|
250
|
+
}]
|
|
251
|
+
}, headerBackground()) : null, /*#__PURE__*/React.createElement(View, {
|
|
212
252
|
accessibilityElementsHidden: !focused,
|
|
213
253
|
importantForAccessibility: focused ? 'auto' : 'no-hide-descendants',
|
|
214
254
|
style: styles.scene
|
|
@@ -230,7 +270,15 @@ const SceneView = _ref2 => {
|
|
|
230
270
|
options,
|
|
231
271
|
route,
|
|
232
272
|
navigation
|
|
233
|
-
})) : null)
|
|
273
|
+
})) : null), /*#__PURE__*/React.createElement(HeaderConfig, _extends({}, options, {
|
|
274
|
+
route: route,
|
|
275
|
+
headerBackButtonMenuEnabled: isRemovePrevented !== undefined ? !isRemovePrevented : headerBackButtonMenuEnabled,
|
|
276
|
+
headerShown: header !== undefined ? false : headerShown,
|
|
277
|
+
headerHeight: headerHeight,
|
|
278
|
+
headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : undefined,
|
|
279
|
+
headerTopInsetEnabled: headerTopInsetEnabled,
|
|
280
|
+
canGoBack: headerBack !== undefined
|
|
281
|
+
}))))))));
|
|
234
282
|
};
|
|
235
283
|
function NativeStackViewInner(_ref3) {
|
|
236
284
|
let {
|
|
@@ -241,15 +289,19 @@ function NativeStackViewInner(_ref3) {
|
|
|
241
289
|
const {
|
|
242
290
|
setNextDismissedKey
|
|
243
291
|
} = useDismissedRouteError(state);
|
|
292
|
+
const {
|
|
293
|
+
colors
|
|
294
|
+
} = useTheme();
|
|
244
295
|
useInvalidPreventRemoveError(descriptors);
|
|
245
296
|
return /*#__PURE__*/React.createElement(ScreenStack, {
|
|
246
|
-
style: styles.container
|
|
297
|
+
style: [styles.container, {
|
|
298
|
+
backgroundColor: colors.background
|
|
299
|
+
}]
|
|
247
300
|
}, state.routes.map((route, index) => {
|
|
248
|
-
var _state$routes, _state$routes2;
|
|
249
301
|
const descriptor = descriptors[route.key];
|
|
250
302
|
const isFocused = state.index === index;
|
|
251
|
-
const previousKey =
|
|
252
|
-
const nextKey =
|
|
303
|
+
const previousKey = state.routes[index - 1]?.key;
|
|
304
|
+
const nextKey = state.routes[index + 1]?.key;
|
|
253
305
|
const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
|
|
254
306
|
const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
|
|
255
307
|
return /*#__PURE__*/React.createElement(SceneView, {
|
|
@@ -268,6 +320,15 @@ function NativeStackViewInner(_ref3) {
|
|
|
268
320
|
target: route.key
|
|
269
321
|
});
|
|
270
322
|
},
|
|
323
|
+
onWillAppear: () => {
|
|
324
|
+
navigation.emit({
|
|
325
|
+
type: 'transitionStart',
|
|
326
|
+
data: {
|
|
327
|
+
closing: false
|
|
328
|
+
},
|
|
329
|
+
target: route.key
|
|
330
|
+
});
|
|
331
|
+
},
|
|
271
332
|
onAppear: () => {
|
|
272
333
|
navigation.emit({
|
|
273
334
|
type: 'transitionEnd',
|
|
@@ -307,6 +368,12 @@ function NativeStackViewInner(_ref3) {
|
|
|
307
368
|
source: route.key,
|
|
308
369
|
target: state.key
|
|
309
370
|
});
|
|
371
|
+
},
|
|
372
|
+
onGestureCancel: () => {
|
|
373
|
+
navigation.emit({
|
|
374
|
+
type: 'gestureCancel',
|
|
375
|
+
target: route.key
|
|
376
|
+
});
|
|
310
377
|
}
|
|
311
378
|
});
|
|
312
379
|
}));
|
|
@@ -327,6 +394,17 @@ const styles = StyleSheet.create({
|
|
|
327
394
|
top: 0,
|
|
328
395
|
left: 0,
|
|
329
396
|
right: 0
|
|
397
|
+
},
|
|
398
|
+
translucent: {
|
|
399
|
+
position: 'absolute',
|
|
400
|
+
top: 0,
|
|
401
|
+
left: 0,
|
|
402
|
+
right: 0,
|
|
403
|
+
zIndex: 1,
|
|
404
|
+
elevation: 1
|
|
405
|
+
},
|
|
406
|
+
background: {
|
|
407
|
+
overflow: 'hidden'
|
|
330
408
|
}
|
|
331
409
|
});
|
|
332
410
|
//# sourceMappingURL=NativeStackView.native.js.map
|