@react-navigation/native-stack 7.0.0-alpha.0 → 7.0.0-alpha.1
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 +4 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createNativeStackNavigator.js +5 -6
- package/lib/commonjs/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/utils/useDismissedRouteError.js +2 -2
- package/lib/commonjs/utils/useDismissedRouteError.js.map +1 -1
- package/lib/commonjs/utils/useInvalidPreventRemoveError.js +1 -1
- 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 +4 -6
- 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.map +1 -1
- package/lib/commonjs/views/HeaderConfig.js +26 -13
- package/lib/commonjs/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.js +1 -1
- package/lib/commonjs/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.native.js +10 -10
- package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createNativeStackNavigator.js +2 -2
- package/lib/module/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/utils/useDismissedRouteError.js +1 -1
- package/lib/module/utils/useDismissedRouteError.js.map +1 -1
- package/lib/module/utils/useInvalidPreventRemoveError.js +1 -1
- package/lib/module/utils/useInvalidPreventRemoveError.js.map +1 -1
- package/lib/module/views/DebugContainer.js +1 -1
- package/lib/module/views/DebugContainer.js.map +1 -1
- package/lib/module/views/DebugContainer.native.js +2 -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.map +1 -1
- package/lib/module/views/HeaderConfig.js +26 -13
- package/lib/module/views/HeaderConfig.js.map +1 -1
- package/lib/module/views/NativeStackView.js +1 -1
- package/lib/module/views/NativeStackView.js.map +1 -1
- package/lib/module/views/NativeStackView.native.js +5 -5
- package/lib/module/views/NativeStackView.native.js.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts +2 -2
- package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/utils/useDismissedRouteError.d.ts +1 -1
- package/lib/typescript/src/utils/useDismissedRouteError.d.ts.map +1 -1
- package/lib/typescript/src/utils/useInvalidPreventRemoveError.d.ts +1 -1
- package/lib/typescript/src/utils/useInvalidPreventRemoveError.d.ts.map +1 -1
- package/lib/typescript/src/views/DebugContainer.d.ts +1 -1
- package/lib/typescript/src/views/DebugContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/DebugContainer.native.d.ts +2 -2
- package/lib/typescript/src/views/DebugContainer.native.d.ts.map +1 -1
- package/lib/typescript/src/views/HeaderConfig.d.ts +1 -1
- package/lib/typescript/src/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/src/views/NativeStackView.d.ts +1 -1
- package/lib/typescript/src/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/src/views/NativeStackView.native.d.ts +1 -1
- package/lib/typescript/src/views/NativeStackView.native.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/index.tsx +2 -2
- package/src/navigators/createNativeStackNavigator.tsx +2 -2
- package/src/utils/useDismissedRouteError.tsx +1 -1
- package/src/utils/useInvalidPreventRemoveError.tsx +1 -1
- package/src/views/DebugContainer.native.tsx +3 -6
- package/src/views/DebugContainer.tsx +1 -1
- package/src/views/HeaderConfig.tsx +47 -18
- package/src/views/NativeStackView.native.tsx +5 -5
- package/src/views/NativeStackView.tsx +1 -1
|
@@ -29,7 +29,7 @@ type Props = NativeStackNavigationOptions & {
|
|
|
29
29
|
canGoBack: boolean;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export
|
|
32
|
+
export function HeaderConfig({
|
|
33
33
|
headerHeight,
|
|
34
34
|
headerBackImageSource,
|
|
35
35
|
headerBackButtonMenuEnabled,
|
|
@@ -59,15 +59,22 @@ export default function HeaderConfig({
|
|
|
59
59
|
title,
|
|
60
60
|
canGoBack,
|
|
61
61
|
}: Props): JSX.Element {
|
|
62
|
-
const { colors } = useTheme();
|
|
62
|
+
const { colors, fonts } = useTheme();
|
|
63
63
|
const tintColor =
|
|
64
64
|
headerTintColor ?? (Platform.OS === 'ios' ? colors.primary : colors.text);
|
|
65
65
|
|
|
66
66
|
const headerBackTitleStyleFlattened =
|
|
67
|
-
StyleSheet.flatten(headerBackTitleStyle) || {};
|
|
67
|
+
StyleSheet.flatten([headerBackTitleStyle, fonts.regular]) || {};
|
|
68
68
|
const headerLargeTitleStyleFlattened =
|
|
69
|
-
StyleSheet.flatten(
|
|
70
|
-
|
|
69
|
+
StyleSheet.flatten([
|
|
70
|
+
headerLargeTitleStyle,
|
|
71
|
+
Platform.select({ ios: fonts.heavy, default: fonts.medium }),
|
|
72
|
+
]) || {};
|
|
73
|
+
const headerTitleStyleFlattened =
|
|
74
|
+
StyleSheet.flatten([
|
|
75
|
+
headerTitleStyle,
|
|
76
|
+
Platform.select({ ios: fonts.bold, default: fonts.medium }),
|
|
77
|
+
]) || {};
|
|
71
78
|
const headerStyleFlattened = StyleSheet.flatten(headerStyle) || {};
|
|
72
79
|
const headerLargeStyleFlattened = StyleSheet.flatten(headerLargeStyle) || {};
|
|
73
80
|
|
|
@@ -78,12 +85,33 @@ export default function HeaderConfig({
|
|
|
78
85
|
headerTitleStyleFlattened.fontFamily,
|
|
79
86
|
]);
|
|
80
87
|
|
|
88
|
+
const backTitleFontSize =
|
|
89
|
+
'fontSize' in headerBackTitleStyleFlattened
|
|
90
|
+
? headerBackTitleStyleFlattened.fontSize
|
|
91
|
+
: undefined;
|
|
92
|
+
|
|
81
93
|
const titleText = getHeaderTitle({ title, headerTitle }, route.name);
|
|
82
94
|
const titleColor =
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
'color' in headerTitleStyleFlattened
|
|
96
|
+
? headerTitleStyleFlattened.color
|
|
97
|
+
: headerTintColor ?? colors.text;
|
|
98
|
+
const titleFontSize =
|
|
99
|
+
'fontSize' in headerTitleStyleFlattened
|
|
100
|
+
? headerTitleStyleFlattened.fontSize
|
|
101
|
+
: undefined;
|
|
85
102
|
const titleFontWeight = headerTitleStyleFlattened.fontWeight;
|
|
86
103
|
|
|
104
|
+
const largeTitleBackgroundColor = headerLargeStyleFlattened.backgroundColor;
|
|
105
|
+
const largeTitleColor =
|
|
106
|
+
'color' in headerLargeTitleStyleFlattened
|
|
107
|
+
? headerLargeTitleStyleFlattened.color
|
|
108
|
+
: undefined;
|
|
109
|
+
const largeTitleFontSize =
|
|
110
|
+
'fontSize' in headerLargeTitleStyleFlattened
|
|
111
|
+
? headerLargeTitleStyleFlattened.fontSize
|
|
112
|
+
: undefined;
|
|
113
|
+
const largeTitleFontWeight = headerLargeTitleStyleFlattened.fontWeight;
|
|
114
|
+
|
|
87
115
|
const headerTitleStyleSupported: TextStyle = { color: titleColor };
|
|
88
116
|
|
|
89
117
|
if (headerTitleStyleFlattened.fontFamily != null) {
|
|
@@ -98,6 +126,12 @@ export default function HeaderConfig({
|
|
|
98
126
|
headerTitleStyleSupported.fontWeight = titleFontWeight;
|
|
99
127
|
}
|
|
100
128
|
|
|
129
|
+
const headerBackgroundColor =
|
|
130
|
+
headerStyleFlattened.backgroundColor ??
|
|
131
|
+
(headerBackground != null || headerTransparent
|
|
132
|
+
? 'transparent'
|
|
133
|
+
: colors.card);
|
|
134
|
+
|
|
101
135
|
const headerLeftElement = headerLeft?.({
|
|
102
136
|
tintColor,
|
|
103
137
|
canGoBack,
|
|
@@ -162,15 +196,10 @@ export default function HeaderConfig({
|
|
|
162
196
|
) : null}
|
|
163
197
|
<ScreenStackHeaderConfig
|
|
164
198
|
backButtonInCustomView={backButtonInCustomView}
|
|
165
|
-
backgroundColor={
|
|
166
|
-
headerStyleFlattened.backgroundColor ??
|
|
167
|
-
(headerBackground != null || headerTransparent
|
|
168
|
-
? 'transparent'
|
|
169
|
-
: colors.card)
|
|
170
|
-
}
|
|
199
|
+
backgroundColor={headerBackgroundColor}
|
|
171
200
|
backTitle={headerBackTitleVisible ? headerBackTitle : ' '}
|
|
172
201
|
backTitleFontFamily={backTitleFontFamily}
|
|
173
|
-
backTitleFontSize={
|
|
202
|
+
backTitleFontSize={backTitleFontSize}
|
|
174
203
|
blurEffect={headerBlurEffect}
|
|
175
204
|
color={tintColor}
|
|
176
205
|
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}
|
|
@@ -183,11 +212,11 @@ export default function HeaderConfig({
|
|
|
183
212
|
(headerTransparent && headerShadowVisible !== true)
|
|
184
213
|
}
|
|
185
214
|
largeTitle={headerLargeTitle}
|
|
186
|
-
largeTitleBackgroundColor={
|
|
187
|
-
largeTitleColor={
|
|
215
|
+
largeTitleBackgroundColor={largeTitleBackgroundColor}
|
|
216
|
+
largeTitleColor={largeTitleColor}
|
|
188
217
|
largeTitleFontFamily={largeTitleFontFamily}
|
|
189
|
-
largeTitleFontSize={
|
|
190
|
-
largeTitleFontWeight={
|
|
218
|
+
largeTitleFontSize={largeTitleFontSize}
|
|
219
|
+
largeTitleFontWeight={largeTitleFontWeight}
|
|
191
220
|
largeTitleHideShadow={headerLargeTitleShadowVisible === false}
|
|
192
221
|
title={titleText}
|
|
193
222
|
titleColor={titleColor}
|
|
@@ -36,10 +36,10 @@ import type {
|
|
|
36
36
|
NativeStackNavigationHelpers,
|
|
37
37
|
NativeStackNavigationOptions,
|
|
38
38
|
} from '../types';
|
|
39
|
-
import useDismissedRouteError from '../utils/useDismissedRouteError';
|
|
40
|
-
import useInvalidPreventRemoveError from '../utils/useInvalidPreventRemoveError';
|
|
41
|
-
import DebugContainer from './DebugContainer';
|
|
42
|
-
import HeaderConfig from './HeaderConfig';
|
|
39
|
+
import { useDismissedRouteError } from '../utils/useDismissedRouteError';
|
|
40
|
+
import { useInvalidPreventRemoveError } from '../utils/useInvalidPreventRemoveError';
|
|
41
|
+
import { DebugContainer } from './DebugContainer';
|
|
42
|
+
import { HeaderConfig } from './HeaderConfig';
|
|
43
43
|
|
|
44
44
|
const isAndroid = Platform.OS === 'android';
|
|
45
45
|
|
|
@@ -440,7 +440,7 @@ function NativeStackViewInner({ state, navigation, descriptors }: Props) {
|
|
|
440
440
|
);
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
export
|
|
443
|
+
export function NativeStackView(props: Props) {
|
|
444
444
|
return (
|
|
445
445
|
<SafeAreaProviderCompat>
|
|
446
446
|
<NativeStackViewInner {...props} />
|
|
@@ -31,7 +31,7 @@ const TRANSPARENT_PRESENTATIONS = [
|
|
|
31
31
|
'containedTransparentModal',
|
|
32
32
|
];
|
|
33
33
|
|
|
34
|
-
export
|
|
34
|
+
export function NativeStackView({ state, descriptors }: Props) {
|
|
35
35
|
const parentHeaderBack = React.useContext(HeaderBackContext);
|
|
36
36
|
|
|
37
37
|
return (
|