fix(mobile): capture a fresh search entry offset after native dismissal#27246
Summary
Track the pre-existing search-session offset mismatch deferred from #27184. Requested by @camchis.
After an iOS 27 search X action that sends blur without cancel, or a drag-dismissed empty search, JavaScript can retain searchMode: "expanded". Reopening search then skips enterSearch and retains the previous session's searchEntryOffset. Cancelling the new search can restore that stale offset instead of the position where the new search started.
Required changes
- Coordinate with the
react-native-screensfork follow-up to report native search dismissal distinctly from blur or query clearing. - Use that dismissal signal to end the search session without restoring an old scroll position.
- Ensure reopening a dismissed search captures the current scroll offset.
- Preserve the original entry offset when the user types and then clears a query within the same search session. Do not reset a session solely because its query is empty or its mode is
"expanded". - Coordinate with the existing iOS 27 typed-query dismissal follow-up, where closing the search bar can leave the list filtered. Native fork changes require a new native build.
Affected areas
apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx: native search events andenterSearch,searchFocused, andcancelSearch.apps/mobile/src/features/workspace/workspace-tabs-state.ts: search session state transitions.apps/mobile/src/features/workspace/workspace-tabs-state.test.ts: offset and query-clearing regression coverage.apps/mobile/src/features/home/HomeScreen.tsx: consumption of the restored offset.- The
react-native-screensfork's native dismissal event handling.
Acceptance criteria
- After an empty search is dismissed, scrolling and reopening search captures a fresh
searchEntryOffset. - Cancelling the reopened search restores the new session's entry position, not the previous session's position.
- Native dismissal ends the session without an unintended scroll jump.
- Typing and then clearing a query preserves the current session's entry offset. Keep the behavior covered by "clear keeps search active without losing the position cancel restores".
- Add regression coverage that distinguishes native dismissal from clearing a query.
- Verify the relevant dismissal and cancel flows on iOS 26 and iOS 27 with the updated native build.
- Preserve query restoration and the Duo's existing search behavior.
Context
The author reports that this mismatch already exists on main; automatic reopening on return previously hid it. This issue is a follow-up, not an additional change requested in #27184.