@react-navigation/native-stack 7.0.0-alpha.1 → 7.0.0-alpha.11
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 +25 -16
- package/lib/commonjs/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.native.js +124 -47
- 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 +23 -14
- package/lib/module/views/NativeStackView.js.map +1 -1
- package/lib/module/views/NativeStackView.native.js +123 -46
- 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 +264 -166
- package/src/views/NativeStackView.tsx +131 -123
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { getHeaderTitle, HeaderTitle } from '@react-navigation/elements';
|
|
2
|
-
import { Route, useTheme } from '@react-navigation/native';
|
|
2
|
+
import { type Route, useLocale, useTheme } from '@react-navigation/native';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
I18nManager,
|
|
6
|
-
Platform,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
TextStyle,
|
|
9
|
-
View,
|
|
10
|
-
} from 'react-native';
|
|
4
|
+
import { Platform, StyleSheet, type TextStyle, View } from 'react-native';
|
|
11
5
|
import {
|
|
12
6
|
isSearchBarAvailableForCurrentPlatform,
|
|
13
7
|
ScreenStackHeaderBackButtonImage,
|
|
@@ -30,7 +24,6 @@ type Props = NativeStackNavigationOptions & {
|
|
|
30
24
|
};
|
|
31
25
|
|
|
32
26
|
export function HeaderConfig({
|
|
33
|
-
headerHeight,
|
|
34
27
|
headerBackImageSource,
|
|
35
28
|
headerBackButtonMenuEnabled,
|
|
36
29
|
headerBackTitle,
|
|
@@ -59,6 +52,7 @@ export function HeaderConfig({
|
|
|
59
52
|
title,
|
|
60
53
|
canGoBack,
|
|
61
54
|
}: Props): JSX.Element {
|
|
55
|
+
const { direction } = useLocale();
|
|
62
56
|
const { colors, fonts } = useTheme();
|
|
63
57
|
const tintColor =
|
|
64
58
|
headerTintColor ?? (Platform.OS === 'ios' ? colors.primary : colors.text);
|
|
@@ -182,118 +176,105 @@ export function HeaderConfig({
|
|
|
182
176
|
headerTransparent !== false);
|
|
183
177
|
|
|
184
178
|
return (
|
|
185
|
-
|
|
186
|
-
{
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
179
|
+
<ScreenStackHeaderConfig
|
|
180
|
+
backButtonInCustomView={backButtonInCustomView}
|
|
181
|
+
backgroundColor={headerBackgroundColor}
|
|
182
|
+
backTitle={headerBackTitleVisible ? headerBackTitle : ' '}
|
|
183
|
+
backTitleFontFamily={backTitleFontFamily}
|
|
184
|
+
backTitleFontSize={backTitleFontSize}
|
|
185
|
+
blurEffect={headerBlurEffect}
|
|
186
|
+
color={tintColor}
|
|
187
|
+
direction={direction}
|
|
188
|
+
disableBackButtonMenu={headerBackButtonMenuEnabled === false}
|
|
189
|
+
hidden={headerShown === false}
|
|
190
|
+
hideBackButton={headerBackVisible === false}
|
|
191
|
+
hideShadow={
|
|
192
|
+
headerShadowVisible === false ||
|
|
193
|
+
headerBackground != null ||
|
|
194
|
+
(headerTransparent && headerShadowVisible !== true)
|
|
195
|
+
}
|
|
196
|
+
largeTitle={headerLargeTitle}
|
|
197
|
+
largeTitleBackgroundColor={largeTitleBackgroundColor}
|
|
198
|
+
largeTitleColor={largeTitleColor}
|
|
199
|
+
largeTitleFontFamily={largeTitleFontFamily}
|
|
200
|
+
largeTitleFontSize={largeTitleFontSize}
|
|
201
|
+
largeTitleFontWeight={largeTitleFontWeight}
|
|
202
|
+
largeTitleHideShadow={headerLargeTitleShadowVisible === false}
|
|
203
|
+
title={titleText}
|
|
204
|
+
titleColor={titleColor}
|
|
205
|
+
titleFontFamily={titleFontFamily}
|
|
206
|
+
titleFontSize={titleFontSize}
|
|
207
|
+
titleFontWeight={titleFontWeight}
|
|
208
|
+
topInsetEnabled={headerTopInsetEnabled}
|
|
209
|
+
translucent={
|
|
210
|
+
// This defaults to `true`, so we can't pass `undefined`
|
|
211
|
+
translucent === true
|
|
212
|
+
}
|
|
213
|
+
>
|
|
214
|
+
{Platform.OS === 'ios' ? (
|
|
215
|
+
<>
|
|
216
|
+
{headerLeftElement != null ? (
|
|
217
|
+
<ScreenStackHeaderLeftView>
|
|
218
|
+
{headerLeftElement}
|
|
219
|
+
</ScreenStackHeaderLeftView>
|
|
220
|
+
) : null}
|
|
221
|
+
{headerTitleElement != null ? (
|
|
222
|
+
<ScreenStackHeaderCenterView>
|
|
223
|
+
{headerTitleElement}
|
|
224
|
+
</ScreenStackHeaderCenterView>
|
|
225
|
+
) : null}
|
|
226
|
+
</>
|
|
227
|
+
) : (
|
|
228
|
+
<>
|
|
229
|
+
{headerLeftElement != null || typeof headerTitle === 'function' ? (
|
|
230
|
+
<ScreenStackHeaderLeftView>
|
|
231
|
+
<View style={styles.row}>
|
|
236
232
|
{headerLeftElement}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
{headerBackImageSource !== undefined ? (
|
|
283
|
-
<ScreenStackHeaderBackButtonImage source={headerBackImageSource} />
|
|
284
|
-
) : null}
|
|
285
|
-
{headerRightElement != null ? (
|
|
286
|
-
<ScreenStackHeaderRightView>
|
|
287
|
-
{headerRightElement}
|
|
288
|
-
</ScreenStackHeaderRightView>
|
|
289
|
-
) : null}
|
|
290
|
-
{hasHeaderSearchBar ? (
|
|
291
|
-
<ScreenStackHeaderSearchBarView>
|
|
292
|
-
<SearchBar {...headerSearchBarOptions} />
|
|
293
|
-
</ScreenStackHeaderSearchBarView>
|
|
294
|
-
) : null}
|
|
295
|
-
</ScreenStackHeaderConfig>
|
|
296
|
-
</>
|
|
233
|
+
{headerTitleAlign !== 'center' ? (
|
|
234
|
+
typeof headerTitle === 'function' ? (
|
|
235
|
+
headerTitleElement
|
|
236
|
+
) : (
|
|
237
|
+
<HeaderTitle
|
|
238
|
+
tintColor={tintColor}
|
|
239
|
+
style={headerTitleStyleSupported}
|
|
240
|
+
>
|
|
241
|
+
{titleText}
|
|
242
|
+
</HeaderTitle>
|
|
243
|
+
)
|
|
244
|
+
) : null}
|
|
245
|
+
</View>
|
|
246
|
+
</ScreenStackHeaderLeftView>
|
|
247
|
+
) : null}
|
|
248
|
+
{headerTitleAlign === 'center' ? (
|
|
249
|
+
<ScreenStackHeaderCenterView>
|
|
250
|
+
{typeof headerTitle === 'function' ? (
|
|
251
|
+
headerTitleElement
|
|
252
|
+
) : (
|
|
253
|
+
<HeaderTitle
|
|
254
|
+
tintColor={tintColor}
|
|
255
|
+
style={headerTitleStyleSupported}
|
|
256
|
+
>
|
|
257
|
+
{titleText}
|
|
258
|
+
</HeaderTitle>
|
|
259
|
+
)}
|
|
260
|
+
</ScreenStackHeaderCenterView>
|
|
261
|
+
) : null}
|
|
262
|
+
</>
|
|
263
|
+
)}
|
|
264
|
+
{headerBackImageSource !== undefined ? (
|
|
265
|
+
<ScreenStackHeaderBackButtonImage source={headerBackImageSource} />
|
|
266
|
+
) : null}
|
|
267
|
+
{headerRightElement != null ? (
|
|
268
|
+
<ScreenStackHeaderRightView>
|
|
269
|
+
{headerRightElement}
|
|
270
|
+
</ScreenStackHeaderRightView>
|
|
271
|
+
) : null}
|
|
272
|
+
{hasHeaderSearchBar ? (
|
|
273
|
+
<ScreenStackHeaderSearchBarView>
|
|
274
|
+
<SearchBar {...headerSearchBarOptions} />
|
|
275
|
+
</ScreenStackHeaderSearchBarView>
|
|
276
|
+
) : null}
|
|
277
|
+
</ScreenStackHeaderConfig>
|
|
297
278
|
);
|
|
298
279
|
}
|
|
299
280
|
|
|
@@ -302,15 +283,4 @@ const styles = StyleSheet.create({
|
|
|
302
283
|
flexDirection: 'row',
|
|
303
284
|
alignItems: 'center',
|
|
304
285
|
},
|
|
305
|
-
translucent: {
|
|
306
|
-
position: 'absolute',
|
|
307
|
-
top: 0,
|
|
308
|
-
left: 0,
|
|
309
|
-
right: 0,
|
|
310
|
-
zIndex: 1,
|
|
311
|
-
elevation: 1,
|
|
312
|
-
},
|
|
313
|
-
background: {
|
|
314
|
-
overflow: 'hidden',
|
|
315
|
-
},
|
|
316
286
|
});
|