I can’t share the actual code, but I can describe the issue I’m facing. My screen has two tabs: one for login and one for sign-up. Both tabs are inside a horizontal pager, and they’re navigated to from Screen B using Compose Navigation, like navController.navigate(ScreenA).
Screen A contains the horizontal pager with the login and sign-up tabs, along with several other tabs. The problem occurs when the user switches from portrait to landscape and then back to portrait. If the user then clicks anywhere on the screen, the app crashes.
I’ve provided the error stack trace for reference. Can anyone help me figure out why this happens?
java.lang.IllegalArgumentException: ActiveParent with no focused child
at androidx.compose.ui.focus.FocusTransactionsKt.requireActiveChild(FocusTransactions.kt:251)
at androidx.compose.ui.focus.FocusTransactionsKt.performCustomRequestFocus-Mxy_nc0(FocusTransactions.kt:262)
at androidx.compose.ui.focus.FocusTransactionsKt.performCustomRequestFocus-Mxy_nc0(FocusTransactions.kt:267)
at androidx.compose.ui.focus.FocusTransactionsKt.performCustomRequestFocus-Mxy_nc0(FocusTransactions.kt:270)
at androidx.compose.ui.focus.FocusTransactionsKt.requestFocus(FocusTransactions.kt:44)
at androidx.compose.ui.focus.FocusRequester.focus$ui_release(FocusRequester.kt:74)
at androidx.compose.ui.focus.FocusRequester.requestFocus(FocusRequester.kt:65)
at androidx.compose.foundation.text.CoreTextFieldKt.tapToFocus(CoreTextField.kt:1001)
at androidx.compose.foundation.text.CoreTextFieldKt.access$tapToFocus(CoreTextField.kt:1)
at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$pointerModifier$2.invoke-k-4lQ0M(CoreTextField.kt:374)
at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$pointerModifier$2.invoke(CoreTextField.kt:373)
at androidx.compose.foundation.text.TextFieldPressGestureFilterKt$tapPressTextFieldModifier$1$2$2.invoke-k-4lQ0M(TextFieldPressGestureFilter.kt:81)
at androidx.compose.foundation.text.TextFieldPressGestureFilterKt$tapPressTextFieldModifier$1$2$2.invoke(TextFieldPressGestureFilter.kt:54)
at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1.invokeSuspend(TapGestureDetector.kt:255)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:179)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:168)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:508)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:497)
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:368)
at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl$PointerEventHandlerCoroutine.offerPointerEvent(SuspendingPointerInputFilter.kt:665)
at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.dispatchPointerEvent(SuspendingPointerInputFilter.kt:544)
at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.onPointerEvent-H0pRuoY(SuspendingPointerInputFilter.kt:566)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:317)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
at androidx.compose.ui.input.pointer.NodeParent.dispatchMainEventPass(HitPathTracker.kt:185)
at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:104)
at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog(PointerInputEventProcessor.kt:113)