java.lang.IllegalStateException: Should be called from the main thread, not Thread[mqt_native_modules,5,main]
at curtains.internal.HandlersKt.checkMainThread (Handlers.kt:9)
at curtains.WindowsKt.getWindowType (Windows.kt:37)
at shadow.leakcanary.RootViewWatcher$listener$1.onRootViewAdded (RootViewWatcher.kt:44)
at curtains.OnRootViewAddedListener$DefaultImpls.onRootViewsChanged (Listeners.kt:37)
at shadow.leakcanary.RootViewWatcher$listener$1.onRootViewsChanged (RootViewWatcher.kt:43)
at curtains.internal.RootViewsSpy$delegatingViewList$1.add (RootViewsSpy.kt:25)
at curtains.internal.RootViewsSpy$delegatingViewList$1.add (RootViewsSpy.kt:23)
at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:454)
at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:114)
at android.app.Dialog.show (Dialog.java:505)
at com.beefe.picker.PickerViewModule.show (PickerViewModule.java:441)
at java.lang.reflect.Method.invoke (Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:151)
at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
at android.os.Looper.loop (Looper.java:246)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
at java.lang.Thread.run (Thread.java:923)
Any idea how to fix it?
I already tried:
+++ b/node_modules/react-native-picker/android/src/main/java/com/beefe/picker/PickerViewModule.java
@@ -6,7 +6,9 @@ import android.app.Dialog;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.Typeface;
-import android.support.annotation.Nullable;
+
+import androidx.annotation.MainThread;
+import androidx.annotation.Nullable;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
@@ -429,6 +431,7 @@ public class PickerViewModule extends ReactContextBaseJavaModule implements Life
select(selectedValue);
}
+ @MainThread
@ReactMethod
public void show() {
if (dialog == null) {
@@ -439,6 +442,7 @@ public class PickerViewModule extends ReactContextBaseJavaModule implements Life
}
}
+ @MainThread
@ReactMethod
public void hide() {
if (dialog == null) {
Hey friends,
I get this in production:
Any idea how to fix it?
I already tried:
but this didn't work.