Skip to content

Commit

Permalink
Fixes #592
Browse files Browse the repository at this point in the history
  • Loading branch information
jbomhold3 committed May 29, 2023
1 parent 158cdf1 commit 706ad68
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/BlazorStrap/Shared/Components/OffCanvas/BSOffCanvasBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public override bool Shown
#endregion

protected bool ShouldRenderContent { get; set; } = true;
private string _style = string.Empty;

protected override void OnInitialized()
{
Expand All @@ -108,23 +109,23 @@ public override async Task HideAsync()
var func = async () =>
{
CanRefresh = false;
_shown = false;
// Used to hide popovers
BlazorStrapService.ForwardToggle("", this);
//await BlazorStrapService.Interop.HideModalAsync(_objectRef, DataId, MyRef, !_leaveBodyAlone);
//await BlazorStrapService.Interop.RemoveDocumentEventAsync(this, DataId, EventType.Keyup);
//await BlazorStrapService.Interop.RemoveDocumentEventAsync(this, DataId, EventType.Click);
//if (ShowBackdrop)
//{
// if (!AllowScroll)
// {
// var scrollWidth = await BlazorStrapService.Interop.GetScrollBarWidth();
// await BlazorStrapService.Interop.SetBodyStyleAsync("overflow", "");
// await BlazorStrapService.Interop.SetBodyStyleAsync("paddingRight", "");
// }
//}
if (ShowBackdrop)
{
if (!AllowScroll)
{
var scrollWidth = await BlazorStrapService.Interop.GetScrollBarWidth();
await BlazorStrapService.Interop.SetBodyStyleAsync("overflow", "");
await BlazorStrapService.Interop.SetBodyStyleAsync("paddingRight", "");
}
}
//// Used to hide popovers
//BlazorStrapService.ForwardToggle("", this);
Expand All @@ -142,7 +143,7 @@ public override async Task HideAsync()
if (BackdropRef != null)
await BackdropRef.HideAsync();
_shown = false;
_leaveBodyAlone = false;
ShouldRenderContent = ContentAlwaysRendered;
await InvokeAsync(StateHasChanged);
Expand Down Expand Up @@ -177,8 +178,10 @@ public override async Task ShowAsync()
ShouldRenderContent = true;
await InvokeAsync(StateHasChanged);
}
_shown = true;
CanRefresh = false;
await BlazorStrapService.Interop.ShowOffcanvasAsync(_objectRef, DataId, MyRef, !AllowScroll, ShowBackdrop);
await BlazorStrapService.Interop.AddClassAsync(MyRef, "show");
//await BlazorStrapService.Interop.AddDocumentEventAsync(_objectRef, DataId, EventType.Keyup);
//await BlazorStrapService.Interop.AddDocumentEventAsync(_objectRef, DataId, EventType.Click);
Expand All @@ -204,7 +207,7 @@ public override async Task ShowAsync()
//catch //Animation failed cleaning up
//{
//}
_shown = true;
await InvokeAsync(StateHasChanged);
_ = Task.Run(() => { _ = OnShown.InvokeAsync(this); });
taskSource.SetResult(true);
Expand Down

0 comments on commit 706ad68

Please sign in to comment.