diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java index 5b9d5b21df52fd..e5c94e0084f971 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java @@ -315,10 +315,10 @@ public ReactBaseTextShadowNode() { private int getTextAlign() { int textAlign = mTextAlign; if (getLayoutDirection() == YogaDirection.RTL) { - if (textAlign == Gravity.RIGHT) { - textAlign = Gravity.LEFT; - } else if (textAlign == Gravity.LEFT) { - textAlign = Gravity.RIGHT; + if (textAlign == Gravity.END) { + textAlign = Gravity.START; + } else if (textAlign == Gravity.START) { + textAlign = Gravity.END; } } return textAlign; @@ -364,7 +364,7 @@ public void setTextAlign(@Nullable String textAlign) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD; } - mTextAlign = Gravity.LEFT; + mTextAlign = Gravity.START; } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mJustificationMode = Layout.JUSTIFICATION_MODE_NONE; @@ -373,9 +373,9 @@ public void setTextAlign(@Nullable String textAlign) { if (textAlign == null || "auto".equals(textAlign)) { mTextAlign = Gravity.NO_GRAVITY; } else if ("left".equals(textAlign)) { - mTextAlign = Gravity.LEFT; + mTextAlign = Gravity.START; } else if ("right".equals(textAlign)) { - mTextAlign = Gravity.RIGHT; + mTextAlign = Gravity.END; } else if ("center".equals(textAlign)) { mTextAlign = Gravity.CENTER_HORIZONTAL; } else { diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java index 5cf16db80f0fd4..e5eaf49ff01df9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java @@ -76,10 +76,10 @@ public long measure( Layout.Alignment alignment = Layout.Alignment.ALIGN_NORMAL; switch (getTextAlign()) { - case Gravity.LEFT: + case Gravity.START: alignment = Layout.Alignment.ALIGN_NORMAL; break; - case Gravity.RIGHT: + case Gravity.END: alignment = Layout.Alignment.ALIGN_OPPOSITE; break; case Gravity.CENTER_HORIZONTAL: @@ -179,10 +179,10 @@ private void initMeasureFunction() { private int getTextAlign() { int textAlign = mTextAlign; if (getLayoutDirection() == YogaDirection.RTL) { - if (textAlign == Gravity.RIGHT) { - textAlign = Gravity.LEFT; - } else if (textAlign == Gravity.LEFT) { - textAlign = Gravity.RIGHT; + if (textAlign == Gravity.END) { + textAlign = Gravity.START; + } else if (textAlign == Gravity.START) { + textAlign = Gravity.END; } } return textAlign; diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java index e23961d75d8b44..34ca9213b35ac0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java @@ -164,10 +164,10 @@ public float getEffectiveLineHeight() { public int getTextAlign() { int textAlign = mTextAlign; if (getLayoutDirection() == YogaDirection.RTL) { - if (textAlign == Gravity.RIGHT) { - textAlign = Gravity.LEFT; - } else if (textAlign == Gravity.LEFT) { - textAlign = Gravity.RIGHT; + if (textAlign == Gravity.END) { + textAlign = Gravity.START; + } else if (textAlign == Gravity.START) { + textAlign = Gravity.END; } } return textAlign; @@ -210,7 +210,7 @@ public void setTextAlign(@Nullable String textAlign) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mJustificationMode = Layout.JUSTIFICATION_MODE_INTER_WORD; } - mTextAlign = Gravity.LEFT; + mTextAlign = Gravity.START; } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mJustificationMode = Layout.JUSTIFICATION_MODE_NONE; @@ -219,9 +219,9 @@ public void setTextAlign(@Nullable String textAlign) { if (textAlign == null || "auto".equals(textAlign)) { mTextAlign = Gravity.NO_GRAVITY; } else if ("left".equals(textAlign)) { - mTextAlign = Gravity.LEFT; + mTextAlign = Gravity.START; } else if ("right".equals(textAlign)) { - mTextAlign = Gravity.RIGHT; + mTextAlign = Gravity.END; } else if ("center".equals(textAlign)) { mTextAlign = Gravity.CENTER_HORIZONTAL; } else { diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 6f9e6e5635c03c..d820ee7a5ee6a2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -7,6 +7,7 @@ package com.facebook.react.views.textinput; +import android.annotation.TargetApi; import android.graphics.PorterDuff; import android.graphics.Typeface; import android.graphics.drawable.Drawable; @@ -478,7 +479,7 @@ public void setTextAlign(ReactEditText view, @Nullable String textAlign) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { view.setJustificationMode(Layout.JUSTIFICATION_MODE_INTER_WORD); } - view.setGravityHorizontal(Gravity.LEFT); + view.setGravityHorizontal(Gravity.START); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { view.setJustificationMode(Layout.JUSTIFICATION_MODE_NONE); @@ -487,9 +488,9 @@ public void setTextAlign(ReactEditText view, @Nullable String textAlign) { if (textAlign == null || "auto".equals(textAlign)) { view.setGravityHorizontal(Gravity.NO_GRAVITY); } else if ("left".equals(textAlign)) { - view.setGravityHorizontal(Gravity.LEFT); + view.setGravityHorizontal(Gravity.START); } else if ("right".equals(textAlign)) { - view.setGravityHorizontal(Gravity.RIGHT); + view.setGravityHorizontal(Gravity.END); } else if ("center".equals(textAlign)) { view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL); } else {