alexrainman / CarouselView

CarouselView control for Xamarin Forms
MIT License
436 stars 178 forks source link

Pinch-zoom on an Image inside CarouselView throws exception #563

Open shnaz opened 4 years ago

shnaz commented 4 years ago

Hi, we are using the CarouselView as a gallery-page in our app, where images can be zoomed by pinch-gesture. We have been experiencing some crashes due to "pointer out of index"-exceptions thrown in the CustomViewPager.OnInterceptTouchEvent(..).

I have googled the issue and it seems that it is a general framework bug in ViewPager and DrawerLayout, the workaround is to try-catch the super.onInterceptTouchEvent(event).

Have you heard about this before?

Btw, thanks for the great work, we have been using this CarouselView many years now!

Xamarin Exception Stack:
Java.Lang.IllegalArgumentException: pointerIndex out of range
  at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <2405b51bc3624fdbb29f06b35f0a105f>:0
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <2405b51bc3624fdbb29f06b35f0a105f>:0
  at Android.Views.ViewGroup.OnInterceptTouchEvent (Android.Views.MotionEvent ev) [0x00031] in <d47c790ea0c946f3ac8a0d125b11dde0>:0
  at CarouselView.FormsPlugin.Android.CustomViewPager.OnInterceptTouchEvent (Android.Views.MotionEvent ev) [0x0005d] in <987b2fd695d94047809eece606991303>:0
  at Android.Views.ViewGroup.n_OnInterceptTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_ev) [0x00011] in <d47c790ea0c946f3ac8a0d125b11dde0>:0
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr,intptr)
  at java.lang.IllegalArgumentException: pointerIndex out of range
  at android.view.MotionEvent.nativeGetAxisValue(Native Method)
  at android.view.MotionEvent.getX(MotionEvent.java:2568)
....