Repository navigation
chore(ui): prepare every screen for Android 16 forced edge-to-edge - #741
Merged
Merged
Conversation
…ontext The core SafeAreaView is iOS-only (a plain View on Android) and deprecated in RN 0.77. The safe-area-context one pads by the system-bar overlap on both platforms and resolves it natively per view, so it is 0 wherever the window is not edge-to-edge and 0 below a navigation header. iOS layout is unchanged. FeaturedProfileView had hand-added StatusBar.currentHeight to its absolute header on Android to compensate for the core component doing nothing there; that would now double, so it is dropped. iris-browser loses dead navigation code that eslint flagged; FeaturedProfileView is run through the repo prettier (it had never been). ENG-605 PR4. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Screen wraps every screen. Its wrapper becomes react-native-safe-area- context's SafeAreaView on both platforms: position-aware (0 below a header or above a tab bar), 0 on a non-edge-to-edge window, and the real status/navigation-bar inset once the window is edge-to-edge (Android 15+ today, every Android 16 device at targetSdk 36). KeyboardAvoidingView stays behavior="padding" on iOS and undefined on Android, where it is a plain View and cannot stack on the new bottom inset; the choice and the Android keyboard story are documented in the component. NIP17Chat's manual StatusBar.currentHeight top padding goes (it would double with the wrapper). Dead statusBar code removed. Specs render Screen under a mocked SafeAreaProvider and assert the wrapper pads by initialMetrics, is a no-op at zero insets, keeps caller style, drops out under `unsafe`, and the KAV behavior per platform. ENG-605 PR4. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Audit of the 25 react-native-modal usages: 14 are centered (default
margin, no bar overlap), 2 are top-anchored, 1 is the blocking app-update
gate with 68dp of bottom clearance, 1 (modal-nfc) already uses a context
SafeAreaView, and 7 are bottom sheets flush to the window edge. Those 7
get the new shared hook.
useModalInsetStyle("sheet" | "fullScreen") in app/hooks/use-modal-insets
returns a memoised padding style from useSafeAreaInsets. All 7 sheets
render inline (coverScreen={false}, the #545 Fabric workaround) and Yoga
sizes an inset-positioned absolute child against the parent's padding
box, so the sheet reaches the physical bottom even inside Screen's padded
wrapper; the inset must live on the sheet. coverScreen settings untouched.
Sheets: contact-modal, AccountCreateModal, modal-tooltip, reports-modal,
CashoutAccountPicker, CashWalletCutoverModal, earns-quiz.
ENG-605 PR4.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ngView The chat-local reanimated IME hook moves to app/hooks/use-keyboard-padding with a new contract: useKeyboardPaddingStyle(appliedBottomInset) pads by max(imeHeight - appliedBottomInset, 0). Screen now pads insets.bottom itself, so callers pass that and the composer never stacks the nav-bar band twice. The arithmetic is a pure keyboardPaddingFor() with a spec. KeyboardAvoidingView audit (8 files): - Screen: documented in the previous commit. - messages, SupportGroupChat: already on the hook; drop the manual Android insets.top header padding (Screen pads it now). - BridgeAddExternalAccount: Android "height" double-shrank on Android 14 and older (window resize + KAV) and misses the Gboard strip under edge-to-edge; switch to the hook, KAV becomes an Android no-op. - BridgeKycModal, quick-zap-modal, CreateGroupModal, GroupInfoModal, GroupMembersModal: sheets inside a core Modal. RN's dialog window uses SOFT_INPUT_ADJUST_RESIZE with a fitsSystemWindows root, so the framework pads for the IME and bars; behavior stays undefined on Android, now with a comment saying why. ENG-605 PR4. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Review fixes for #741 (ENG-605). - `useModalInsetStyle` now takes the sheet's base style and returns `paddingBottom = basePaddingBottom + inset` (folding in `paddingVertical` and the `padding` shorthand). Every consumer places the result after its base style, so the old bare `{ paddingBottom: inset }` replaced the designed padding -- with 0 on a non-edge-to-edge window, which stripped `paddingBottom: 32/20/40` and the bottom of `padding: 24`. The hook spec now asserts the sum, the shorthand fold, style arrays, and the inset-0 case keeping the base padding. - `AccountCreateModal` and `CashWalletCutoverModal` drop the hook: they live on the Home bottom-tab screen, whose tab bar already pads `insets.bottom`, so the raw window inset stacked a second band above the tab bar today on Face ID iPhones and Android 15 3-button nav. - `NIP17Chat`: `{ flex: 1 }` moves into `useStyles` (`styles.flex`), clearing the `react-native/no-inline-styles` error on the changed line. - `use-keyboard-padding.ts`: correct the comment -- reanimated 3.18.2 does NOT restore `decorFitsSystemWindows` on unmount, so Android 14 stays edge-to-edge for the process after the first chat visit. - Consumer pins: `cashout-account-picker.spec` renders under a `SafeAreaProvider` with `bottom: 48` and asserts the sheet's flattened `paddingBottom` is `32 + 48` (and `32` at inset 0); `contact-modal.spec` asserts its wrapper gets `48`. New `cashout-account-sheet`, `contact-modal-sheet`, `modal-tooltip-sheet` test ids. - `app/hooks/index.ts`: drop the `use-modal-insets` barrel export; both new hooks are imported by deep path, one convention. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… fullScreen kind Review fixes on the ENG-605 modal inset work: - CashoutAccountPicker: the sheet container used `testProps`, which sets `accessible` and collapses the whole sheet into a single VoiceOver stop on iOS. Use a plain `testID` like the sibling sheet ids. - ModalTooltip: add a spec that pins the `padding` shorthand fold (the only consumer on that path) plus the inline render, under both a 3-button-nav inset and a non-edge-to-edge window. - Extract the `react-native-safe-area-context` provider mock, pasted into four specs, to `__tests__/helpers/safe-area-context-mock.ts`; it provides the frame context everywhere so a future consumer under a react-navigation header does not need its own variant. - use-modal-insets: drop the `fullScreen` kind and `basePaddingTop`, which had no consumer (the audit found no full-screen react-native-modal content), and their spec case. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Only the bottom-sheet case exists; the parameter named an edge the hook never read (review round 3). Co-Authored-By: Claude Fable 5.1 <[email protected]>
26 tasks
islandbitcoin
pushed a commit
that referenced
this pull request
Sep 25, 2026
The banner told the next engineer to pass `unsafe` on a transparent-header route. `unsafe` swaps the whole SafeAreaView for a bare View, so left, right and bottom go with the top, and on an edge-to-edge window the content then runs under the navigation bar — the defect this wrapper exists to prevent. That is the same failure this PR indicts #741 for: a docblock prescribing something the code does not support. Point at what actually works (reinstate the top inset from useSafeAreaInsets() on the route's own content) and warn off `unsafe` explicitly. No API change: no route uses headerTransparent today, so adding an `edges` override for a hypothetical caller would be speculative surface. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
islandbitcoin
added a commit
that referenced
this pull request
Sep 25, 2026
* fix(ui): stop Screen padding by the status bar under a nav header (ENG-611) #741 swapped Screen's wrapper from React Native's SafeAreaView to react-native-safe-area-context's and passed no `edges`, so all four edges pad additively. React Navigation's header already reserves the status bar (it renders a spacer of insets.top above its content), so every screen with a header gained a second status-bar-high band of dead space beneath the header. The docblock added in #741 claimed the wrapper is position-aware and so could not double-pad. That is not true of safe-area-context 5.x, which reads the nearest provider's insets verbatim and does no frame math against the view's own position — Android resolves findProvider() then getSafeAreaInsets(providerView), iOS reads _providerView.safeAreaInsets, and the Fabric shadow node folds stateData.insets.top in unchanged. Our provider is the root SafeAreaProvider in app.tsx, which spans the window, so `top` is always the full status bar however deep the screen sits. Both platforms are affected; the docblock is corrected here. Drop the top edge when HeaderShownContext says a header is shown above us — the same signal the header itself uses to decide whether to reserve the status bar — and keep all four when there is none, where this wrapper is the only thing holding content clear. Measured on device, both platforms, against the same build with only this commit removed: - Pixel 8 Pro: Home greeting y=526 -> y=375, a delta of 151px, exactly the status bar height. Header icons (y=151) and tab bar (y=2758) unchanged. - iPhone 13 Pro Max: "Send" y=358 -> y=311 and the carousel y=402 -> y=355, a delta of 47pt, exactly the status bar inset. Header icon (y=56) and tab bar (y=851) unchanged. The existing specs could not catch this: one asserts only that the tree contains RNCSafeAreaView, the other renders under a mock fed initialMetrics with no notion of a header above the wrapper. The new spec pins `edges` in both presets and fails 4 of its 6 cases with this fix reverted. @react-navigation/elements moves from a transitive to a declared dependency at the spec already resolved in yarn.lock (^1.3.31); yarn install --frozen-lockfile leaves the lockfile untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(ui): cover the unsafe branches, unattach the safe-area docblock Review fixes on ENG-611. - The 37-line safe-area docblock had ended up as a JSDoc on `EDGES_BELOW_HEADER`, an array of three strings, because the constant was inserted between the comment and the function it was written for. Move it to a file-level banner above the imports and leave a one-line JSDoc on the constant. `ScreenWithoutScrolling` gets its blank line back. - Both `unsafe` branches were rewritten to literal `View`s in this PR and neither was covered here; only the non-scrolling one had a check, in screen-android.spec.tsx. Add a case to the preset loop asserting no SafeAreaView is rendered, so a future edit that wires `edges` into the scrolling `unsafe` path cannot ship silently. Verified it fails for both presets with the branch mutated. - The bottom edge has the same double-pad defect: a bottom tab bar pads itself by `insets.bottom` and sits below the scene in normal flow, so this wrapper adds it a second time on every tab screen. Not fixed here — the routes that hide the bar with `tabBarStyle: { display: "none" }` still need the inset and `BottomTabBarHeightContext` cannot be trusted to read 0 for them without a device. Filed as ENG-612; documented in the banner, and the "which no header reserves" spec renamed to "which the header does not reserve" so the suite stops implying the bottom is settled. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(ui): note the headerTransparent gap, make the SafeAreaView mock honour edges Review fixes for ENG-611. The banner claimed HeaderShownContext is equivalent to "the header reserves the status bar". It is not: with headerTransparent the header is rendered absolutely and reserves nothing (stack CardStack's isFloatHeaderAbsolute, bottom tabs' styles.absolute on the header) while the context is still true. No route in the app sets it today, so nothing is broken now — but the banner is otherwise exhaustive about this mechanism and gave no warning. Record the exception in the banner and stop the useSafeAreaEdges docblock asserting the equivalence as fact. screen.spec.tsx's SafeAreaViewMock still modelled the pre-ENG-611 contract: it ignored `edges` and padded all four sides unconditionally, so every assertion in the file stayed green no matter what edges Screen passed — including `edges={[]}`. Make the mock honour the prop, and add a spec that renders under HeaderShownContext and asserts the top pad is actually 0 while the bottom one survives. That spec fails against the old mock. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(ui): correct the headerTransparent remedy in the Screen docblock The banner told the next engineer to pass `unsafe` on a transparent-header route. `unsafe` swaps the whole SafeAreaView for a bare View, so left, right and bottom go with the top, and on an edge-to-edge window the content then runs under the navigation bar — the defect this wrapper exists to prevent. That is the same failure this PR indicts #741 for: a docblock prescribing something the code does not support. Point at what actually works (reinstate the top inset from useSafeAreaInsets() on the route's own content) and warn off `unsafe` explicitly. No API change: no route uses headerTransparent today, so adding an `edges` override for a hypothetical caller would be speculative surface. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Dread <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
ENG-605 PR4. Prepares every screen for Android 16's forced edge-to-edge before
targetSdkVersionmoves to 36 (PR5). No SDK levels change here;android/build.gradleis untouched.What changed, per group
1. Core
SafeAreaView→react-native-safe-area-context(5 files)app/components/screen/screen.tsx,amount-input-modal.tsx,contact-picker.tsx,FeaturedProfileView.tsx,iris-browser.tsx. The core component is iOS-only (a plainViewon Android) and deprecated in RN 0.77. The context one is a native view that pads by the system-bar overlap it actually has, on both platforms. FeaturedProfileView's hand-addedStatusBar.currentHeight(its Android compensation for the core component doing nothing) is dropped so it does not double.2.
Screenedge-to-edge safe (1 component + 1 consumer, 2 specs)Screenwraps 82 screens. Its wrapper is now the contextSafeAreaViewon both platforms. Why it is safe to apply unconditionally:useSafeAreaInsets/ the native view resolve to 0 on a window that is not edge-to-edge, so the layout is unchanged there;KeyboardAvoidingViewstaysbehavior="padding"on iOS andundefinedon Android, where it is a plainViewand cannot stack on the new bottom inset. Documented in the component.NIP17Chat's manualStatusBar.currentHeighttop padding goes for the same double-pad reason (itsStatusBar translucentstays).3.
react-native-modalinset audit (25 usages → 5 changed, 1 new hook, 1 spec)14 centered (default margin, no bar overlap), 2 top-anchored (
merchant-suggest-modal,ChooseWallet), 1 blocking gate with 68dp bottom clearance (app-update), 1 already on a contextSafeAreaView(modal-nfc), 7 bottom sheets flush to the window edge. Five of those getuseModalInsetStyle("sheet", styles.sheet)from the newapp/hooks/use-modal-insets.ts:contact-modal,modal-tooltip,reports-modal,CashoutAccountPicker,earns-quiz. The hook is additive: it takes the sheet's base style and returnspaddingBottom = basePaddingBottom + inset(folding inpaddingVertical/ thepaddingshorthand, since a specific edge beats the shorthand in Yoga regardless of order), so placing it after the base style extends the designed padding rather than replacing it. All render inline (coverScreen={false}, #545); Yoga sizes an inset-positioned absolute child against the parent's padding box, so the sheet reaches the physical bottom even insideScreen's padded wrapper, and the inset has to live on the sheet. NocoverScreenvalue changed.The other two bottom sheets,
AccountCreateModalandCashWalletCutoverModal, are deliberately not padded: they live on the Home bottom-tab screen, so their inline absoluteFill ends at the tab bar, andBottomTabViewalready padsinsets.bottomunder it.useSafeAreaInsetsis the raw window inset (not position-aware), so padding there would stack a second inset band above the tab bar. Documented inline on both.4.
KeyboardAvoidingViewaudit (8 files)The chat-local reanimated IME hook moves to
app/hooks/use-keyboard-padding.tswith a new contract,useKeyboardPaddingStyle(appliedBottomInset)→paddingBottom = max(imeHeight − appliedBottomInset, 0);Screennow padsinsets.bottom, so callers pass that and never stack the nav-bar band twice. The arithmetic is a purekeyboardPaddingFor()with its own spec.messages,SupportGroupChat: already on the hook; their manual Androidinsets.topheader padding is dropped.BridgeAddExternalAccount: Androidbehavior="height"double-shrank on Android 14 and older (window resize + KAV) and misses the Gboard suggestion strip under edge-to-edge; switched to the hook, KAV is an Android no-op now. (Diff is mostly the reindent from the new wrapper;git diff -wis 16 lines.)BridgeKycModal,quick-zap-modal,CreateGroupModal,GroupInfoModal,GroupMembersModal: sheets inside a coreModal. RN 0.77's dialog window usesSOFT_INPUT_ADJUST_RESIZEwith afitsSystemWindowsroot, so the framework pads for the IME and the bars;behaviorstaysundefinedon Android, now with a comment saying why.Not in this PR:
android:enableOnBackInvokedCallback/ predictive back. ZeroBackHandlerusage in the app and RN 0.77 handles it; leave for its own change if needed.Why it is safe at targetSdk 35
Screenwrapper is aViewwith zero extra padding. Layout unchanged.messages,SupportGroupChatorBridgeAddExternalAccount: reanimated 3.18.2'suseAnimatedKeyboardflips the window to edge-to-edge on mount and does not restore it on unmount (WindowsInsetsManager.stopObservingChangescallssetDecorFitsSystemWindows(!statusTranslucent && !navTranslucent), which isfalsewith both translucent flags). The whole app then stays edge-to-edge for the rest of the process, so everyScreen, sheet anduseSafeAreaInsetsconsumer runs the edge-to-edge path on Android 14 too. That is a pre-existing condition, and it is the actual reason theScreenchange is needed on Android 14: before this PR, content sat under the status bar on every screen after visiting chat once. This PR fixes that incidentally.styles.xml): this PR fixes overlap that exists today on those devices.SafeAreaViewpads by the samesafeAreaInsetsas the core one. One known semantic difference: the core Fabric component replaced style padding with the insets; the context one adds them. No fixed-presetScreenconsumer passes padding instyle(checked), so nothing moves.Device test at targetSdk 36 (PR5)
messages,SupportGroupChat): at rest the composer sits on the nav bar inset once; with the keyboard up (Gboard, suggestion strip on) the composer sits directly on the strip, no gap, no overlap.CashoutAccountPicker32 + inset).AccountCreateModal,CashWalletCutoverModal): the sheet sits directly on the tab bar with its designed padding only; no second inset band between the sheet and the tab bar. Face ID iPhone and Android 15 3-button nav both.messages(orSupportGroupChat), go back, then walk a headerless screen, a headered stack screen, a bottom-tab screen and a bottom sheet. The window is now edge-to-edge for the rest of the process (see "Why it is safe"); content must be clear of the status bar and the nav bar everywhere, with no double gap.BridgeKycModal,quick-zap, the three GroupChat modals): with the keyboard up, inputs visible. Also watch for a double bottom gap on Android; these still addinsets.bottom + 16in JS on top of what the dialog root pads natively. If it shows, dropinsets.bottomon Android there (kept out of this PR because it cannot be verified without a device).BridgeAddExternalAccount: keyboard up, bottom field and submit button reachable by scrolling, no double shrink on an Android 14 device.amount-input-modal,contact-picker(coreModal+ contextSafeAreaView): header clear of the status bar, no double gap.FeaturedProfileView,iris-browser: header/top content clear of the status bar.CashoutDetails,CashoutConfirmation,TopupDetails,BankTransfer): they addmarginBottom: bottom + 10insideScreen, which is now padded too; expect an extra nav-bar-height gap on Android (same as iOS has today). Cosmetic; flag if unwanted.Tests
__tests__/components/screen.spec.tsx(5),screen-android.spec.tsx(3),app/hooks/__tests__/use-modal-insets.spec.tsx(8, pins the additive sum incl.paddingshorthand,paddingVertical, style arrays, and the non-edge-to-edge case),use-keyboard-padding.spec.ts(4).cashout-account-picker.spec.tsxrenders under aSafeAreaProviderwithbottom: 48and asserts the sheet's flattenedpaddingBottomis32 + 48(and stays32at inset 0);contact-modal.spec.tsxdoes the same for its wrapper (48). A refactor that drops the style-array entry now fails CI.yarn test(119 suites, 1185 tests),yarn tsc:check,scripts/ci/lint-changed.mjs(no errors on changed lines), repo-pinned prettier 2.8.8 on every changed file.assembleDebugarm64-v8a.🤖 Generated with Claude Code