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

RegisterForNavigationOnPlatform not Registers Default View instead of Platform View #1700

Closed
erikh111 opened this issue Feb 18, 2019 · 4 comments · Fixed by #1702
Closed
Assignees
Labels

Comments

@erikh111
Copy link

Description

I'm attempting to implement the common ViewModel platform or idiom specific View use case and am having trouble with the platform specific View rendering as it should according to the documentation.

Steps to Reproduce

  1. Create ViewAPage.xaml, ViewBPage.xaml view using add new item in IDE, ViewAPageViewModel & ViewBPageViewModel generated
  2. Create ViewAPageTablet.xaml and ViewBPageAndroid.xaml
  3. Register Views/ViewModels in the containerRegistry
    containerRegistry.RegisterForNavigationOnIdiom<ViewAPage, ViewAPageViewModel>(tabletView: typeof(ViewAPageTablet));
    containerRegistry.RegisterForNavigationOnPlatform<ViewBPage, ViewBPageViewModel>(new Platform<ViewBPageAndroid>(RuntimePlatform.Android));

Expected Behavior

Expected the ViewBPage.xaml would render when running on an android simulator just as the ViewPageTablet.xaml rendered when running an iOS Tablet simulator

Actual Behavior

The default ViewBPage.xaml renders regardless of simulator OS.

Basic Information

  • Version with issue: 7.1.0.431
  • Last known good version: 7.1.0.431
  • Xamarin.Forms version: 3.2.0.871581
  • IDE: Visual Studio Community (for Mac)

Screenshots

screen shot 2019-02-18 at 1 59 05 pm
screen shot 2019-02-18 at 1 57 27 pm
screen shot 2019-02-18 at 1 57 01 pm
screen shot 2019-02-18 at 1 56 53 pm

Reproduction Link

Archive.zip

@dansiegel dansiegel changed the title RegisterForNavigationOnPlatform not rendering platform specific view RegisterForNavigationOnPlatform not Registers Default View instead of Platform View Feb 19, 2019
@dansiegel
Copy link
Member

This is confirmed. It appears that the current registration logic ends up registering the View twice resulting in the original default View type taking precedence.

@dansiegel
Copy link
Member

@erikh111 thanks for the bug report and repo app! this has been fixed and will be available shortly in the CI feed.

@erikh111
Copy link
Author

@dansiegel thanks for reviewing this issue and providing a fix so quickly!

@lock
Copy link

lock bot commented Jan 28, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants