fix(mobile): stop the attachments carousel painting at corrupted frames

Merged
SA
4mo ago
+6-8

Fixes SUPER-1199, the known bug recorded in apps/mobile/TODO.md.

Root cause

react-native-screens lays a formSheet out expecting at most two subviews alongside a ScrollView. React Native's view flattening was hoisting the attachments screen's wrapper children straight into the sheet container, so it saw six and mis-sized the carousel's native frames. Tiles painted at roughly 60% height with square bottom corners, while Yoga and onLayout reported correct 96x96 boxes the entire time, which is why every previous JS-level attempt (flexShrink, wrappers, inset overrides, allowDownscaling, explicit dimensions) came back clean.

The library was already warning about it on every present:

WARN [RNScreens] FormSheet with ScrollView expects at most 2 subviews.
Got 6 for container: RNSSafeAreaViewComponentView. This might result in
incorrect layout. ... apply `collapsable: false` on your header component view.

Fix

Mark the content wrapper collapsable={false} so flattening can't hoist its children. One line plus a comment.

Verification

Reproduced first, on an iOS 26 simulator against a local stack:

  • Tiles mounting after presentation (permission card occupies the sheet during the animation, then swaps): correct, full-height squares.
  • Tiles mounting during presentation (reopen with permission already granted): corrupted, ~60% height, clipped bottom corners.
  • After the fix, same journey: correct. Confirmed cold as well (kill app, relaunch, open the sheet), since fast refresh masks this, and the subview warning stopped being emitted.

Notes

The TODO's first lead was upgrading react-native-screens from 4.25.2. That turns out to be unnecessary, which is worth keeping: a native navigation bump across the whole app right before App Store submission is real regression risk for no gain. The single-detent pin in (home)/_layout.tsx still covers the other trigger (detent resizes), so I left it alone.


Summary by cubic

Stops the attachments carousel from painting at corrupted frames on iOS form sheets. Previously tiles rendered ~60% height with clipped corners during presentation or after detent resizes; now they render at the correct 96×96 by preventing React Native view flattening (fixes Linear SUPER-1199).

Review notes

  • Set collapsable={false} on the content wrapper to keep children from being hoisted; react-native-screens form sheets expect at most two subviews next to a ScrollView.
  • No dependency upgrades; removed the TODO entry referencing SUPER-1199.
  • Verify on cold start and during presentation; the “FormSheet with ScrollView expects at most 2 subviews” warning should disappear and tiles remain square.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the photo carousel layout in the attachments sheet.
    • Prevented layout issues that could cause carousel content to display incorrectly in form sheets.