Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automirrored vector drawables do not get mirrored when layout is RTL #904

Open
1 task done
Fs00 opened this issue Jun 21, 2022 · 2 comments
Open
1 task done

Automirrored vector drawables do not get mirrored when layout is RTL #904

Fs00 opened this issue Jun 21, 2022 · 2 comments

Comments

@Fs00
Copy link

Fs00 commented Jun 21, 2022

Version

Excerpt of my app's build.gradle file:

implementation "com.facebook.litho:litho-core:0.41.2"
implementation "com.facebook.litho:litho-widget:0.41.2"
kapt "com.facebook.litho:litho-processor:0.41.2"

Issues and Steps to Reproduce

It seems that the Litho Image component does not honor the autoMirrored attribute on vector drawables when rendering, which results in drawables not getting mirrored when layout direction is RTL (I've reproduced it by forcing RTL layout in Android developer settings -> Force RTL layout direction).

Expected Behavior

The automirrored vector drawable should be mirrored when using an RTL language or when forcing RTL layout via Android developer settings.

Code

Minimal component that can be used to reproduce the issue:

@LayoutSpec
public class PlaygroundComponentSpec {
  @OnCreateLayout
  static Component onCreateLayout(ComponentContext c) {
      return Column.create(context)
        .backgroundColor(Color.BLACK)
        .child(Image.create(context).drawableRes(R.drawable.ic_back).build())
        .build()
  }
}

The automirrored vector drawable referenced by the component (placed in res/drawable/ic_back.xml):

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:autoMirrored="true">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
@astreet
Copy link
Contributor

astreet commented Jun 21, 2022

Hey @Fs00, thanks for the report and simple repro. I'll put this on our backlog, however we would also take a PR if you're interested in tackling it yourself.

@Fs00
Copy link
Author

Fs00 commented Jun 21, 2022

Thanks for the quick answer!
I don't have enough time and motivation to go ahead and open a PR these days, feel free to start working on it 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants