nativescript-community / ui-material-components

Monorepo that contains all of the NativeScript Material Design plugins.
https://nativescript-community.github.io/ui-material-components/
Apache License 2.0
218 stars 80 forks source link

App crashes when bottomnavigationbar is last child in layout element #371

Open mpcref opened 2 years ago

mpcref commented 2 years ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

If I place the bottomNavigationBar above the listView inside the layout parent the app doesn't crash. The layout will then make sure that the bottomNavigationBar will be visually placed at the bottom no matter where it's defined within the layout parent so this is a good workaround for the issue.

Error

An uncaught Exception occurred on "main" thread. Calling js method onCreateView failed Error: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.AbsListView$SavedState

StackTrace: onCreateView(file:///data/data/eu.my.app/files/app/vendor.js:26588:38) at onCreateView(file:///data/data/eu.my.app/files/app/vendor.js:24377:40) at com.tns.Runtime.callJSMethodNative(Native Method) at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302) at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188) at com.tns.Runtime.callJSMethod(Runtime.java:1175) at com.tns.Runtime.callJSMethod(Runtime.java:1153) at com.tns.Runtime.callJSMethod(Runtime.java:1149) at com.tns.FragmentClass.onCreateView(FragmentClass.java:55) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701) at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.AbsListView$SavedState at android.widget.AbsListView.onRestoreInstanceState(AbsListView.java:1902) at android.view.View.dispatchRestoreInstanceState(View.java:20743) at android.view.ViewGroup.dispatchThawSelfOnly(ViewGroup.java:4006) at android.widget.AdapterView.dispatchRestoreInstanceState(AdapterView.java:837) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3992) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3992) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3992) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3992) at android.view.View.restoreHierarchyState(View.java:20721) ... 21 more

farfromrefug commented 2 years ago

@mpcref please can you create a repro sample without any other plugin?

mpcref commented 2 years ago

I've narrowed it down to the combination of listView with Template and bottomNavigationBar within the same layout parent. I'll see if I can create a minimal example later.