diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f0ee531..78adc000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +### 🐛 Bug fixes + +- **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)) +- **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)) + ## 3.10.0 ### 🎉 New features diff --git a/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt b/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt index c69af33d..863e4b7c 100644 --- a/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +++ b/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt @@ -964,7 +964,10 @@ class TrueSheetViewController(private val reactContext: ThemedReactContext) : val sheetHeight = sheet.height val sheetTop = sheet.top - var footerY = (sheetHeight - sheetTop - footerHeight - currentKeyboardInset).toFloat() + // Subtract bottomInset so footer content doesn't render behind the navigation/gesture bar. + // When the keyboard is visible, currentKeyboardInset already accounts for the bottom inset. + val safeAreaOffset = if (currentKeyboardInset > 0) 0 else bottomInset + var footerY = (sheetHeight - sheetTop - footerHeight - currentKeyboardInset - safeAreaOffset).toFloat() // Adjust during dismiss animation when slideOffset is negative if (slideOffset != null && slideOffset < 0) { diff --git a/ios/TrueSheetFooterView.mm b/ios/TrueSheetFooterView.mm index f2bf1d4d..4a44f997 100644 --- a/ios/TrueSheetFooterView.mm +++ b/ios/TrueSheetFooterView.mm @@ -61,7 +61,9 @@ - (void)setupConstraintsWithHeight:(CGFloat)height { [self.leadingAnchor constraintEqualToAnchor:parentView.leadingAnchor].active = YES; [self.trailingAnchor constraintEqualToAnchor:parentView.trailingAnchor].active = YES; - _bottomConstraint = [self.bottomAnchor constraintEqualToAnchor:parentView.bottomAnchor + // Pin to safe area so footer content doesn't render behind the home indicator. + // When the keyboard is visible, its height already includes the safe area inset. + _bottomConstraint = [self.bottomAnchor constraintEqualToAnchor:parentView.safeAreaLayoutGuide.bottomAnchor constant:-_currentKeyboardOffset]; _bottomConstraint.active = YES;