xamarin/Xamarin.Forms

Current Application gets overridden, causes application level resources to disappear

Offen

#1.418 geöffnet am 18.12.2017

 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (1.926 Forks)batch import
a/embedding 📦e/2 :clock2:good first issuehacktoberfest 🍻help wantedp/Androidp/UWPp/iOS 🍎t/bug :bug:up-for-grabs

Repository-Metriken

Stars
 (5.644 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Use case forms embedding, with application level staticresources:

  • Create a new XF page
  • Call CreateViewController
  • Present the VC the native way.

In this case the existing current XF application gets overridden with an empty one at https://github.com/xamarin/Xamarin.Forms/blob/4c8f901e2333ac1baae818ead61c93559f39758d/Xamarin.Forms.Platform.iOS/PageExtensions.cs#L15

Normally the RealParent would be set when assiging main page. But with embedding this is not used. The code should check wether there is a current XF application before overwriting it.

A workaround until this is fixed is setting the parent manually

var xfPage = new XfPage();
xfPage.Parent = Xamarin.Forms.Application.Current;
var naviteVC = xfPage.CreateViewController();

Contributor Guide