Skip to content

Conversation

@t0maboro
Copy link
Contributor

@t0maboro t0maboro commented Nov 18, 2025

Description

Add a new prop to control formSheet overflow behavior relative to the status bar.

This PR introduces a new prop that allows to control whether a formSheet should overflow the status bar and display cutouts or not. The purpose of this addition is to align the formSheet behavior more closely with iOS, where the top safe area inset is respected by default.

Caution

This is a breaking change that has an impact on the sheet's size (and indirectly may lead to significant visual changes). To bring back the original behavior, you can set sheetShouldOverflowTopInset prop to true

Fixes https://github.com/software-mansion/react-native-screens-labs/issues/565

Changes

  • Added a class for coordinating the bottom sheet slide animation, to be started after we receive insets.
  • Added a class to aggregate listeners for insets on bottom sheet level
  • Added sheetShouldOverflowTopInset prop

Screenshots / GIFs

Here you can add screenshots / GIFs documenting your change.

You can add before / after section if you're changing some behavior.

With overflow

with-overflow.mov

Without overflow

without-overfow.mov

Test code and steps to reproduce

Test with 3336 with API levels over and below 30

Checklist

  • Included code example that can be used to test this change
  • Ensured that CI passes

@t0maboro t0maboro changed the title feat(Android, Stack): Allow FormSheet to be constrained by insets feat(Android, Stack): Allow FormSheet to be constrained by StatusBar Nov 19, 2025
@t0maboro t0maboro marked this pull request as ready for review November 19, 2025 09:59
@t0maboro t0maboro force-pushed the @t0maboro/form-sheet-flex-end branch from a10f3a4 to ccfc096 Compare November 19, 2025 11:17
src/types.tsx Outdated
*
* @platform android
*/
sheetShouldOverflowStatusBar?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should highlight in the description that with sheetShouldOverflowStatusBar: false, ratios from sheetAllowedDetents will be relative to safe area, not the container height (e.g. if you set sheetAllowedDetents: [0.5], the height (relative to window) will be different depending on sheetShouldOverflowStatusBar prop).

Another question is whether this is the behavior we want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@t0maboro t0maboro Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another question is whether this is the behavior we want.

Imo it does make sense to calculate detent within the available sheet space. Like, having detent 1.0 and sheetShouldOverflowStatusBar: false would result in content cutoff if we'd calculate maxHeight as detent*containerHeight

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. + this way I believe we keep alignment between platforms, which is nice when possible

Base automatically changed from @t0maboro/form-sheet-flex-end to main November 19, 2025 11:43
@t0maboro t0maboro force-pushed the @t0maboro/form-sheet-below-status-bar branch from 328f05a to 0646967 Compare November 19, 2025 11:45
@t0maboro t0maboro requested a review from kligarski November 19, 2025 11:56
@t0maboro t0maboro requested a review from kligarski November 19, 2025 13:42
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I have few comments / requests.

Looking at the final comment from the review: https://github.com/software-mansion/react-native-screens/pull/3404/files#r2545394786 (read first please)

I think that we should treat this as a fix & make the sheets respect insets by default.

Therefore we should work on naming. First, it can not be overflowStatusBar, since it is too specific and not entirely true, right? Doesn't this PR also handle display cutout? Can you verify this? How does it look when there is a big display cutout present (you can turn it on in emulator settings (google for it please))?

If so, we should rather refer to it as topInset IMO.

Additionally if the default's gonna be false, then we should phrase it more like sheetShouldIgnoreTopInset. Then false as the deafult value & if someone wants to active the prop he sets it to true.

What do you think?

src/types.tsx Outdated
*
* @platform android
*/
sheetShouldOverflowStatusBar?: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. + this way I believe we keep alignment between platforms, which is nice when possible


When set to `false`, the sheet's layout will be constrained by the status bar insets from the top and the detent ratios will then be measured relative to the adjusted height (excluding the top inset). This means that sheetAllowedDetents will result in different sheet heights depending on this prop.

Defaults to `true`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in two minds regarding the default value here.

There are a couple of things to consider here:

  1. what's the previous behaviour, so that we don't introduce breaking changes,
  2. alignment between platforms,
  3. reasonable default.

I think that the previous state is that the sheet does expand to full screen height, so that it does not respect the top insets.

As per alignment - iOS does the opposite, it respects the insets (cutout, status bar, etc.).

As per reasonable default - I think it is to respect the insets.

IMO we could treat this as a fix/improvement rather than behaviour change and make it aligned with iOS.

Copy link
Contributor Author

@t0maboro t0maboro Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the previous state is that the sheet does expand to full screen height, so that it does not respect the top insets.

Correct

As per alignment - iOS does the opposite, it respects the insets (cutout, status bar, etc.).

Correct

As per reasonable default - I think it is to respect the insets.

50/50 😄

The only argument I have is to keep the compatibility, because that change will have some impact on the appearance in existing apps, which are having 1.0 detent. Not a strong preference, aligning with iOS seems to be a reasonable approach either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm proposing this 5cc9372

@t0maboro
Copy link
Contributor Author

Looks good overall. I have few comments / requests.

Looking at the final comment from the review: https://github.com/software-mansion/react-native-screens/pull/3404/files#r2545394786 (read first please)

I think that we should treat this as a fix & make the sheets respect insets by default.

Therefore we should work on naming. First, it can not be overflowStatusBar, since it is too specific and not entirely true, right? Doesn't this PR also handle display cutout? Can you verify this? How does it look when there is a big display cutout present (you can turn it on in emulator settings (google for it please))?

If so, we should rather refer to it as topInset IMO.

Additionally if the default's gonna be false, then we should phrase it more like sheetShouldIgnoreTopInset. Then false as the deafult value & if someone wants to active the prop he sets it to true.

What do you think?

I wasn't sure about the support for display cutout, but added it here: 25a543b . Then here: 5cc9372 I'm proposing the new name for the prop.

@t0maboro t0maboro requested a review from kkafar November 20, 2025 15:57
@t0maboro t0maboro changed the title feat(Android, Stack): Allow FormSheet to be constrained by StatusBar fix(Android, Stack): Constraint FormSheet height by top inset Nov 20, 2025
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two more remarks. I'll come back to this PR tomorrow with few more questions.

@t0maboro t0maboro requested a review from kkafar November 21, 2025 08:50
@t0maboro t0maboro force-pushed the @t0maboro/form-sheet-below-status-bar branch from 30baf69 to 1cbdabc Compare November 21, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants