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

OnOptionsItemSelected Never Called when use MasterDetailPage's Detail as NavigationPage #3894

Open
yanshouwang opened this Issue Sep 25, 2018 · 6 comments

Comments

3 participants
@yanshouwang

yanshouwang commented Sep 25, 2018

Description

OnOptionsItemSelected Never Called when use MasterDetailPage's Detail as NavigationPage, and I can't intercept the software back button in the navigation bar.
It's very important to my team to do navigation through WebView and local Pages...

Steps to Reproduce

  1. Create MasterDetailPage and use Detail as NavigationPage.
  2. Use detail page to navigate to other pages, such as a WebView page.
  3. can't intercept the software back button click event. So I can't use the back button to navigate with the WebView...This is very common in native hybrid apps.

Expected Behavior

I want to intercept the software back button event when use MasterDetailPage.

Actual Behavior

The OnOptionsItemSelected method do triggered when the mainpage is a NavigationPage, but when use MasterDetailPage, it's never called.

Basic Information

  • Version with issue:Latest
  • Last known good version:None
  • IDE:VS2017 Community
  • Platform Target Frameworks:
    • iOS: Latest
    • Android: Latest
    • UWP: None
  • Android Support Library Version: Latest
  • Nuget Packages:Latest
  • Affected Devices:All

Screenshots

None

Reproduction Link

I wrote a demo here

@rmarinho

This comment has been minimized.

Show comment
Hide comment
@rmarinho

rmarinho Sep 26, 2018

Member

I think this is not a bug, you will need a CustomRenderer or something similar for a navigation update.

We could make this easy so marking as a enhancement

Member

rmarinho commented Sep 26, 2018

I think this is not a bug, you will need a CustomRenderer or something similar for a navigation update.

We could make this easy so marking as a enhancement

@rmarinho rmarinho moved this from New to Ready For Work in Triage Sep 26, 2018

@yanshouwang

This comment has been minimized.

Show comment
Hide comment
@yanshouwang

yanshouwang Sep 26, 2018

Yes, I finally did this through a custom renderer, but I think it’s too complex to implement this

yanshouwang commented Sep 26, 2018

Yes, I finally did this through a custom renderer, but I think it’s too complex to implement this

@rmarinho

This comment has been minimized.

Show comment
Hide comment
@rmarinho

rmarinho Sep 26, 2018

Member

@yanshouwang can you share your implementation so we can try to make it easier ?

Member

rmarinho commented Sep 26, 2018

@yanshouwang can you share your implementation so we can try to make it easier ?

@yanshouwang

This comment has been minimized.

Show comment
Hide comment
@yanshouwang

yanshouwang Sep 26, 2018

@rmarinho ok, I'll try to write a sample tomorrow~

yanshouwang commented Sep 26, 2018

@rmarinho ok, I'll try to write a sample tomorrow~

@yanshouwang

This comment has been minimized.

Show comment
Hide comment
@yanshouwang

yanshouwang Sep 27, 2018

@rmarinho Hi, I wrote a sample just now, and I only did this on iOS and Android,
the sample is here

yanshouwang commented Sep 27, 2018

@rmarinho Hi, I wrote a sample just now, and I only did this on iOS and Android,
the sample is here

@nickrandolph

This comment has been minimized.

Show comment
Hide comment
@nickrandolph

nickrandolph Oct 1, 2018

@rmarinho the issue with XF is that it blocks developers from intercepting the back button behaviour (main reason for overriding OnOptionsItemSelected), without giving developers a mechanism to detect and potentially cancel the back operation.
@yanshouwang I took a look at your implementation and it looks good. Although on Android you can implement the IOnClickListener interface (see MvvmCross/MvvmCross#3124 (comment)) which might be simpler.
cc @davidortinau

nickrandolph commented Oct 1, 2018

@rmarinho the issue with XF is that it blocks developers from intercepting the back button behaviour (main reason for overriding OnOptionsItemSelected), without giving developers a mechanism to detect and potentially cancel the back operation.
@yanshouwang I took a look at your implementation and it looks good. Although on Android you can implement the IOnClickListener interface (see MvvmCross/MvvmCross#3124 (comment)) which might be simpler.
cc @davidortinau

@samhouts samhouts removed this from Ready For Work in Triage Oct 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment