Skip to content

Commit

Permalink
Used mapper instead of a control event
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo committed Jan 24, 2024
1 parent 790463e commit f3b584e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/Controls/src/Core/ContentPage/ContentPage.Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ public partial class ContentPage
internal new static void RemapForControls()
{
PageHandler.Mapper.ReplaceMapping<ContentPage, IPageHandler>(nameof(ContentPage.HideSoftInputOnTapped), MapHideSoftInputOnTapped);
#if IOS
PageHandler.Mapper.ReplaceMapping<ContentPage, IPageHandler>(PlatformConfiguration.iOSSpecific.Page.PrefersHomeIndicatorAutoHiddenProperty.PropertyName, MapPrefersHomeIndicatorAutoHidden);
#endif
}

static void MapPrefersHomeIndicatorAutoHidden(IPageHandler handler, ContentPage page)
{
handler?.UpdateValue(nameof(IHomeIndicatorAutoHiddenView.IsHomeIndicatorAutoHidden));
}

static void MapHideSoftInputOnTapped(IPageHandler handler, ContentPage page)
Expand Down
9 changes: 0 additions & 9 deletions src/Controls/src/Core/ContentPage/ContentPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ public bool HideSoftInputOnTapped
public ContentPage()
{
this.NavigatedTo += (_, _) => UpdateHideSoftInputOnTapped();
this.PropertyChanged += ContentPage_PropertyChanged;
}

private void ContentPage_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == PlatformConfiguration.iOSSpecific.Page.PrefersHomeIndicatorAutoHiddenProperty.PropertyName)
{
Handler?.UpdateValue(nameof(IHomeIndicatorAutoHiddenView.IsHomeIndicatorAutoHidden));
}
}

protected override void OnBindingContextChanged()
Expand Down

0 comments on commit f3b584e

Please sign in to comment.