Repository navigation
fix(ios): present navigator sheets opened under a fullScreenModal - #1021
Open
maxlapides wants to merge 2 commits into
Open
maxlapides wants to merge 2 commits into
maxlapides wants to merge 2 commits into
Conversation
A full-screen modal takes the views under it out of the window. A sheet-navigator sheet is hosted beside its base screen, so a sheet route opened while the base shows a fullScreenModal never registered with the module or found a presenter: it never appeared, dismiss() rejected with SHEET_NOT_FOUND, and the half-open route swallowed the modal's back action. Register hosts on mount, and when the modal covering a windowless host was presented by a stack the host isn't part of, present in that modal's window. Sheets inside the covered stack still wait for their screen. The bare example's sheet navigator gets a fullScreenModal repro screen.
|
@maxlapides is attempting to deploy a commit to the lodev09 Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
Repro code behind the screenshots and recordings in the description. It's the bare example's sheet navigator ( The committed version is the same, without the // HomeScreen (the navigator's base screen)
<Button
text="Open Full Screen Modal"
onPress={() => navigation.navigate('SheetHomeStack', { screen: 'FullScreenModal' })}
/>
const FullScreenModalScreen = () => {
const navigation = useTrueSheetNavigation<AppStackParamList & SheetStackParamList>();
return (
<View style={styles.content}>
<View style={styles.heading}>
<Text style={styles.title}>Full Screen Modal</Text>
<Text style={styles.subtitle}>
A fullScreenModal inside the sheet navigator's base screen. Sheets opened from here
present over it.
</Text>
</View>
<Button text="Open Details Sheet" onPress={() => navigation.navigate('Details')} />
<Button text="Open Settings Sheet" onPress={() => navigation.navigate('Settings')} />
<Button text="Close Modal" onPress={() => navigation.goBack()} />
{/* Temporary, not committed: goes back through the sheet navigator, like Expo Router's router.back() */}
<Button text="TMP Root Back" onPress={() => navigation.getParent()?.goBack()} />
</View>
);
};
// SheetHomeNavigator (the base screen's stack)
<SheetHomeStack.Navigator>
<SheetHomeStack.Screen name="Home" component={HomeScreen} />
<SheetHomeStack.Screen name="Test" component={TestScreenWrapper} />
<SheetHomeStack.Screen
name="FullScreenModal"
component={FullScreenModalScreen}
options={{ presentation: 'fullScreenModal', headerShown: false }}
/>
</SheetHomeStack.Navigator>Steps: Sheet Navigator → Open Full Screen Modal → Open Details Sheet, then TMP Root Back or Close Modal. Temporary probes for the inline-sheet checks in the Test Plan (not committed)// HomeScreen, inside the stack the modal covers
<TrueSheet name="tmp-home-inline" detents={['auto']}>
<Text>TMP Home Inline (present)</Text>
</TrueSheet>
{tmpHomeAuto && (
<TrueSheet initialDetentIndex={0} detents={['auto']}>
<Text>TMP Home Inline (auto)</Text>
</TrueSheet>
)}
// App.tsx, beside the navigation tree
<NavigationContainer>
<RootNavigator />
</NavigationContainer>
<TrueSheet name="tmp-root" detents={['auto']}>
<Text>TMP Root Sheet</Text>
</TrueSheet>
// FullScreenModalScreen
<Button
text="TMP Present Home Inline" // rejects: "No presenting view controller found"
onPress={() => TrueSheet.present('tmp-home-inline').then(onPresented, onRejected)}
/>
<Button
text="TMP Mount Home Auto" // waits, then presents once the modal closes
onPress={() => setTmpHomeAuto(true)}
/>
<Button
text="TMP Present Root" // presents over the modal
onPress={() => TrueSheet.present('tmp-root').then(onPresented, onRejected)}
/> |
maxlapides
marked this pull request as ready for review
November 11, 2026 03:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On iOS, a sheet-navigator sheet never presents if its route opens while the navigator's base screen shows a react-native-screens
fullScreenModal(for example, a deep link or a button inside the modal that navigates to a sheet route).A full-screen presentation takes the views under it out of the window. The navigator renders its sheets beside the base screen, so a sheet mounted while the modal is up has no window:
TrueSheetViewonly registered withTrueSheetModulefromdidMoveToWindow, sodismiss()(and closing the route) rejected withNo sheet found with tag N.findPresentingViewControllerstarted fromself.window.rootViewController, so auto-present never found a presenter and the sheet never appeared.closingwith no native sheet), so a back action through the sheet navigator (e.g. Expo Router'srouter.back()) was consumed by it, and the modal could no longer close that way. If the modal closed through its own stack instead, the sheet popped up late over the base screen.This PR:
presentationWindow: when the host has no window because a full-screen modal covers it, and that modal was presented by a stack the host isn't part of (react-native-screens keeps a presented screen'sreactSuperviewon its stack), the sheet presents in the modal's window, over the modal. This covers sheet-navigator sheets and sheets rendered beside the navigation tree (e.g. a root-level named sheet).fullScreenModalstill waits for its screen to come back, as the Deep Linking guide describes.present()there still rejects with "No presenting view controller found".fullScreenModalrepro screen to the bare example's sheet navigator (Sheet Navigator → Open Full Screen Modal → Open Details / Settings Sheet).Android is unchanged.
Type of Change
Test Plan
iOS 27.2 simulator (iPhone 18 Pro), bare example, A/B against
main:main: Open Full Screen Modal → Open Details Sheet shows nothing. A back action through the sheet navigator throwsUncaught (in promise): Error: No sheet found with tag …, and the modal stays up. Closing the modal through its own stack makes the stuck Details sheet pop up over Home.pop(), Go Back, and swipe-to-dismiss all work. The modal closes afterwards, and no stale sheet appears.present()on a sheet in the base's Home screen while the modal is up still rejects. A sheet mounted there withinitialDetentIndexwaits, then presents once the modal closes. A named sheet rendered besideNavigationContainerpresents over the modal.fullScreenModal(Open Modal) with its inline sheets, the main sheet after closing it, and the sheet navigator without a modal.yarn typecheck,yarn test(175 passed), eslint, prettier, clang-format.Screenshots / Videos
iOS 27.2 simulator, bare example. Some captures show a temporary "TMP Root Back" button (not committed) that calls the parent navigator's
goBack(), the way Expo Router'srouter.back()does. The repro code is in a comment below.Open Details Sheet from the modal
On
main, nothing presents. With the fix, the sheet presents over the modal.Before (
main)After
Go back through the sheet navigator
On
main, this throwsNo sheet found with tag …and the modal stays up. With the fix, the sheet dismisses and the modal is usable again.Before (
main)After
Close the modal
On
main, the stuck Details sheet pops up over Home. With the fix, Home has no stale sheet.Before (
main)After
Recordings
Before (
main): Open Details Sheet does nothing, so the modal stays up with no sheet. At about 0:16, Close Modal closes the modal and the stuck Details sheet pops up over Home. Taps aren't shown in the recordings.before-head.mp4
Before (
main): Open Details Sheet does nothing. TMP Root Back throwsNo sheet found with tag …(about 0:22) and the modal stays up, even after a second tap. At about 0:35, Close Modal closes the modal and the stuck Details sheet pops up over Home.before-root-back.mp4
After: Details presents over the modal. Then resize, a stacked Settings sheet, pop, Go Back, swipe-to-dismiss Settings, and Close Modal, which leaves no stale sheet on Home.
after-fix.mp4
Checklist