https://kotlinlang.org logo
#compose
Title
# compose
s

Stylianos Gakis

11/17/2023, 1:01 PM
Is there something special one must do to get
SelectionContainer
(The thing that allows one to long press some text to highlight and copy-paste it) working inside a LazyColumn? I am now doing smth like
Copy code
SelectionContainer {
  LazyColumn() {
    items(...) { Text(...) }
  }
}
And long pressing just does nothing really. Replacing
LazyColumn
with
Column(….verticalScroll(…))
just works without any chages. Tried also to add the
SelectionContainer
per-item in the Lazy list, with no luck either. Since maybe it doesn’t work for lazy layouts as some things which are highlighted may just go out of scope and get removed from composition at any point. Currently on latest
BOM 2023.10.01
I am asking just to get a sanity check that it’s not just me, if it’s a known issue etc. otherwise will file a bug report.
h

Halil Ozercan

11/17/2023, 1:31 PM
cc @Grant Toepfer
thank you color 1
There was this bug issuetracker.google.com/297596457 but it's not exactly the same
It was resolved in 1.6.0 alphas. Can you try the latest 1.6-beta01 build?
👍 1
s

Stylianos Gakis

11/17/2023, 1:51 PM
I’ll try to test with
androidx.compose.foundation:foundation:1.6.0-beta01
, a bit tricky since then the app doesn’t build with transitive dependencies it’s bringing in where the APIs have changed, so give me a few minutes 😅
Well, looks like it works perfectly fine with one outer
SelectionContainer
which wraps the entire
LazyColumn
. So now will just wait for the version to release to be able to use this, since the betas are breaking other parts of the app for now 😄 Thanks a lot for the links and the help!
👍 1