Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

underlineColor transparent not working on API 21 #30897

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.content.res.ColorStateList;
import android.graphics.BlendMode;
import android.graphics.BlendModeColorFilter;
import android.graphics.Color;
fabOnReact marked this conversation as resolved.
Show resolved Hide resolved
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
Expand Down Expand Up @@ -545,7 +546,14 @@ public void setUnderlineColor(ReactEditText view, @Nullable Integer underlineCol
if (underlineColor == null) {
drawableToMutate.clearColorFilter();
fabOnReact marked this conversation as resolved.
Show resolved Hide resolved
} else {
drawableToMutate.setColorFilter(underlineColor, PorterDuff.Mode.SRC_IN);
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here on why this is needed otherwise would be really hard to understand afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cortinico thanks a lot. I added the comment with commit 6ebac50 and updated the summary of the pull request #30897 (comment) to include a link to fabOnReact/react-native-notes#4 (comment). I remain available.

int bottomBorderColor = view.getBorderColor(Spacing.BOTTOM);
setBorderColor(view, Spacing.BOTTOM, underlineColor);
drawableToMutate.setColorFilter(underlineColor, PorterDuff.Mode.SRC_IN);
setBorderColor(view, Spacing.BOTTOM, bottomBorderColor);
} else {
drawableToMutate.setColorFilter(underlineColor, PorterDuff.Mode.SRC_IN);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ module.exports = ([
return (
<TextInput
autoFocus={true}
style={styles.default}
underlineColorAndroid="transparent"
accessibilityLabel="I am the accessibility label for text input"
/>
);
Expand Down