Through the growth of the KMP + Compose software, I encountered an iOS-only UI situation.
The issue seems like, when utilizing the appliance in some random second of the time, screens keep black, and once I click on to a different tab in half a second, I see the previous display screen after which the black display screen, it’s additionally unusual second as a result of in the course of the click on to a brand new tab I ought to see on the second present display screen not a previous display screen.
Additionally, certainly one of my screens has a participant with auto begin. This display screen was created natively on iOS, and when this bug appeared, the participant didn’t begin.
Solely screens which can be contained in the tab bar have this situation. The TabBar part remains to be seen and clickable, and the consumer can work together with the navigation part, however not with any display screen inside.
For navigation(NavHost) and display screen UI utilizing native Android/KMP parts, nothing native for IOS, at the least on Swift code from our facet.
Fixing the issue is feasible if I relaunch the app.
The algorithm to breed this bug is as follows:
The app shouldn’t be operating. I must open the app, click on on a tab (in my case, the final one), then instantly swap to the following tab and again, all inside round 10 seconds. If the difficulty was not caught, I must kill the appliance and begin once more. Through the 10 rounds of this algorithm, I can reproduce this situation.
It’s not a common algorithm, however it works. My end result after testing:
Utilizing these bodily gadgets, I can reproduce this situation.
iPhone 13 Professional Max, iOS 17.6.1
iPad Professional 12.9, iOS 18.5
iPad Professional 12.9, iOS 18.6.2
Units the place I can’t reproduce this situation.
iPhone SE 2022, iOS 18.5
Sadly, I’m restricted within the variety of Bodily Units, however it seems like this drawback might also rely upon display screen dimension. On iPad, this drawback is feasible to catch tremendous quick, following the algorithm above
Challenge particulars:
Minimal model of iOS challenge is iOS 16.
Kotlin model 2.2.0
Compose Multiplatform 1.8.2
AGP 8.8.2
AndroidX Navigation 2.9.0-beta03
AndroidX Lifecycle 2.9.1
Are you aware the place the difficulty is, or maybe somebody has already encountered this drawback and solved it?
Extra particulars
Sadly, I am unable to submit a code instance of this situation as I don’t perceive what led to this situation, and the challenge has restrictions. However I’ve some info.
Video instance of the difficulty
Excessive-level overview of the screens hierarchy I connected to this message:

For navigation, I used the compose-navigation library.
Additionally, I attempted to take away the animation like that, drawback nonetheless introduced.
composable<Vacation spot.MyScreen>(
enterTransition = { EnterTransition.None },
exitTransition = { ExitTransition.None }
) {
MyListScreen(navController, koinViewModel<MyScreenViewModel>(), paddingValues)
}
As a further experiment, I created a small animation check, and I used to be in a position to reproduce the difficulty with these animations:
fadeIn(tween(0)) - My Default animation for the display screen the place the difficulty is
fadeOut(tween(0)) - My Default animation for the display screen the place the difficulty is
fadeIn()
fadeOut()
slideInHorizontally(tween(0))
slideOutHorizontally(tween(0))
slideIn() - The identical situation + one-time app was absolutely unresponsive
slideOut() - The identical situation + one-time app was absolutely unresponsive
Additionally, beneath sort of animation beneath has an identical + generally the identical situation throughout execution of animation utilizing the algorithm within the process, and after the top of the animation, all works properly.
slideInHorizontally()
slideOutHorizontally()
slideInVertically(tween(0))
slideOutVertically(tween(0))
slideInVertically()
slideOutVertically()
I’ve an assumption that the animation above doesn’t have a problem on the finish of the animation as a result of they’ve some execution time or different nuances.


