beefe / react-native-picker

A Native Picker with high performance.
1.75k stars 785 forks source link

multi Picker crash on show! #228

Open vsona opened 7 years ago

vsona commented 7 years ago
E/unknown:React: Exception in native call
                                                                      android.view.WindowManager$BadTokenException: Unable to add window -- window android.view.ViewRootImpl$W@8764862 has already been added
                                                                          at android.view.ViewRootImpl.setView(ViewRootImpl.java:720)
                                                                          at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:347)
                                                                          at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94)
                                                                          at android.app.Dialog.show(Dialog.java:325)
                                                                          at com.beefe.picker.PickerViewModule.show(PickerViewModule.java:386)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363)
                                                                          at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:166)
                                                                          at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                                          at android.os.Handler.handleCallback(Handler.java:754)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                          at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                                          at android.os.Looper.loop(Looper.java:160)
                                                                          at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
                                                                          at java.lang.Thread.run(Thread.java:761)

when click one of multi picker crash.

qiaokang commented 7 years ago

PickerViewModule.java 153行 layoutParams.type = WindowManager.LayoutParams.TYPE_TOAST; 改为 layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE; 没有详细了解原因,但是经测试确实在小米6上不再崩溃。 希望能帮助到大家