Is there an easy (and inexpensive, effortless) way...
# compose
s
Is there an easy (and inexpensive, effortless) way to draw row elements from the last one? My
ReverseRow
code in thread
Copy code
@Composable
fun ReverseRow(
    modifier: Modifier = Modifier,
    horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
    verticalAlignment: Alignment.Vertical = <http://Alignment.Top|Alignment.Top>,
    content: @Composable RowScope.() -> Unit
) {
    val scrollState = rememberScrollState()

    Row(
        modifier = modifier.horizontalScroll(state = scrollState, enabled = false),
        content = content
    )

    LaunchedEffect(scrollState.maxValue) {
        scrollState.scrollTo(value = scrollState.maxValue)
    }
}
This looks like an overkill, but should be easy to support it "natively" in its
Layout
c
Maybe just setting the layout direction to "right to left", by setting
LocalLayoutDirection
?
Copy code
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
    content()
}
s
Yup, it works, but I have to reverse the items and so switch start-end padding of course. Thanks!
c
Or switching it back to Ltr inside the
Row
content should work too
🙌 1