compose-multiplatform
compose-multiplatform copied to clipboard
iOS: TabView > UITableViewController > UIHostingController > Compose Configuration Causes Recompose and Horizontal Scroll Issues
Describe the bug When integrating Compose Multiplatform within an iOS project that uses TabView (SwiftUI), UITableViewController, and UIHostingController, I experience the following issues:
- Recomposition does not occur when pressing a button to change text in a Compose view. However, recomposition happens when I scroll the UITableView.
- Horizontal scrolling is disabled in Compose views.
Affected platforms
- iOS
Versions
- Kotlin version*: 1.9.10
- Compose Multiplatform version*: 1.5.3, 1.5.10-rc02
- OS version(s)*: iOS 17
- OS architecture: arm64
To Reproduce
- Clone the minimum project at https://github.com/75py/Multiplatform-Sandbox
- Navigate to the tab containing the UITableView.
- Try clicking on a button inside the Compose view; observe that the text doesn't change.
- Try scrolling horizontally; observe that horizontal scrolling is disabled.
- Scroll the UITableView; observe that recomposition happens.
Main Code Files
- iOS: ContentView.swift
- Kotlin: Views.kt
Expected behavior
- The Compose view should recompose when pressing a button to change text.
- Horizontal scrolling should work as expected in Compose views.
Screenshots
https://github.com/JetBrains/compose-multiplatform/assets/3153211/f4b604ce-1d7b-4b4d-88db-5d1314e631b6
Additional context The issue seems to occur only when using this specific configuration of TabView, UITableViewController, and UIHostingController.
LazyRow is already scrollable. You don't need to add a horizontalScroll modifier to it.
@m-sasha Thank you for the quick response. I've removed the horizontalScroll
modifier from LazyRow
as you suggested and pushed the changes. However, the issue still persists. Horizontal scrolling is not enabled in the Compose view.
Here is the commit where I made the changes: https://github.com/75py/Multiplatform-Sandbox/commit/f925bcd4ac7cdb78e58dfd407245f74625de3bb8
Would appreciate any further guidance on this.
I've recently updated the Compose plugin to version 1.6.0-beta01, and I'd like to share some updates regarding the issues previously reported:
-
The issue where the Compose view did not recompose when pressing a button to change text has been resolved with this update. This fix significantly improves the user interaction within Compose views on iOS.
-
Unfortunately, the problem with horizontal scrolling being disabled in Compose views remains unresolved. This continues to affect the usability of horizontally scrollable components in our iOS application.
You can view the changes made in this update here: Tag Link.
I hope this information helps in tracking the progress of these issues. Looking forward to any suggestions or further updates on the unresolved matter.
https://github.com/JetBrains/compose-multiplatform/assets/3153211/ccc81e30-245b-45d1-8b05-9dc654880fc5
Same here, looking forward to any workaround
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.