Open History to see the last commit
1diff --git a/lib/module/views/NativeStackView.native.js b/lib/module/views/NativeStackView.native.js
2index c342e90bffde9ad5044b6167bdde2e19be219270..4a045490f0650b4a0c821b3e799cf3d18531417f 100644
3--- a/lib/module/views/NativeStackView.native.js
4+++ b/lib/module/views/NativeStackView.native.js
5@@ -17,8 +17,12 @@ const ANDROID_DEFAULT_HEADER_HEIGHT = 56;
6 function isFabric() {
7 return 'nativeFabricUIManager' in global;
8 }
9+function SceneNavigationProvider({ presentationEnvelope, ...props }) {
10+ return presentationEnvelope ? props.children : /*#__PURE__*/_jsx(NavigationProvider, props);
11+}
12 const useNativeDriver = Platform.OS !== 'web';
13 const SceneView = ({
14+ presentationEnvelope,
15 index,
16 focused,
17 shouldFreeze,
18@@ -231,7 +235,8 @@ const SceneView = ({
19 }
20 }
21 });
22- return /*#__PURE__*/_jsx(NavigationProvider, {
23+ return /*#__PURE__*/_jsx(SceneNavigationProvider, {
24+ presentationEnvelope,
25 route: route,
26 navigation: navigation,
27 children: /*#__PURE__*/_jsx(ScreenStackItem, {
28@@ -353,6 +358,7 @@ const SceneView = ({
29 });
30 };
31 export function NativeStackView({
32+ presentationEnvelope,
33 state,
34 navigation,
35 descriptors,
36@@ -370,6 +376,17 @@ export function NativeStackView({
37 return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
38 children: /*#__PURE__*/_jsx(ScreenStack, {
39 style: styles.container,
40+ onFinishTransitioning: () => {
41+ // Surface UIKit's transition-completion callback to every route of
42+ // this navigator. Unlike transitionEnd, this also fires when a modal
43+ // finishes dismissing — where the presenting screen below receives no
44+ // appearance callbacks — and for a gesture-driven dismissal it fires
45+ // before the state pop, while the modal route is still the focused
46+ // one, so the event must not be targeted at a single route.
47+ navigation.emit({
48+ type: 'finishTransitioning'
49+ });
50+ },
51 children: state.routes.concat(state.preloadedRoutes).map((route, index) => {
52 const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key];
53 const isFocused = state.index === index;
54@@ -386,6 +403,7 @@ export function NativeStackView({
55 // due to component being unmounted. To avoid this, we don't freeze the previous screen there
56 const shouldFreeze = isFabric() ? !isPreloaded && !isFocused && !isBelowFocused && !isModalOnIos : !isPreloaded && !isFocused && !isModalOnIos;
57 return /*#__PURE__*/_jsx(SceneView, {
58+ presentationEnvelope,
59 index: index,
60 focused: isFocused,
61 shouldFreeze: shouldFreeze,
62diff --git a/lib/module/views/useHeaderConfigProps.js b/lib/module/views/useHeaderConfigProps.js
63index 9c21aa48cb580704aa17e59d9cdadcc612a1e4ff..a1b3a38368c5ef2257570f382e87df5d6f55b11e 100644
64--- a/lib/module/views/useHeaderConfigProps.js
65+++ b/lib/module/views/useHeaderConfigProps.js
66@@ -19,6 +19,12 @@ const processBarButtonItems = (items, colors, fonts) => {
67 }
68 return item;
69 }
70+ if (item.type === 'mailSearchToolbar' || item.type === 'searchBarPlacement') {
71+ return {
72+ ...item,
73+ index
74+ };
75+ }
76 if (item.type === 'button' || item.type === 'menu') {
77 if (item.type === 'menu' && item.menu == null) {
78 throw new Error(`Menu item must have a 'menu' property defined: ${JSON.stringify(item)}`);
79@@ -79,7 +85,7 @@ const processBarButtonItems = (items, colors, fonts) => {
80 }
81 return processedItem;
82 }
83- throw new Error(`Invalid item type: ${JSON.stringify(item)}. Valid types are 'button', 'menu', 'custom' and 'spacing'.`);
84+ throw new Error(`Invalid item type: ${JSON.stringify(item)}. Valid types are 'button', 'menu', 'custom', 'spacing', 'mailSearchToolbar' and 'searchBarPlacement'.`);
85 }).filter(item => item != null);
86 };
87 const transformIcon = icon => {
88@@ -158,8 +164,12 @@ export function useHeaderConfigProps({
89 headerBack,
90 route,
91 title,
92+ unstable_headerCenterItems: headerCenterItems,
93 unstable_headerLeftItems: headerLeftItems,
94- unstable_headerRightItems: headerRightItems
95+ unstable_headerRightItems: headerRightItems,
96+ unstable_headerSubtitle: headerSubtitle,
97+ unstable_headerToolbarItems: headerToolbarItems,
98+ unstable_navigationItemStyle: navigationItemStyle
99 }) {
100 const {
101 direction
102@@ -255,6 +265,10 @@ export function useHeaderConfigProps({
103 tintColor,
104 canGoBack
105 });
106+ const centerItems = headerCenterItems?.({
107+ tintColor,
108+ canGoBack
109+ });
110 let rightItems = headerRightItems?.({
111 tintColor,
112 canGoBack
113@@ -264,6 +278,10 @@ export function useHeaderConfigProps({
114 // So we need to reverse them here to match the order
115 rightItems = [...rightItems].reverse();
116 }
117+ const toolbarItems = headerToolbarItems?.({
118+ tintColor,
119+ canGoBack
120+ });
121 const children = /*#__PURE__*/_jsxs(_Fragment, {
122 children: [Platform.OS === 'ios' ? /*#__PURE__*/_jsxs(_Fragment, {
123 children: [leftItems ? leftItems.map((item, index) => {
124@@ -272,13 +290,23 @@ export function useHeaderConfigProps({
125 // eslint-disable-next-line @eslint-react/no-array-index-key
126 , {
127 hidesSharedBackground: item.hidesSharedBackground,
128+ identifier: item.identifier,
129 children: item.element
130 }, index);
131 }
132 return null;
133 }) : headerLeftElement != null ? /*#__PURE__*/_jsx(ScreenStackHeaderLeftView, {
134 children: headerLeftElement
135- }) : null, headerTitleElement != null ? /*#__PURE__*/_jsx(ScreenStackHeaderCenterView, {
136+ }) : null, centerItems ? centerItems.map((item, index) => {
137+ if (item.type === 'custom') {
138+ return /*#__PURE__*/_jsx(ScreenStackHeaderCenterView, {
139+ hidesSharedBackground: item.hidesSharedBackground,
140+ identifier: item.identifier,
141+ children: item.element
142+ }, index);
143+ }
144+ return null;
145+ }) : headerTitleElement != null ? /*#__PURE__*/_jsx(ScreenStackHeaderCenterView, {
146 children: headerTitleElement
147 }) : null]
148 }) : /*#__PURE__*/_jsxs(_Fragment, {
149@@ -321,6 +349,7 @@ export function useHeaderConfigProps({
150 // eslint-disable-next-line @eslint-react/no-array-index-key
151 , {
152 hidesSharedBackground: item.hidesSharedBackground,
153+ identifier: item.identifier,
154 children: item.element
155 }, index);
156 }
157@@ -356,6 +385,7 @@ export function useHeaderConfigProps({
158 largeTitleFontWeight,
159 largeTitleHideShadow: headerLargeTitleShadowVisible === false,
160 title: titleText,
161+ subtitle: headerSubtitle,
162 titleColor,
163 titleFontFamily,
164 titleFontSize,
165@@ -364,6 +394,9 @@ export function useHeaderConfigProps({
166 disableTopInsetApplication: !headerTopInsetEnabled,
167 translucent: translucent === true,
168 children,
169+ navigationItemStyle,
170+ headerToolbarItems: processBarButtonItems(toolbarItems, colors, fonts),
171+ headerCenterBarButtonItems: processBarButtonItems(centerItems, colors, fonts),
172 headerLeftBarButtonItems: processBarButtonItems(leftItems, colors, fonts),
173 headerRightBarButtonItems: processBarButtonItems(rightItems, colors, fonts),
174 experimental_userInterfaceStyle: dark ? 'dark' : 'light'
175diff --git a/lib/typescript/src/types.d.ts b/lib/typescript/src/types.d.ts
176index 2f1351a89f0f2e67e854dc81e392198326b71834..ccf8556911fa1fa17588f06b56edb2151a712bf0 100644
177--- a/lib/typescript/src/types.d.ts
178+++ b/lib/typescript/src/types.d.ts
179@@ -1091,6 +1091,13 @@ export type NativeStackHeaderItemSpacing = {
180 */
181 export type NativeStackHeaderItemCustom = {
182 type: 'custom';
183+ /**
184+ * An identifier used to match items across transitions.
185+ * Only available from iOS 26.0 and later.
186+ *
187+ * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/identifier
188+ */
189+ identifier?: string;
190 /**
191 * A React Element to display as the item.
192 */
193@@ -864,1 +864,3 @@
194 sharesBackground?: boolean;
195+ /** Native bar axis preference on iOS 27.1 and later. */
196+ axisBehavior?: 'automatic' | 'horizontalOnly' | 'verticalPreferred';
197diff --git a/src/types.tsx b/src/types.tsx
198index 7488b1cf20afe36b5c585fbfcd369471fdb6ab8d..f4bd78e48c687024ba84e998fac79e9eb16f1a80 100644
199--- a/src/types.tsx
200+++ b/src/types.tsx
201@@ -1156,6 +1156,13 @@ export type NativeStackHeaderItemSpacing = {
202 */
203 export type NativeStackHeaderItemCustom = {
204 type: 'custom';
205+ /**
206+ * An identifier used to match items across transitions.
207+ * Only available from iOS 26.0 and later.
208+ *
209+ * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/identifier
210+ */
211+ identifier?: string;
212 /**
213 * A React Element to display as the item.
214 */
215@@ -920,1 +920,3 @@
216 sharesBackground?: boolean;
217+ /** Native bar axis preference on iOS 27.1 and later. */
218+ axisBehavior?: 'automatic' | 'horizontalOnly' | 'verticalPreferred';
219diff --git a/src/views/useHeaderConfigProps.tsx b/src/views/useHeaderConfigProps.tsx
220index 3f3fff405048b3c2250afbe99dd7f35cecb9a6d5..bb062b898cfa77f8c02f951dc9d81b51672d7d0e 100644
221--- a/src/views/useHeaderConfigProps.tsx
222+++ b/src/views/useHeaderConfigProps.tsx
223@@ -397,6 +397,7 @@ export function useHeaderConfigProps({
224 // eslint-disable-next-line @eslint-react/no-array-index-key
225 key={index}
226 hidesSharedBackground={item.hidesSharedBackground}
227+ identifier={item.identifier}
228 >
229 {item.element}
230 </ScreenStackHeaderLeftView>
231@@ -471,6 +472,7 @@ export function useHeaderConfigProps({
232 // eslint-disable-next-line @eslint-react/no-array-index-key
233 key={index}
234 hidesSharedBackground={item.hidesSharedBackground}
235+ identifier={item.identifier}
236 >
237 {item.element}
238 </ScreenStackHeaderRightView>
239diff --git a/lib/typescript/src/views/NativeStackView.native.d.ts b/lib/typescript/src/views/NativeStackView.native.d.ts
240index c0d37db3b4a2a4e9340c76333821f44a87cd624b..eb3db8f511799b335a17edea31a2acd17627f909 100644
241--- a/lib/typescript/src/views/NativeStackView.native.d.ts
242+++ b/lib/typescript/src/views/NativeStackView.native.d.ts
243@@ -1,11 +1,12 @@
244 import { type ParamListBase, type RouteProp, type StackNavigationState } from '@react-navigation/native';
245 import type { NativeStackDescriptor, NativeStackDescriptorMap, NativeStackNavigationHelpers } from '../types.js';
246 type Props = {
247+ presentationEnvelope?: boolean;
248 state: StackNavigationState<ParamListBase>;
249 navigation: NativeStackNavigationHelpers;
250 descriptors: NativeStackDescriptorMap;
251 describe: (route: RouteProp<ParamListBase>, placeholder: boolean) => NativeStackDescriptor;
252 };
253-export declare function NativeStackView({ state, navigation, descriptors, describe, }: Props): import("react/jsx-runtime").JSX.Element;
254+export declare function NativeStackView({ presentationEnvelope, state, navigation, descriptors, describe, }: Props): import("react/jsx-runtime").JSX.Element;
255 export {};
256 //# sourceMappingURL=NativeStackView.native.d.ts.map
257\ No newline at end of file
258diff --git a/src/views/NativeStackView.native.tsx b/src/views/NativeStackView.native.tsx
259index 416cd90057cea362371a4308dd9985b086c5ccaa..7188a3daf0af2004303b21f89d3c0c7073517ef8 100644
260--- a/src/views/NativeStackView.native.tsx
261+++ b/src/views/NativeStackView.native.tsx
262@@ -51,7 +51,14 @@ function isFabric() {
263 return 'nativeFabricUIManager' in global;
264 }
265
266+// A presentation envelope contains descriptors from its owning navigator.
267+// Its synthetic route must not override those descriptors' focus state.
268+function SceneNavigationProvider({ presentationEnvelope, ...props }: React.ComponentProps<typeof NavigationProvider> & { presentationEnvelope?: boolean }) {
269+ return presentationEnvelope ? props.children : <NavigationProvider {...props} />;
270+}
271+
272 type SceneViewProps = {
273+ presentationEnvelope?: boolean;
274 index: number;
275 focused: boolean;
276 shouldFreeze: boolean;
277@@ -74,6 +81,7 @@ type SceneViewProps = {
278 const useNativeDriver = Platform.OS !== 'web';
279
280 const SceneView = ({
281+ presentationEnvelope,
282 index,
283 focused,
284 shouldFreeze,
285@@ -356,7 +364,7 @@ const SceneView = ({
286 );
287
288 return (
289- <NavigationProvider route={route} navigation={navigation}>
290+ <SceneNavigationProvider presentationEnvelope={presentationEnvelope} route={route} navigation={navigation}>
291 <ScreenStackItem
292 screenId={route.key}
293 activityState={isPreloaded ? 0 : 2}
294@@ -493,11 +501,12 @@ const SceneView = ({
295 </HeaderHeightContext.Provider>
296 </AnimatedHeaderHeightContext.Provider>
297 </ScreenStackItem>
298- </NavigationProvider>
299+ </SceneNavigationProvider>
300 );
301 };
302
303 type Props = {
304+ presentationEnvelope?: boolean;
305 state: StackNavigationState<ParamListBase>;
306 navigation: NativeStackNavigationHelpers;
307 descriptors: NativeStackDescriptorMap;
308@@ -508,6 +517,7 @@ type Props = {
309 };
310
311 export function NativeStackView({
312+ presentationEnvelope,
313 state,
314 navigation,
315 descriptors,
316@@ -555,6 +565,7 @@ export function NativeStackView({
317
318 return (
319 <SceneView
320+ presentationEnvelope={presentationEnvelope}
321 key={route.key}
322 index={index}
323 focused={isFocused}
324diff --git a/lib/typescript/src/views/NativeStackView.d.ts b/lib/typescript/src/views/NativeStackView.d.ts
325--- a/lib/typescript/src/views/NativeStackView.d.ts
326+++ b/lib/typescript/src/views/NativeStackView.d.ts
327@@ -1,6 +1,7 @@
328 import { type ParamListBase, type RouteProp, type StackNavigationState } from '@react-navigation/native';
329 import type { NativeStackDescriptor, NativeStackDescriptorMap, NativeStackNavigationHelpers } from '../types.js';
330 type Props = {
331+ presentationEnvelope?: boolean;
332 state: StackNavigationState<ParamListBase>;
333 navigation: NativeStackNavigationHelpers;
334 descriptors: NativeStackDescriptorMap;
335diff --git a/src/views/NativeStackView.tsx b/src/views/NativeStackView.tsx
336--- a/src/views/NativeStackView.tsx
337+++ b/src/views/NativeStackView.tsx
338@@ -24,6 +24,7 @@
339 import { AnimatedHeaderHeightContext } from '../utils/useAnimatedHeaderHeight';
340
341 type Props = {
342+ presentationEnvelope?: boolean;
343 state: StackNavigationState<ParamListBase>;
344 // This is used for the native implementation of the stack.
345 navigation: NativeStackNavigationHelpers;