google / flexbox-layout

Flexbox for Android
Apache License 2.0
18.25k stars 1.8k forks source link

Bug using RTL layout #550

Open JRiberaG opened 4 years ago

JRiberaG commented 4 years ago

Issues and steps to reproduce

I have the following problem: when I use FlexBoxLayout, layoutDirection RTL and I update some views, e.g. changing a textView.text, the items of the first column disappear. The FlexDirection is Column.

It's weird because it only affects the items of the first column, it does not affect the items of the other columns. The reason why I think the problem is between FlexBoxLayout and layoutDirection RTL is because I've tried to change the layoutDirection to LTR and it works perfectly (the TextView can be updated with no issue at all) and not a single item disappears.

Expected behavior

The TextViews should be able to be updated and the FlexBoxLayout's first column items shouldn't disappears, as it happens right now.

Version of the flexbox library

2.0.1

kristiyanP commented 3 years ago

Yes we also have encountered this bug. We had to define the layoutDirection=locale for all the items in the FlexBoxLayoutManager.

You can see that it does not forwards the layoutDirection on the children by inspecting with the layoutInspector.

How to reproduce:

<com.google.android.material.button.MaterialButton
        app:icon="@drawable/ic_favorite_24dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button"
        style="@style/Widget.MaterialComponents.Button.Icon"
 />
vd92 commented 3 years ago

same problem. I solved problem by setting layoutDirection = View.LAYOUT_DIRECTION_LTR to Recyclerview