Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
3096fe0
fix(ios): use horizontal bars in sheets on iPhone Duo
PixPMusic Oct 17, 2026
f0d4b31
fix(ios): make horizontal sheet bars opt-in
PixPMusic Oct 17, 2026
d1aa7c8
fix(iOS, Tabs): don't drop user selection of UISearchTab on mount tra…
kkafar Oct 12, 2026
6f4e302
fix(iOS, Tabs): filter UIKit's didSelectTab: for programmatic selecti…
t0maboro Oct 13, 2026
d669555
Merge pull request #2 from PixPMusic/fix/duo-sheet-bars
juliusmarminge Oct 21, 2026
37b3e3a
chore: release 5.0.0-t3.31
juliusmarminge Oct 21, 2026
9453eb7
fix(ios): show a custom title the navigation bar stopped hosting
juliusmarminge Oct 21, 2026
e7137fa
chore: release 5.0.0-t3.32
juliusmarminge Oct 21, 2026
927b51b
fix(ios): a freed search field no longer deadlocks text measurement
juliusmarminge Oct 21, 2026
5f282fe
chore: release 5.0.0-t3.33
juliusmarminge Oct 21, 2026
e389a59
fix(ios): only UIKit's search field observer is removed with its storage
juliusmarminge Oct 21, 2026
67f258a
chore: release 5.0.0-t3.34
juliusmarminge Oct 21, 2026
24ef558
fix(iOS, Tabs): size the tab bar controller's view before attaching i…
nkt Oct 21, 2026
fca4d63
fix(iOS, Stack v4): iterate over a copy of reactSubviews when updatin…
ilp0 Oct 21, 2026
dcf7f85
fix(iOS, Stack): remove the navigation controller's view when a neste…
intergalacticspacehighway Oct 21, 2026
9612c9e
fix(ios): a screen moved between windows no longer trips the touch ha…
juliusmarminge Oct 21, 2026
2871cf3
chore: release 5.0.0-t3.35
juliusmarminge Oct 21, 2026
0cc9ac7
fix(ios): the search observer hook stores the original before installing
juliusmarminge Oct 22, 2026
8edcc5c
chore: release 5.0.0-t3.36
juliusmarminge Oct 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { device, expect, element, by } from 'detox';
import type { IosElementAttributes } from 'detox/detox';
import { selectComponentIntegrationTestsScreen } from '@e2e/app/test-screen-navigation';
import { toggleSettingsSwitch } from '@e2e/app/settings-controls';
import { tapWithinFrame } from '@e2e/framework/gestures';
import { getMatches } from '@e2e/framework/matchers';
import { CLASS_NAME_UI_TAB_BAR_BUTTON_IOS26 } from '@e2e/framework/native-classes-ios';
import { isIOSVersionAtLeast } from '@e2e/framework/platform';

// `UISearchTab` (and with it search activation and the collapsed tab bar) is
// used only on the `UITab` API path, enabled from iOS 26.1.
const describeIfUISearchTab = isIOSVersionAtLeast('26.1')
? describe
: describe.skip;

// Once the search tab has been activated, UIKit lets a mount transaction run
// between `shouldSelectTab:` and `didSelectTab:` on every later selection of
// it (observed on iOS 27), so a single round trip is not enough.
const SELECTION_ROUNDS = 5;

/**
* With the search active, UIKit shows the other tabs as a single collapsed
* button. It has no `testID` (the regular, hidden button keeps it) and is
* told apart by its accessibility value.
*/
async function tapCollapsedTabButton(label: string) {
const buttons = (await getMatches(
by.label(label).and(by.type(CLASS_NAME_UI_TAB_BAR_BUTTON_IOS26)),
)) as IosElementAttributes[];
const collapsedButton = buttons.find(button => button.value === 'Collapsed');
if (collapsedButton === undefined) {
throw new Error(`No collapsed tab button labeled "${label}"`);
}
await tapWithinFrame(collapsedButton.frame);
}

describeIfUISearchTab('Stack v4 & Tabs: search tab activation', () => {
beforeAll(async () => {
await device.reloadReactNative();
await selectComponentIntegrationTestsScreen(
'Stack V4 & Native Tabs Integration Tests',
'test-tabs-search-tab-activation-ios',
);
});

it('should keep the JS selection in sync when returning through the collapsed tab bar', async () => {
await toggleSettingsSwitch({
switchId: 'automatically-activates-search-switch',
label: 'automaticallyActivatesSearch',
to: true,
});

for (let round = 0; round < SELECTION_ROUNDS; round++) {
await element(by.id('search-tab-item')).tap();
await expect(
element(by.id('search-list-selected-in-js-label')),
).toHaveLabel('Selected in JS: yes');

// The activated search field brings up the keyboard, which covers the
// collapsed tab bar.
await element(by.id('search-list-scrollview')).swipe('down', 'slow', 0.3);
await tapCollapsedTabButton('Config');
await expect(element(by.text('Search Tab Activation'))).toBeVisible();
}
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { device, expect, element, by } from 'detox';
import { selectSingleFeatureTestsScreen } from '@e2e/app/test-screen-navigation';
import { describeIfIOS } from '@e2e/framework/platform';

type Route = 'Home' | 'Search';
type ActionOrigin = 'user' | 'programmatic-js';

// Several round trips - a selection dropped or reported twice on any of them
// shows up as a provenance mismatch.
const SELECTION_ROUNDS = 5;

async function expectSelection(
route: Route,
actionOrigin: ActionOrigin,
provenance: number,
) {
await expect(element(by.id(`${route}-selected-in-js-label`))).toHaveLabel(
'Selected in JS: yes',
);
await expect(element(by.id(`${route}-last-selection-label`))).toHaveLabel(
`Last selection: ${route} (${actionOrigin}), provenance: ${provenance}`,
);
}

describeIfIOS('Tabs: navigation state on search tab interactions', () => {
// Every selection advances the provenance by exactly one - a dropped
// selection leaves it behind, a duplicated one skips a value.
let provenance = 0;

beforeAll(async () => {
await device.reloadReactNative();
await selectSingleFeatureTestsScreen(
'Tabs',
'test-tabs-navigation-state-search-tab',
);
});

it('should start with the Home tab selected', async () => {
await expectSelection('Home', 'programmatic-js', provenance);
});

it('should progress the state on every user selection of the search tab', async () => {
for (let round = 0; round < SELECTION_ROUNDS; round++) {
await element(by.id('search-tab-item')).tap();
await expectSelection('Search', 'user', ++provenance);

await element(by.id('home-tab-item')).tap();
await expectSelection('Home', 'user', ++provenance);
}
});

it('should progress the state once on programmatic selection of the search tab', async () => {
await element(by.id('Home-select-search')).tap();
await expectSelection('Search', 'programmatic-js', ++provenance);

await element(by.id('Search-select-home')).tap();
await expectSelection('Home', 'programmatic-js', ++provenance);
});

it('should progress the state on user selection after programmatic one', async () => {
await element(by.id('Home-select-search')).tap();
await expectSelection('Search', 'programmatic-js', ++provenance);

await element(by.id('home-tab-item')).tap();
await expectSelection('Home', 'user', ++provenance);

await element(by.id('search-tab-item')).tap();
await expectSelection('Search', 'user', ++provenance);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ open class ScreenViewManager :
value: Boolean,
) = Unit

override fun setSheetPrefersHorizontalBars(
view: Screen?,
value: Boolean,
) = Unit

// END mark: iOS-only

override fun setAndroidResetScreenShadowStateOnOrientationChangeEnabled(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ class FormSheetHostViewManager :
view.prefersGrabberVisible = value
}

override fun setPrefersHorizontalBars(
view: FormSheetHost,
value: Boolean,
) = Unit // iOS-only bar placement preference.

override fun setPreferredCornerRadius(
view: FormSheetHost,
value: Float,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function SearchListScreen({
}) {
const [search, setSearch] = useState('');
const { hideNavigationBar } = useContext(HideNavigationBarContext);
// JS-side selection state - must follow UIKit after every user selection.
const { isSelected } = useTabsNavigationContext();

useLayoutEffect(() => {
navigation.setOptions({
Expand All @@ -86,8 +88,12 @@ function SearchListScreen({

return (
<ScrollView
testID="search-list-scrollview"
contentInsetAdjustmentBehavior="automatic"
keyboardDismissMode="on-drag">
<Text testID="search-list-selected-in-js-label" style={styles.hint}>
Selected in JS: {isSelected ? 'yes' : 'no'}
</Text>
{PLACES.filter(
item => item.toLowerCase().indexOf(search.toLowerCase()) !== -1,
).map(place => (
Expand Down Expand Up @@ -182,6 +188,7 @@ function ConfigTab() {
<View style={styles.screen}>
<Text style={styles.label}>Search Tab Activation</Text>
<SettingsSwitch
testID="automatically-activates-search-switch"
label="automaticallyActivatesSearch"
value={automaticallyActivatesSearch}
onValueChange={onAutomaticallyActivatesSearchChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export const scenarioDescription: ScenarioDescription = {
details:
'Validates automaticallyActivatesSearch on a search-role tab with a search bar in the nested (legacy) stack header, including the UIKit hosted-search contract across push/pop (hosted field exists only at the stack root).',
platforms: ['ios'],
e2eCoverage: 'tbd',
e2eCoverage: 'incomplete',
smokeTest: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ not integrate the search bar into the header yet.

## E2E test

TBD.
Incomplete: `FabricExample/e2e/component-integration-tests/tabs-stack-v4/test-tabs-search-tab-activation-ios.e2e.ts`
covers steps 8-9 (returning through the collapsed tab bar). The remaining
steps are not automated.

## Prerequisites

Expand Down Expand Up @@ -71,9 +73,23 @@ TBD.

- [ ] The large title no longer hides

### Returning through the collapsed tab bar

8. With **automaticallyActivatesSearch** enabled, tap the search tab,
dismiss the keyboard by dragging the list (it covers the collapsed tab
bar), then tap the collapsed `Config` button on the left (do not cancel).

- [ ] `Config` becomes selected.

9. Tap the search tab again. Repeat steps 8-9 a few times.

- [ ] The search field activates every time.

- [ ] The List screen shows "Selected in JS: yes" every time.

### Hosted search across push/pop in the nested stack

8. Tap the search tab again, dismiss the keyboard by dragging the list
10. Return to `Config`, tap the search tab, dismiss the keyboard by dragging the list
(do not cancel - cancel restores the previous tab), then tap a list
item to push **Details**.

Expand All @@ -83,7 +99,7 @@ TBD.
- [ ] The Details screen has its own search bar with the
"Search in details" placeholder in the header.

9. With Details on top, switch to `Config`, then reselect the search tab.
11. With Details on top, switch to `Config`, then reselect the search tab.

- [ ] No search activates automatically (the stack is not at its
root, so there is no hosted search field). The Details screen
Expand All @@ -92,15 +108,17 @@ TBD.
- [ ] Tapping the "Search in details" field focuses it and typing
updates the "Typed in the Details search bar" text.

10. Go back to **List** with the back gesture.
12. Go back to **List** with the back gesture.

- [ ] The "Search places" field returns to the tab bar area.

11. Switch to `Config`, then reselect the search tab.
13. Switch to `Config`, then reselect the search tab.

- [ ] Activation focuses the "Search places" field of the List screen
again (the hosted field re-binds after the pop).

12. Disable **automaticallyActivatesSearch** and tap the search tab.
14. Disable **automaticallyActivatesSearch** and tap the search tab.

- [ ] The search field is not focused automatically anymore.

- [ ] The List screen shows "Selected in JS: yes".
95 changes: 95 additions & 0 deletions apps/src/tests/issue-tests/Test4811.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React, { useEffect, useState } from 'react';
import { Button, StyleSheet, Text, View } from 'react-native';
import {
ScreenStack,
ScreenStackHeaderCenterView,
ScreenStackHeaderLeftView,
ScreenStackHeaderRightView,
ScreenStackItem,
} from 'react-native-screens';

// https://github.com/software-mansion/react-native-screens/issues/4811 (iOS)
//
// Press "Start". Without the fix the app crashes within a few seconds with
// "Collection <__NSArrayM> was mutated while being enumerated".
//
// `updateHeaderStateInShadowTreeInContextOfNavigationBar:` loops over `reactSubviews`.
// A header item that was just mounted sends its frame to the shadow tree synchronously,
// and that can mount the next pending commit. Here the left and right items toggle at
// different rates, so that commit adds or removes a header subview during the loop.
// Fast enumeration only notices it when it moves on to the next element, so the title
// is placed after the right item.

function HeaderItem() {
return <View style={styles.item} />;
}

export default function App() {
const [running, setRunning] = useState(false);
const [tick, setTick] = useState(0);

useEffect(() => {
if (!running) {
return;
}
let timer: ReturnType<typeof setTimeout>;
const loop = () => {
setTick(t => t + 1);
timer = setTimeout(loop, 0);
};
loop();
return () => clearTimeout(timer);
}, [running]);

return (
<ScreenStack style={styles.stack}>
<ScreenStackItem
screenId="home"
headerConfig={{
children: (
<>
{tick % 2 === 0 && (
<ScreenStackHeaderLeftView>
<HeaderItem />
</ScreenStackHeaderLeftView>
)}
{tick % 3 !== 0 && (
<ScreenStackHeaderRightView>
<HeaderItem />
</ScreenStackHeaderRightView>
)}
<ScreenStackHeaderCenterView>
<HeaderItem />
</ScreenStackHeaderCenterView>
</>
),
}}>
<View style={styles.container}>
<Button
title={running ? 'Stop' : 'Start'}
onPress={() => setRunning(r => !r)}
/>
<Text>Updates: {tick}</Text>
</View>
</ScreenStackItem>
</ScreenStack>
);
}

const styles = StyleSheet.create({
stack: {
flex: 1,
},
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
gap: 16,
},
item: {
width: 40,
height: 28,
borderRadius: 6,
backgroundColor: '#f2b8b5',
},
});
Loading