facebook / facebook/litho

Automirrored vector drawables do not get mirrored when layout is RTL

Open
#904 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
7.8k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

- [x] I have searched [existing issues](https://github.com/facebook/litho/issues) and this is not a duplicate

## 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:
```java
@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):
```xml

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.