Skip to content

Commit 0836181

Browse files
Merge pull request #232 from syncfusion/BottomSheetAllowedState
Resolved the initial layout issue when AllowedState is set to FullExpanded
2 parents fa29e20 + 71189e6 commit 0836181

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

maui/src/BottomSheet/SfBottomSheet.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ void SetupBottomSheetForShow()
20592059
/// <returns>The target Y position for the bottom sheet.</returns>
20602060
double GetTargetPosition()
20612061
{
2062-
if (State is BottomSheetState.FullExpanded || !_isHalfExpanded)
2062+
if ((State is BottomSheetState.FullExpanded || !_isHalfExpanded) && State is not BottomSheetState.Collapsed && AllowedState is not BottomSheetAllowedState.HalfExpanded)
20632063
{
20642064
return GetFullExpandedPosition();
20652065
}
@@ -2078,7 +2078,7 @@ double GetTargetPosition()
20782078
/// <returns>The calculated position for the fully expanded state. Currently, it always returns 0.</returns>
20792079
double GetFullExpandedPosition()
20802080
{
2081-
if (State is BottomSheetState.Hidden)
2081+
if (State is BottomSheetState.Hidden || State is not BottomSheetState.FullExpanded)
20822082
{
20832083
State = BottomSheetState.FullExpanded;
20842084
}
@@ -2139,12 +2139,12 @@ void AnimateBottomSheet(double targetPosition, Action? onFinish = null)
21392139
}
21402140

21412141
int animationDuration = this.GetClampedAnimationDuration();
2142-
const int topPadding = 2;
2142+
const int topPadding = 2;
21432143
_isSheetOpen = true;
21442144
if (_bottomSheet is not null)
21452145
{
21462146
var bottomSheetAnimation = new Animation(d => _bottomSheet.TranslationY = d, _bottomSheet.TranslationY, targetPosition + topPadding);
2147-
_bottomSheet?.Animate("bottomSheetAnimation", bottomSheetAnimation, length: (uint)animationDuration, easing: Easing.Linear, finished: (v, e) =>
2147+
_bottomSheet?.Animate("bottomSheetAnimation", bottomSheetAnimation, length: (uint)animationDuration, easing: Easing.Linear, finished: (v, e) =>
21482148
{
21492149
UpdateBottomSheetHeight();
21502150
onFinish?.Invoke();

0 commit comments

Comments
 (0)