Repository navigation
fix(flashcard): render the Android NFC scan sheet inline, with Cancel in reach - #751
Conversation
… in reach
Android has no system NFC sheet, so the Flashcard provider shows its own
("Ready to Scan" with a Cancel) while a read waits for a card. It was a
transparent core React Native Modal with a bottom-pinned sheet, the case
the Fabric Modal host measures wrongly on Android (#545): on the Pixel only
part of the NFC illustration showed, top-left, with no backdrop, no text
and no Cancel. Back was the only way out.
The sheet now renders inline through react-native-modal (coverScreen
false), as modal-nfc does since #674, in a full-size frame the provider
wraps around the app. A SafeAreaView keeps Cancel above the navigation bar
under Android 16's edge-to-edge. Cancel, Back and a tap on the backdrop
each end the read. iOS keeps its system sheet.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
493ea3e to
2688601
Compare
…ation container Review fixes for #751. - Back: the spec called the sheet's onBackButtonPress prop, so it could not see how Back really arrives. Inline there is no native dialog to catch it; react-native-modal's BackHandler listener does, and BackHandler runs the newest listener first. The spec now presses Back through React Native's own BackHandler mock, and again under the app's real NavigationContainerWrapper over a two-screen stack: with the sheet up, Back ends the read and the card screen stays; with the sheet down, Back pops the screen. Making the wrapper's getInitialURL synchronous fails that test. - Inline: the test only read the coverScreen prop. It now asserts no core Modal is in the tree while the sheet is up, as app-update-inline-modal.spec.tsx does. - Backdrop: pressed where react-native-modal draws it, not through the prop. - Comments at the sheet and at FlashcardProvider in app.tsx say why the provider has to stay inside NavigationContainerWrapper. No runtime change: the app bundle is byte-identical to the previous commit's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes for #751. The Pixel was not attached, so the device check ran on an API 35 emulator instead (Pixel 7 Pro profile, Fabric, a debug build of this branch, NFC faked in JS for the run and not committed). The sheet drew right in gesture and in 3-button navigation: dimmed backdrop, "Ready to Scan", and Cancel ending one navigation-bar height plus the sheet's 20 dp padding above the bottom. Cancel, Back and a backdrop tap each closed it, and Back over a pushed screen left that screen up. The Pixel check is now an Android RC blocker in the 0.7.3 Linear project rather than a line in this PR's body. The spec now pins the two facts that run depends on: Cancel sits in a SafeAreaView padded on the bottom edge only, and the sheet's parent is the flex: 1 frame the app renders in. Each assertion fails when its fact is removed (bottom edge dropped or joined by top, SafeAreaView swapped for a View, Cancel moved out of it, flex dropped, sheet or app moved out of the frame). The spec's gate note names the Linear issue. No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Device check: run on an emulator; the Pixel check is still owed and is now tracked outside this PR The Pixel 8 Pro was not attached (
In both modes the bottom inset equals the navigation bar's height, so the Not covered: real NFC, the Pixel's Android 17, and the two signed-in entry points (Home's card row, FlashcardV2TopUp). FlashcardV2TopUp adds no Pixel check: it is now an issue in the v0.7.3 Linear project (P-ENG-57), assigned and marked as blocking the API 36 ticket. It has this PR's checklist plus one more item: after each way out, the next read starts cleanly. The issue is left unlinked from this PR so that merging can't close it. Its ID is in the spec comment. 063ee28 pins the two facts the emulator run depends on. Cancel sits in a |
Android has no system NFC sheet, so the Flashcard provider shows its own ("Ready to Scan", with a Cancel) while a card read waits for a tap. On the Pixel 8 Pro (Android 17) it was broken: the sheet's window opened, but only part of the NFC illustration was drawn, in the top-left corner. There was no dimmed backdrop, no text and no Cancel, so Back was the only way out. Found during the 2026-10-02 device test by tapping refresh on the home screen's card row.
Cause: the sheet was a transparent core React Native
Modalwith a bottom-pinned sheet. That's the case the Fabric Modal host measures wrongly on Android (#545). The #674 sweep fixed it for thereact-native-modalsheets,modal-nfcamong them, but couldn't cover coreModalusages.Fix:
react-native-modalwithcoverScreen={false}, asmodal-nfcdoes. It sits in a full-size frame the provider now wraps around the app, so the frame is the whole screen.SafeAreaViewkeeps Cancel above the navigation bar under Android 16's forced edge-to-edge.cancelTechnologyRequest).Back and React Navigation: inline, no native dialog catches Back. It reaches the sheet through react-native-modal's
BackHandlerlistener, added when the provider mounts, andBackHandlerruns the newest listener first. The sheet hears Back before React Navigation only becauseNavigationContaineradds its own listener while it still renders nothing, waiting on the asyncgetInitialURL, and mounts the provider later. Comments at the sheet and atFlashcardProviderinapp.tsxsay so: the provider has to stay insideNavigationContainerWrapper.Tests: a new provider spec covers:
Modalin the tree, so noRCTModalHostView(feat: enable React Native New Architecture (Fabric + TurboModules) #545);BackHandlermock and the backdrop pressed where react-native-modal draws it;NavigationContainerWrapper, over a two-screen stack: with the sheet up it ends the read and the screen stays; with the sheet down it pops the screen;Each test fails when the behaviour it names is removed. That was checked by removing
coverScreen={false},onBackButtonPressandonBackdropPressin turn, by makinggetInitialURLsynchronous, and by adding a Back listener that always handles the press. Full suite: 159 suites, 1,859 tests.Device check (Pixel 8 Pro): still to do. Jest has no layout engine, so none of the above shows the sheet drawing right on the phone. A build of this branch was installed on the Pixel on 2026-10-04 with
adb install -r, keeping app data; its JS bundle is byte-identical to one built from9457e052c. The phone was PIN-locked and then disconnected, so the check itself has not been run. To do, in both gesture and 3-button navigation: start a read from Home's card row and one from FlashcardV2TopUp, and confirm the dimmed backdrop, "Ready to Scan" and Cancel above the navigation bar. On FlashcardV2TopUp, Back should end the read and leave the screen where it is.🤖 Generated with Claude Code