ui-material-components
ui-material-components copied to clipboard
App crashes when bottomnavigationbar is last child in layout element
Which platform(s) does your issue occur on?
- Android
Please, provide the following version numbers that your issue occurs with:
- CLI: 8.2.2
- Cross-platform modules: 8.2.1
- Runtime(s): 8.2.2
- "@nativescript-community/ui-material-bottomnavigationbar": "^7.0.2"
- "svelte-native": "^1.0.2"
- "svelte-native-nativescript-ui": "^1.0.0"
Please, tell us how to recreate the issue in as much detail as possible.
- I have a page with a layout (tested with dockLayout and flexboxLayout) with two children:
- a listView that makes use of svelte-native's Template element
- bottomNavigationBar
- I navigate to some other page
- I leave the app (e.g. by clicking overview button)
- I come back to the app (e.g. by clicking overview button again)
- I click back (navigate to the page with the bottomNavigationBar on it)
- App crashes
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
@mpcref please can you create a repro sample without any other plugin?
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.