nativescript-community/ui-material-components

[android] Tabs > FragmentManager is already executing transactions

kefahB opened this issue · 2 comments

Hello @farfromrefug,

I am facing a strange issue with the tabs navigation !

when I navigate to other page using top root frame, and trying to goback() the app crash with the flowing error

I have tried to reproduce the error with a new project but I am not able to reproduce! but if I navigate back with a navigation it work

System.err: An uncaught Exception occurred on "main" thread.
  System.err: Calling js method onCreateView failed
  System.err: Error: java.lang.IllegalStateException: FragmentManager is already executing transactions
  System.err:
  System.err: StackTrace:
  System.err: [selectedIndex:setNative](file: app/webpack:/cocarz/node_modules/@nativescript-community/ui-material-core-tabs/tab-navigation/index.android.js:530:0)
  System.err: 	at applyPendingNativeSetters(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/properties/index.js:1117:0)
  System.err: 	at initNativeView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/properties/index.js:1076:0)
  System.err: 	at onResumeNativeUpdates(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:739:22)
  System.err: 	at _resumeNativeUpdates(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:280:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:235:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/view-common.js:107:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/index.android.js:317:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript-community/ui-material-core-tabs/tab-navigation/index.android.js:242:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript-community/ui-material-bottom-navigation/index.android.js:73:0)
  System.err: 	at (file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at callFunctionWithSuper(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
  System.err: 	at callLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at loadView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
  System.err: 	at (file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:237:0)
  System.err: 	at eachChildView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0)
  System.err: 	at eachChild(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/view-common.js:772:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:236:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/view-common.js:107:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/index.android.js:317:0)
  System.err: 	at (file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at callFunctionWithSuper(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
  System.err: 	at callLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at loadView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
  System.err: 	at (file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:237:0)
  System.err: 	at eachChildView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0)
  System.err: 	at eachChild(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/view-common.js:772:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:236:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/view-common.js:107:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/index.android.js:317:0)
  System.err: 	at (file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at callFunctionWithSuper(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
  System.err: 	at callLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at loadView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
  System.err: 	at (file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:237:0)
  System.err: 	at eachChildView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/content-view/index.js:65:0)
  System.err: 	at eachChildView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/page/page-common.js:106:0)
  System.err: 	at eachChild(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/view-common.js:772:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:236:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/view-common.js:107:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view/index.android.js:317:0)
  System.err: 	at onLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/page/index.android.js:38:0)
  System.err: 	at (file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at callFunctionWithSuper(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
  System.err: 	at callLoaded(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
  System.err: 	at onCreateView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/frame/index.android.js:754:0)
  System.err: 	at onCreateView(file: app/webpack:/cocarz/node_modules/@nativescript/core/ui/frame/fragment.android.js:28:0)
  System.err: 	at com.tns.Runtime.callJSMethodNative(Native Method)
  System.err: 	at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
  System.err: 	at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
  System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:1175)
  System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:1153)
  System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:1149)
  System.err: 	at com.tns.FragmentClass.onCreateView(FragmentClass.java:55)
  System.err: 	at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995)
  System.err: 	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523)
  System.err: 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
  System.err: 	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
  System.err: 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
  System.err: 	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
  System.err: 	at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
  System.err: 	at android.os.Handler.handleCallback(Handler.java:942)
  System.err: 	at android.os.Handler.dispatchMessage(Handler.java:99)
  System.err: 	at android.os.Looper.loopOnce(Looper.java:201)
  System.err: 	at android.os.Looper.loop(Looper.java:288)
  System.err: 	at android.app.ActivityThread.main(ActivityThread.java:7898)
  System.err: 	at java.lang.reflect.Method.invoke(Native Method)
  System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
  System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
  System.err: Caused by: java.lang.IllegalStateException: FragmentManager is already executing transactions
  System.err: 	at androidx.fragment.app.FragmentManager.ensureExecReady(FragmentManager.java:1636)
  System.err: 	at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1666)
  System.err: 	at androidx.fragment.app.BackStackRecord.commitNow(BackStackRecord.java:317)
  System.err: 	at androidx.viewpager2.adapter.FragmentStateAdapter$FragmentMaxLifecycleEnforcer.updateFragmentMaxLifecycle(FragmentStateAdapter.java:726)
  System.err: 	at androidx.viewpager2.adapter.FragmentStateAdapter$FragmentMaxLifecycleEnforcer$1.onPageSelected(FragmentStateAdapter.java:637)
  System.err: 	at androidx.viewpager2.widget.CompositeOnPageChangeCallback.onPageSelected(CompositeOnPageChangeCallback.java:73)
  System.err: 	at androidx.viewpager2.widget.CompositeOnPageChangeCallback.onPageSelected(CompositeOnPageChangeCallback.java:73)
  System.err: 	at androidx.viewpager2.widget.ScrollEventAdapter.dispatchSelected(ScrollEventAdapter.java:432)
  System.err: 	at androidx.viewpager2.widget.ScrollEventAdapter.notifyProgrammaticScroll(ScrollEventAdapter.java:320)
  System.err: 	at androidx.viewpager2.widget.ViewPager2.setCurrentItemInternal(ViewPager2.java:652)
  System.err: 	at androidx.viewpager2.widget.ViewPager2.setCurrentItem(ViewPager2.java:607)
  System.err: 	... 22 more

Do you have any idea about this ?

Merci ;)

@kefahB tbh i dont use tabs so not really an expert of it and i dont really know what could be happening
@edusperoni would you have an idea on this?

@farfromrefug @edusperoni I create this sample that show the scenario when app crash when navigate back.

If we set a Frame into TabContentItem and navigate outside of the BottomNavigation root, then we navigate back it causing an app crash.

PS: the app crash only if we navigate at least from the second tab