Skip to content

Commit

Permalink
fix(android): Invisible text input (umhan35#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
alpha0010 authored Aug 24, 2020
1 parent aa9a485 commit a9ec72d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions android/src/main/java/org/umhan35/RNSearchBarManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,14 @@ public void setText(SearchView searchView, String text) {
searchView.setQuery(text, false);
}

@ReactProp(name = "textColor", customType = "Color")
public void setTextColor(SearchView searchView, @Nullable Integer color) {
@ReactProp(name = "textColor", defaultInt = Color.TRANSPARENT, customType = "Color")
public void setTextColor(SearchView searchView, int color) {
ColorStateList colorList;
if (color == null) {
if (color == Color.TRANSPARENT) {
// A recent version of RN started sending `0` instead if `null` if a color
// parameter is not supplied JS-side. This means it is no longer possible
// to use param `@Nullable Integer color` to detect defaults. So, assume that
// transparent text is never the goal, and treat that as `null`.
final int[] attrs = {android.R.attr.textColorPrimary};
final TypedArray a = searchView.getContext().obtainStyledAttributes(0, attrs);
colorList = a.getColorStateList(0);
Expand All @@ -166,13 +170,9 @@ public void setTextColor(SearchView searchView, @Nullable Integer color) {
});
}

@ReactProp(name = "textFieldBackgroundColor", customType = "Color")
public void setTextFieldBackgroundColor(SearchView searchView, @Nullable Integer color) {
if (color == null) {
searchView.setBackgroundColor(Color.WHITE);
} else {
searchView.setBackgroundColor(color);
}
@ReactProp(name = "textFieldBackgroundColor", defaultInt = Color.WHITE, customType = "Color")
public void setTextFieldBackgroundColor(SearchView searchView, int color) {
searchView.setBackgroundColor(color);
}

@Nonnull
Expand Down

0 comments on commit a9ec72d

Please sign in to comment.