MasterDetailPage Swipe animation intercepts touch effects meant for children of DetailPage in iOS
#4 675 ouverte le 7 déc. 2018
Métriques du dépôt
- Stars
- (5 644 étoiles)
- Métriques de merge PR
- (Aucune PR mergée en 30 j)
Description
Description
I used the tutorial at https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/effects/touch-tracking to implement touch in a Xamarin.Forms application. I noticed when dragging a child element that the touch tracking would be lost if in a Detail of a Master/Detail page in iOS. I was able to confirm that the swipe of the detail page to expose the master page was intercepting the touch effects.
This is not an issue in Android or UWP.
Steps to Reproduce
- Download the source from the https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/effects/touch-tracking
- Upgrade to latest Xamarin.Forms nuget package.
- Add new item - a Xamarin.Forms MasterDetailPage. Don't change name so you'll get MasterDetailPage1.xaml, MasterDetailPage1Master.xaml, MasterDetailPage1Detail.xaml, etc.
- Ensure the namespaces just added match the namespace of the project.
- In the newly created MasterDetailPage1Master.xaml.cs file, change a menu item. I did this:
new MasterDetailPage1MenuItem { Id = 2, Title = "Box View Dragging Page", TargetType = typeof(BoxViewDraggingPage) } - Change the constructor in App.cs to:
MainPage = new NavigationPage(new MasterDetailPage1()); - Run the app and exercise the Box View Dragging Page link and this will expose the issue.
I noticed the issue in an older version 3.2 so I upgraded through 3.3 and into the latest 3.4 with no effect.
Expected Behavior
Dragging the box all over the screen
Actual Behavior
Only drag it about 5 pixels before only the swipe of the detail page is all that is activated.
Work Around:
On the page where dragging is wanted that doesn't swipe the detail page, override the OnAppearing and get a reference to the Master page and set IsGestureEnabled=false. Something like this:
protected override void OnAppearing()
{
base.OnAppearing();
if(Device.RuntimePlatform == Device.iOS)
{
MasterDetailPage md = this.Parent?.Parent as MasterDetailPage;
if(md != null)
{
md.IsGestureEnabled = false;
}
}
}
Basic Information
- Version with issue: Xamarin.Forms 3.4.0.1008975
- Last known good version: n/a.
- IDE: Visual Studio 2017 15.9.3
- Platform Target Frameworks: iOS
- iOS: 12.1
- Android: n/a
- UWP: n/a
- Android Support Library Version: n/a
- Nuget Packages:
- Affected Devices:
Screenshots
Uploaded replicated issue movie to Youtube: https://youtu.be/iaM0S5lt4Wg