https://kotlinlang.org logo
Title
a

andrew

03/09/2022, 3:46 AM
With RTL, does automirror work for vector drawables being painted in compose? I’m not seeing it forcing a config change on device, or using the LocalLayoutDirection local
a

Albert Chang

03/09/2022, 4:11 AM
I don’t think there is auto mirroring but you can easily create a modifier like this:
fun Modifier.mirrorIfNeeded(): Modifier = composed {
    if (LocalLayoutDirection.current == LayoutDirection.Ltr)
        Modifier else Modifier.scale(-1f, 1f)
}
🎉 2
a

andrew

03/09/2022, 4:39 PM
I guess the thing is, I'd want to rely on the automirrored vector drawable property
c

Chris Sinco [G]

03/09/2022, 9:16 PM
@Nader Jawad is there an existing request for this already?
n

Nader Jawad

03/09/2022, 9:17 PM
Literally just submitted support for this like 15 mins ago
So short answer is not yet but soon
🎉 1
In the meantime what Albert has suggested above will work.
a

andrew

03/09/2022, 9:22 PM
@Nader Jawad you have no idea how tempted I was to fork it today and draft up a quick solution 😂
😂 2
Looks like what I had in my head more or less matches what you were thinking too 🙂
👍 1