diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java index 17ef123d0d20de..360de688d54849 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java @@ -914,6 +914,10 @@ public void setBorderColor(int position, float color, float alpha) { mReactBackgroundManager.setBorderColor(position, color, alpha); } + public int getBorderColor(int position) { + return mReactBackgroundManager.getBorderColor(position); + } + public void setBorderRadius(float borderRadius) { mReactBackgroundManager.setBorderRadius(borderRadius); } 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 99ae31e7d501c7..9f64b841f114cc 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 @@ -637,7 +637,16 @@ public void setUnderlineColor(ReactEditText view, @Nullable Integer underlineCol if (underlineColor == null) { drawableToMutate.clearColorFilter(); } else { - drawableToMutate.setColorFilter(underlineColor, PorterDuff.Mode.SRC_IN); + // fixes underlineColor transparent not working on API 21 + // re-sets the TextInput underlineColor https://bit.ly/3M4alr6 + if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) { + int bottomBorderColor = view.getBorderColor(Spacing.BOTTOM); + setBorderColor(view, Spacing.START, underlineColor); + drawableToMutate.setColorFilter(underlineColor, PorterDuff.Mode.SRC_IN); + setBorderColor(view, Spacing.START, bottomBorderColor); + } else { + drawableToMutate.setColorFilter(underlineColor, PorterDuff.Mode.SRC_IN); + } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java index c6fdb1f6ee023f..a464382e3c5f63 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java @@ -1259,7 +1259,7 @@ private boolean isBorderColorDefined(int position) { return !YogaConstants.isUndefined(rgb) && !YogaConstants.isUndefined(alpha); } - private int getBorderColor(int position) { + public int getBorderColor(int position) { float rgb = mBorderRGB != null ? mBorderRGB.get(position) : DEFAULT_BORDER_RGB; float alpha = mBorderAlpha != null ? mBorderAlpha.get(position) : DEFAULT_BORDER_ALPHA; diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java index c89b4e3ad0c8e9..19bf56f381baf8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java @@ -58,6 +58,10 @@ public void setBorderColor(int position, float color, float alpha) { getOrCreateReactViewBackground().setBorderColor(position, color, alpha); } + public int getBorderColor(int position) { + return getOrCreateReactViewBackground().getBorderColor(position); + } + public void setBorderRadius(float borderRadius) { getOrCreateReactViewBackground().setRadius(borderRadius); }