Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back button header config view should have Image as first child #2574

Open
tree1891 opened this issue Dec 14, 2024 · 2 comments
Open

Back button header config view should have Image as first child #2574

tree1891 opened this issue Dec 14, 2024 · 2 comments
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android

Comments

@tree1891
Copy link

Description

Sometimes app crash when hardware back button is pressed.

com.facebook.react.bridge.ReactNoCrashSoftException: raiseSoftException(getOrCreateDestroyTask()): handleHostException(message = "Cannot remove child at index 2 from parent ViewGroup [1240], only 2 children in parent. Warning: childCount may be incorrect!")
	at com.facebook.react.runtime.ReactHostImpl.raiseSoftException(ReactHostImpl.java:942)
	at com.facebook.react.runtime.ReactHostImpl.getOrCreateDestroyTask(ReactHostImpl.java:1575)
	at com.facebook.react.runtime.ReactHostImpl.lambda$destroy$7(ReactHostImpl.java:541)
	at com.facebook.react.runtime.ReactHostImpl.$r8$lambda$uso21_D6dCZdcf-JomVD56kdG4c(Unknown Source:0)
	at com.facebook.react.runtime.ReactHostImpl$$ExternalSyntheticLambda37.call(D8$$SyntheticClass:0)
	at com.facebook.react.runtime.internal.bolts.Task$2.run(Task.java:240)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.IllegalStateException: Cannot remove child at index 2 from parent ViewGroup [1240], only 2 children in parent. Warning: childCount may be incorrect!
	at com.facebook.react.fabric.mounting.SurfaceMountingManager.removeViewAt(SurfaceMountingManager.java:588)
	at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.java:121)
	at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.java:387)
	at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.java:293)
	at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.java:126)
	at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1394)
	at com.facebook.react.fabric.GuardedFrameCallback.doFrame(GuardedFrameCallback.kt:22)
	at com.facebook.react.modules.core.ReactChoreographer.frameCallback$lambda$1(ReactChoreographer.kt:60)
	at com.facebook.react.modules.core.ReactChoreographer.$r8$lambda$nSkFhrr5T7rop_XKwzlLov4NLLw(Unknown Source:0)
	at com.facebook.react.modules.core.ReactChoreographer$$ExternalSyntheticLambda0.doFrame(D8$$SyntheticClass:0)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1116)
	at android.view.Choreographer.doCallbacks(Choreographer.java:934)
	at android.view.Choreographer.doFrame(Choreographer.java:860)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1103)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loop(Looper.java:230)
	at android.app.ActivityThread.main(ActivityThread.java:7920)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
Caused by: com.facebook.react.bridge.JSApplicationIllegalArgumentException: Back button header config view should have Image as first child
	at com.swmansion.rnscreens.ScreenStackHeaderConfig.onUpdate(ScreenStackHeaderConfig.kt:273)
	at com.swmansion.rnscreens.ScreenStackHeaderConfig.maybeUpdate(ScreenStackHeaderConfig.kt:307)
	at com.swmansion.rnscreens.ScreenStackHeaderConfig.removeConfigSubview(ScreenStackHeaderConfig.kt:318)
	at com.swmansion.rnscreens.ScreenStackHeaderConfigViewManager.removeViewAt(ScreenStackHeaderConfigViewManager.kt:77)
	at com.swmansion.rnscreens.ScreenStackHeaderConfigViewManager.removeViewAt(ScreenStackHeaderConfigViewManager.kt:22)
	at com.facebook.react.fabric.mounting.SurfaceMountingManager.removeViewAt(SurfaceMountingManager.java:563)
	at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.java:121) 
	at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.java:387) 
	at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.java:293) 
	at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.java:126) 
	at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1394) 
	at com.facebook.react.fabric.GuardedFrameCallback.doFrame(GuardedFrameCallback.kt:22) 
	at com.facebook.react.modules.core.ReactChoreographer.frameCallback$lambda$1(ReactChoreographer.kt:60) 
	at com.facebook.react.modules.core.ReactChoreographer.$r8$lambda$nSkFhrr5T7rop_XKwzlLov4NLLw(Unknown Source:0) 
	at com.facebook.react.modules.core.ReactChoreographer$$ExternalSyntheticLambda0.doFrame(D8$$SyntheticClass:0) 
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1116) 
	at android.view.Choreographer.doCallbacks(Choreographer.java:934) 
	at android.view.Choreographer.doFrame(Choreographer.java:860) 
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1103) 
	at android.os.Handler.handleCallback(Handler.java:883) 
	at android.os.Handler.dispatchMessage(Handler.java:100) 
	at android.os.Looper.loop(Looper.java:230) 
	at android.app.ActivityThread.main(ActivityThread.java:7920) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034) 

Steps to reproduce

press hardware back button.

Snack or a link to a repository

http://

Screens version

4.3.0

React Native version

0.76.5

Platforms

Android

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

None

Build type

Debug mode

Device

Real device

Device model

Android 10

Acknowledgements

Yes

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Dec 14, 2024
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Platform: Android This issue is specific to Android label Dec 14, 2024
@kkafar
Copy link
Member

kkafar commented Dec 16, 2024

Hey @tree1891, to proceed with fixing the issue you reported we'll need a proper reproduction.
The only thing that comes to my mind is that due to view flattening the React Native runtime could have injected some more additional views there - but behaviour if the view flattening algorithm is heavily depended on the exact setup and view hierarchy you create.

@kkafar kkafar added the Close when stale This issue is going to be closed when there is no activity for a while label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android
Projects
None yet
Development

No branches or pull requests

2 participants