Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #25 #26

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions SettingsView/Handlers/SettingsViewHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using MobileCoreServices;

namespace AiForms.Settings.Handlers;

public partial class SettingsViewHandler: ViewHandler<SettingsView, AiTableView>
{
public static IPropertyMapper<SettingsView, SettingsViewHandler> Mapper =
Expand Down Expand Up @@ -42,19 +42,8 @@ protected override AiTableView CreatePlatformView()
VirtualView.SectionCollectionChanged += OnSectionCollectionChanged;
VirtualView.SectionPropertyChanged += OnSectionPropertyChanged;
VirtualView.CellPropertyChanged += OnCellPropertyChanged;

Element elm = VirtualView;
while (elm != null)
{
elm = elm.Parent;
if (elm is Page)
{
break;
}
}

_parentPage = elm as Page;
_parentPage.Appearing += ParentPageAppearing;

VirtualView.ParentChanged += ParentChanged;

_insetTracker = new KeyboardInsetTracker(_tableview, () => PlatformView.Window, insets => PlatformView.ContentInset = PlatformView.ScrollIndicatorInsets = insets, point =>
{
Expand All @@ -67,6 +56,23 @@ protected override AiTableView CreatePlatformView()

return _tableview;
}

void ParentChanged(object sender, EventArgs e)
{
Element elm = VirtualView;

while (elm != null)
{
elm = elm.Parent;
if (elm is Page)
{
break;
}
}
_parentPage = elm as Page;
_parentPage.Appearing += ParentPageAppearing;
VirtualView.ParentChanged -= ParentChanged;
}

protected override void DisconnectHandler(AiTableView platformView)
{
Expand Down