Skip to content

[agent-cli] runtime:tree finds the focused screen of an expo-router 58 app (llp/0018 §Shipped decisions 2) - #199

Merged
vonovak merged 1 commit into
mainfrom
vonovak/fix-focused-screen-router
Oct 26, 2026
Merged

vonovak merged 1 commit into
mainfrom
vonovak/fix-focused-screen-router

Conversation

@vonovak

@vonovak vonovak commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In expo-router 58 apps, runtime:tree --testID read every mounted screen, oldest first, so the first match could be a stale screen (dogfood N3-08). Focus detection knew one screen shape, Screen with isFocused and name, which in expo-router 58 only its native tabs render. expo-router 58 ships its own copy of React Navigation (expo-router/build/react-navigation/), whose navigators render Screen (JS tabs, drawer) or SceneView (native stack) with focused and route.

Fix

Focus detection reads both shapes. JS stack, JS top tabs and headless ui tabs render neither, so they still report no focused screen (llp/0018).

🤖 Generated with Claude Code

@vonovak
vonovak force-pushed the vonovak/fix-focused-screen-router branch from bf93d8d to 377ccde Compare October 23, 2026 22:22
@vonovak
vonovak marked this pull request as ready for review October 24, 2026 03:41
@vonovak
vonovak requested a review from Kudo October 24, 2026 03:41
@vonovak
vonovak marked this pull request as draft October 24, 2026 05:08
…8 app (llp/0018 §Shipped decisions 2)

Problem (dogfood finding N3-08): in an expo-router 58 app, runtime:tree said
"which screen is focused could not be determined" and listed every mounted
screen, oldest first. After three pushes of street/[name], --testID
street-length returned three matches, so an agent read a stale screen first.

Cause: the focus detection read only a fiber named Screen with props
isFocused and name. That is the expo-router native tabs shape. React
Navigation's Screen and SceneView carry focused and route instead, so on the
native stack and JS tabs focus was null.

Change: the screen reader keeps the native tabs shape (Screen with isFocused
and name) and accepts the React Navigation shape (Screen for JS tabs and
drawer, SceneView for the native stack, with focused and route). The focus
rule is unchanged. JS stack, JS top tabs and headless ui tabs render no screen
fiber either shape matches; they still report focusedScreen null and the whole
tree, and the LLP says so. The test fixture screen() is renamed
nativeTabsScreen() to name its source.

expo-router 58.0.24 source: native tabs render Screen with name and isFocused
(build/native-tabs/NativeTabsView.ios.js:65-69). JS tabs render
elements.Screen with focused and route
(build/react-navigation/bottom-tabs/views/BottomTabView.js:260), and so does
the drawer (drawer/views/DrawerView.js:249-251). The native stack renders a
SceneView with focused and route
(native-stack/views/NativeStackView.native.js:100,385-387). The core SceneView
(core/SceneView.js:74) is rendered inside every route and has no focused prop.
The JS stack renders CardContainerInner with focused and scene
(stack/views/Stack/CardStack.js:476-481).

Red before: the focus filter in an expo-router 58 app > finds the top stack
screen as the focused one, and matches one element of three street screens
(focusedScreen was null, expected "street/[name]").

Guard: the focus filter in an expo-router 58 app > reports no focused screen
and the whole tree under the JS stack, whose cards are not screen fibers
(passes before; fails with "expected 'street/[name]' to be null" if a
SceneView without focused counts as focused). The core SceneView inside each
route of the first test fails it with "expected +0 to be 1" if a missing
focused reads as false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vonovak
vonovak force-pushed the vonovak/fix-focused-screen-router branch from 377ccde to 7a2a16a Compare October 24, 2026 20:50
@vonovak
vonovak marked this pull request as ready for review October 26, 2026 09:10
@vonovak
vonovak merged commit 6158ee6 into main Oct 26, 2026
38 of 40 checks passed
@vonovak
vonovak deleted the vonovak/fix-focused-screen-router branch October 26, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants