react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.65k stars 5.05k forks source link

React navigation stack has error with fabric #11165

Open devoren opened 1 year ago

devoren commented 1 year ago

Current behavior

I tried to create native stack navigator with fabric enabled in RN 0.71 and and when I quickly navigate between the bottom tabs this error appears. And it doesn't matter if it's native stack or not. If i disable fabric and quickly navigate between the bottom tabs, there are no errors and works fine (default and native stack).

My Navigation Stack: Bottom Tab: { HomeStack, ProfileStack }

Screenshot_1674061892

Expected behavior

Fast navigation between tabs without errors, even with fps drops

Reproduction

https://snack.expo.dev/@devoren/bottom-tab-navigation

Platform

Packages

Environment

package version
@react-navigation/native ^6.1.2
@react-navigation/bottom-tabs ^6.5.3
@react-navigation/stack ^6.3.11
@react-navigation/native-stack ^6.9.8
react-native-safe-area-context ^4.4.1
react-native-screens ^3.19.0
react-native-gesture-handler ^2.9.0
react-native-reanimated ^3.0.0-rc.10
react-native 0.71.0
node 18.12.0
npm or yarn yarn
sssajjad007 commented 1 year ago

i have same error in rn 71.2 with fabric

devoren commented 1 year ago

@sssajjad007 Yes, I was hoping it was a RN bug

Bort-777 commented 1 year ago

Same issue, here stack trace. Issue may be related to react-native-screens.



java.lang.IllegalArgumentException: No view found for id 0x646 (unknown) for fragment ScreenFragment{34a3771} (f38da73b-6497-4306-a70a-402ae94cea5f id=0x646)

FATAL EXCEPTION: main
Process: com.app.qa, PID: 5488
java.lang.IllegalArgumentException: No view found for id 0x646 (unknown) for fragment ScreenFragment{34a3771} (f38da73b-6497-4306-a70a-402ae94cea5f id=0x646)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:513)
    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:1764)
    at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1670)
    at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:323)
    **at com.swmansion.rnscreens.ScreenContainer.onUpdate(ScreenContainer.kt:366)**
    at com.swmansion.rnscreens.ScreenContainer.performUpdates(ScreenContainer.kt:311)
    at com.swmansion.rnscreens.ScreenContainer.performUpdatesNow(ScreenContainer.kt:303)
    at com.swmansion.rnscreens.ScreenContainer.setFragmentManager(ScreenContainer.kt:127)
    at com.swmansion.rnscreens.ScreenContainer.setupFragmentManager(ScreenContainer.kt:180)
    at com.swmansion.rnscreens.ScreenContainer.onAttachedToWindow(ScreenContainer.kt:217)
    at android.view.View.dispatchAttachedToWindow(View.java:20107)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3619)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3626)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3626)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3626)
    at android.view.ViewGroup.addViewInner(ViewGroup.java:5404)
    at android.view.ViewGroup.addView(ViewGroup.java:5190)
    at android.view.ViewGroup.addView(ViewGroup.java:5130)
    at androidx.fragment.app.FragmentStateManager.addViewToContainer(FragmentStateManager.java:839)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:528)
    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:1764)
    at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1670)
    at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:323)
    at com.swmansion.rnscreens.ScreenContainer.onUpdate(ScreenContainer.kt:366)
    at com.swmansion.rnscreens.ScreenContainer.performUpdates(ScreenContainer.kt:311)
    at com.swmansion.rnscreens.ScreenContainer.performUpdatesNow(ScreenContainer.kt:303)
    at com.swmansion.rnscreens.ScreenContainer.notifyChildUpdate(ScreenContainer.kt:87)
    at com.swmansion.rnscreens.Screen.setActivityState(Screen.kt:132)
    at com.swmansion.rnscreens.ScreenViewManager.setActivityState(ScreenViewManager.kt:49)
    at com.swmansion.rnscreens.ScreenViewManager.setActivityState(ScreenViewManager.kt:34)
    at com.swmansion.rnscreens.ScreenViewManager.setActivityState(ScreenViewManager.kt:21)
    at com.facebook.react.viewmanagers.RNSScreenManagerDelegate.setProperty(RNSScreenManagerDelegate.java:81)
    at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:46)
    at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:84)
    at com.facebook.react.views.view.ReactViewManagerWrapper$DefaultViewManager.updateProperties(ReactViewManagerWrapper.kt:59)
    at com.facebook.react.fabric.mounting.SurfaceMountingManager.updateProps(SurfaceMountingManager.java:872)
    at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.java:153)
    at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.java:351)
    at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.java:274)
    at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.java:120)
    at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1245)
    at com.facebook.react.fabric.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:31)
    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1278)
    at android.view.Choreographer.doCallbacks(Choreographer.java:1019)
    at android.view.Choreographer.lambda$new$0$Choreographer(Choreographer.java:235)
    at android.view.-$$Lambda$Choreographer$zXV0PrqwmpdPajenUBozqc6c8Hs.run(Unknown Source:2)
    at android.os.Handler.handleCallback(Handler.java:900)
    at android.os.Handler.dispatchMessage(Handler.java:103)
    at android.os.Looper.loop(Looper.java:219)
    at android.app.ActivityThread.main(ActivityThread.java:8668)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)```
github-actions[bot] commented 1 year ago

Hey! Thanks for opening the issue. Seems that this issue is related to react-native-screens library which is a dependency of React Navigation. Can you also post your issue in this repo so that it's notified to the maintainers of that library? This will help us fix the issue faster since it's upto the maintainers of that library to investigate it.

ken0x0a commented 1 year ago

I got the same error with RN 0.72.0

JeanSilvany commented 1 year ago

Same issue!

JaosnHsieh commented 1 year ago

sam here!

com.swmansion.rnscreens.ScreenFragment.<init>
java.lang.IllegalStateException
gdaghero commented 10 months ago

same

sanchezzzs commented 2 months ago

Same with RN 0.75.2