[BottomSheetController] Use view.bounds instead of view.frame when calculating sheet offset #2115
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.
Platforms Impacted
Description of changes
If the root view of the bottom sheet had a non-zero frame origin, the offset of the sheet would be miscalculated because the offset function was using the view frame and not the view bounds. When calculating the offset, we should use the view bounds so that the offset is calculated relative to the bottom sheet's root view's own space.
Binary change
(how is our binary size impacted -- see https://github.com/microsoft/fluentui-apple/wiki/Size-Comparison)
Verification
In the
BottomSheetControllerDemo
, I validated that the bottom sheet is correctly laid out when the bottom sheet view has an offset applied to its top anchor.Visual Verification
In the first row of images, you can see in the before that the sheet in the collapsed state is not visible and in the after it is. In the second row, you can see in the before that the sheet is push way off the screen due to the calculation using the frame and not the bounds, and in the after you can see that it is correctly positioned.Pull request checklist
This PR has considered:
Microsoft Reviewers: Open in CodeFlow