mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 17:52:49 +00:00
* Dismiss an Android bottom sheet with Back instead of the screen Bottom sheets render through a portal inside the app's own view tree rather than a native modal window, so Android offered Back to the navigator underneath them. On the model selector that meant one Back press left the chat and the app, with the sheet still open. `IsolatedBottomSheetModal` now claims `hardwareBackPress` for as long as the sheet is on screen and dismisses itself instead. Listeners are offered the press newest-first, so a stacked sheet answers before the one below it, and Back falls back through to the navigator once no sheet is left. * Move the Back press onto the sheet visibility tracker The first version held the press in `IsolatedBottomSheetModal` with its own `isOnScreen` state and a merged ref, duplicating the phase the visibility tracker already keeps, and it could only be tested through JSDOM with `vi.mock` and `vi.hoisted`, which docs/testing.md rules out. The tracker already owns presentation state and the sheet controller, so it takes a `BackPressSource` port and holds the press for exactly the window it is in the `presented` phase. `IsolatedBottomSheetModal` goes back to what it was on main. Every sheet call site reaches the tracker through `useIsolatedBottomSheetVisibility`, so coverage is unchanged. The real source registers nothing off Android, where there is no such press and `react-native-web`'s `BackHandler` logs an error on subscribe. The test is now a plain unit test against a fake adapter, with no mocks, no JSDOM, and no component mounting. --------- Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>