0

This is how I am using Icons in my app

Icon(
        Icons.Filled.ArrowBackIos,
        contentDescription = "Arrow Back",
        modifier = Modifier.clickable {
          if (canGoBackward(week)) {
            onPreviousWeekClick()
          }
        })

Is there a way to to prevent this icon from automirroring in RTL ?

I tried doing the below but it didn't work

Icon(
        rememberVectorPainter(Icons.Filled.ArrowBackIos, autoMirror = false),
        contentDescription = "Arrow Back",
        modifier = Modifier.clickable {
          if (canGoBackward(week)) {
            onPreviousWeekClick()
          }
        })
Muhammad Ahmed AbuTalib
  • 4,080
  • 4
  • 36
  • 59
  • Which version of Compose are you using? – Gabriele Mariotti Sep 21 '22 at 13:33
  • I haven't used right to left languages but providing LocalLayoutDirection forces direction of layouts. `CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {Icon()}`. I use with `LayoutDirection.Rtl` to force a side navigation being placed on right side instead of left when i needed two side navigation on both sides of the screen – Thracian Sep 21 '22 at 14:30
  • 1
    In case of a bug you can disable the mirror rotating the image using `val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl` `val iconModifier = if (isRtl) Modifier.scale(-1f, 1f) else Modifier` – Gabriele Mariotti Sep 21 '22 at 14:35

0 Answers0