Fix CSSLayout to Support RTL
Summary: @public The current CSSLayout can't support RTL because wrong calculation for absolute position. This change is mainly to fix the issue: https://github.com/facebook/css-layout/issues/197 Three main problems I fixed: 1. Calculate the position in the same way as margin, boarder, and padding. So that to fix the absolute problem. 2. Fix one wrong calculation for leading value when we only know the trailing value. It was hard code for the LTR situation. Now I changed it to depends on the main Axis. 3. Expose getter and setter function for RN to read layout direction and start/end position value. Reviewed By: fkgozali Differential Revision: D3616949 fbshipit-source-id: ae7a47cc0a5d02b42b95f87232be51ab144056d9
This commit is contained in:
committed by
Facebook Github Bot 1
parent
b26794a375
commit
46c842c71a
@@ -30,8 +30,8 @@ public class CSSStyle {
|
||||
public Spacing margin = new Spacing();
|
||||
public Spacing padding = new Spacing();
|
||||
public Spacing border = new Spacing();
|
||||
public Spacing position = new Spacing();
|
||||
|
||||
public float[] position = new float[4];
|
||||
public float[] dimensions = new float[2];
|
||||
|
||||
public float minWidth = CSSConstants.UNDEFINED;
|
||||
@@ -56,11 +56,18 @@ public class CSSStyle {
|
||||
overflow = CSSOverflow.VISIBLE;
|
||||
flex = 0f;
|
||||
|
||||
margin.reset();;
|
||||
margin.reset();
|
||||
padding.reset();
|
||||
border.reset();
|
||||
position.reset();
|
||||
|
||||
position.setDefault(Spacing.LEFT, CSSConstants.UNDEFINED);
|
||||
position.setDefault(Spacing.RIGHT, CSSConstants.UNDEFINED);
|
||||
position.setDefault(Spacing.TOP, CSSConstants.UNDEFINED);
|
||||
position.setDefault(Spacing.BOTTOM, CSSConstants.UNDEFINED);
|
||||
position.setDefault(Spacing.START, CSSConstants.UNDEFINED);
|
||||
position.setDefault(Spacing.END, CSSConstants.UNDEFINED);
|
||||
|
||||
Arrays.fill(position, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(dimensions, CSSConstants.UNDEFINED);
|
||||
|
||||
minWidth = CSSConstants.UNDEFINED;
|
||||
|
Reference in New Issue
Block a user