Skip to content

Commit 5bf244f

Browse files
isaacrowntreeclaude
andcommitted
fix: footer ignoring safe area bottom inset
iOS: Pin footer bottom constraint to safeAreaLayoutGuide.bottomAnchor so content doesn't render behind the home indicator on notched devices. When the keyboard is visible its height already includes the safe area inset, so no double-compensation is needed. Android: Subtract bottomInset in positionFooter so footer content doesn't render behind the navigation/gesture bar. When the keyboard is visible, currentKeyboardInset already accounts for the bottom inset. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 626a04c commit 5bf244f

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
### 🐛 Bug fixes
6+
7+
- **iOS**: Fixed footer ignoring safe area insets by pinning to `safeAreaLayoutGuide.bottomAnchor` instead of `bottomAnchor`. ([#644](https://github.com/lodev09/react-native-true-sheet/pull/644) by [@isaacrowntree](https://github.com/isaacrowntree))
8+
- **Android**: Fixed footer rendering behind the navigation/gesture bar by accounting for `bottomInset` in `positionFooter`. ([#644](https://github.com/lodev09/react-native-true-sheet/pull/644) by [@isaacrowntree](https://github.com/isaacrowntree))
9+
510
## 3.10.0
611

712
### 🎉 New features

android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,10 @@ class TrueSheetViewController(private val reactContext: ThemedReactContext) :
964964
val sheetHeight = sheet.height
965965
val sheetTop = sheet.top
966966

967-
var footerY = (sheetHeight - sheetTop - footerHeight - currentKeyboardInset).toFloat()
967+
// Subtract bottomInset so footer content doesn't render behind the navigation/gesture bar.
968+
// When the keyboard is visible, currentKeyboardInset already accounts for the bottom inset.
969+
val safeAreaOffset = if (currentKeyboardInset > 0) 0 else bottomInset
970+
var footerY = (sheetHeight - sheetTop - footerHeight - currentKeyboardInset - safeAreaOffset).toFloat()
968971

969972
// Adjust during dismiss animation when slideOffset is negative
970973
if (slideOffset != null && slideOffset < 0) {

ios/TrueSheetFooterView.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ - (void)setupConstraintsWithHeight:(CGFloat)height {
6161
[self.leadingAnchor constraintEqualToAnchor:parentView.leadingAnchor].active = YES;
6262
[self.trailingAnchor constraintEqualToAnchor:parentView.trailingAnchor].active = YES;
6363

64-
_bottomConstraint = [self.bottomAnchor constraintEqualToAnchor:parentView.bottomAnchor
64+
// Pin to safe area so footer content doesn't render behind the home indicator.
65+
// When the keyboard is visible, its height already includes the safe area inset.
66+
_bottomConstraint = [self.bottomAnchor constraintEqualToAnchor:parentView.safeAreaLayoutGuide.bottomAnchor
6567
constant:-_currentKeyboardOffset];
6668
_bottomConstraint.active = YES;
6769

0 commit comments

Comments
 (0)