XamFormsExtended / Xfx.Controls

Xamarin Forms Extended Controls
MIT License
192 stars 79 forks source link

XfxEntryRenderer crashes on ControlOnFocusChange #62

Open miguelpietropaolo opened 6 years ago

miguelpietropaolo commented 6 years ago

Affects

Expected Behavior

Not to crash on focusing

Actual Behavior

Crashes if focused and leaving the current page really fast

Steps to reproduce the Behavior

It's pretty hard but it may happen. You have to change PostDelayed delay to something greater, e.g., 1000.

Proposed fixed

Renderers/XfxEntryRendererDroid.cs line 158

  EditText.PostDelayed(() =>
                        {
                            if (EditText == null || manager == null)
                                return;

                            EditText.RequestFocus();
                            manager.ShowSoftInput(EditText, 0);
                        },
                            100);
joshardt commented 5 years ago

This is a Google Console crash report from 27. November:

Yesterday, 10:31 AM on app version 10669 Samsung Galaxy S6 edge+ (zenlte), Android 7.0 Report 1

android.runtime.JavaProxyThrowable: at Xfx.Controls.Droid.Renderers.XfxEntryRendererDroid.get_EditText () [0x00006] in <6254d58bdab1470291766dc19c4b7467>:0 at Xfx.Controls.Droid.Renderers.XfxEntryRendererDroid+<>cDisplayClass12_0.b__0 () [0x00000] in <6254d58bdab1470291766dc19c4b7467>:0 at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <3a13990cb74a4e62b8f2a0933932e964>:0 at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr nativethis) [0x00009] in <3a13990cb74a4e62b8f2a0933932e964>:0 at (wrapper dynamic-method) System.Object.29(intptr,intptr) at mono.java.lang.RunnableImplementor.n_run (Native Method) at mono.java.lang.RunnableImplementor.run (RunnableImplementor.java:30) at android.os.Handler.handleCallback (Handler.java:751) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:154) at android.app.ActivityThread.main (ActivityThread.java:6682) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)

@ChaseFlorell can you please review my PR? We got this app in production with almost 30k users just on Android.