Merged
Conversation
Refactor the view modifiers for intrinsic height sheets to unify and simplify logic by introducing `intrinsicSheetDetents`. This new helper function abstracts the platform-specific sheet detent logic, handling size checking and applying appropriate presentation detents more efficiently. The change cleans up repeated code, removing conditional compilation blocks and reducing potential for maintenance errors.
Add conditional compilation to `intrinsicSheetDetents` method, wrapping `fixedSize` modifier with `#if canImport(Darwin)`. This ensures correct behavior on non-Darwin platforms, which might not support `.fixedSize` for `.presentationDetents`. This change is crucial for maintaining cross-platform compatibility and avoiding unexpected layout behavior.
Reset the sheet size to zero on presentation to guarantee an update to the correct size when the sheet is shown again. This fix is crucial for preventing incorrect size carry-over in repeated presentations. Improve size update logic by introducing a function to check for significant size changes before updating. This prevents unnecessary updates and reduces potential re-rendering loops, especially on Darwin platforms. Compensate for the bottom space on Android to ensure the sheet opens with the intended appearance.
Remove platform-specific (Darwin/Android) conditional checks to streamline and simplify the intrinsicHeightSheet implementation. The decision ensures consistent behavior across all platforms and removes unnecessary complexity, providing a cleaner and more maintainable codebase.
Removes redundant onChange checks for sheet presentation state, relying instead on the default behavior of SwiftUI's sheet presentation. Refactors sheet presentation logic to accommodate both Darwin and non-Darwin platforms using a conditional compilation approach. This simplifies code and improves maintainability while ensuring consistent behavior across platforms.
Simplify the logic for intrinsicSheetDetents by removing the conditional height check. Adjust the androidBottomCompensation from 24.0 to 20.0 for better UI consistency across platforms.
Simplify the SwiftUI intrinsic height sheet implementation by removing code specific to non-Darwin platforms, ensuring that only Darwin-specific logic is applied. The `intrinsicSheetDetents` and related compensation logic were removed as they were redundant, simplifying the logic focused on `canImport(Darwin)`.
piercifani
approved these changes
Feb 23, 2026
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.
Summary
This PR improves
intrinsicHeightSheetbehavior on Android while keeping iOS behavior unchanged.What changed
getCGSize.presentationDetents([.height(sheetSize.height)]).fixedSize(horizontal: false, vertical: true).intrinsicSheetDetents(sheetSize)with an Android bottom compensation (+20).Why
On Android (Skip/Compose), the same detent behavior as iOS is not stable enough by default. This adjustment makes the height behavior more predictable while preserving iOS parity.
Visual comparison
iOS
Simulator.Screen.Recording.-.iPhone.17.-.2026-02-23.at.17.01.28.mov
Android
Screen_recording_20260223_170005.webm