@Test public void testPlaceholderTextColor() { ReactEditText view = mManager.createViewInstance(mThemedContext); final ColorStateList defaultPlaceholderColorStateList = DefaultStyleValuesUtil.getDefaultTextColorHint( view.getContext()); ColorStateList colors = view.getHintTextColors(); assertThat(colors).isEqualTo(defaultPlaceholderColorStateList); mManager.updateProperties(view, buildStyles("placeholderTextColor", null)); colors = view.getHintTextColors(); assertThat(colors).isEqualTo(defaultPlaceholderColorStateList); mManager.updateProperties(view, buildStyles("placeholderTextColor", Color.RED)); colors = view.getHintTextColors(); assertThat(colors.getDefaultColor()).isEqualTo(Color.RED); mManager.updateProperties(view, buildStyles("placeholderTextColor", null)); colors = view.getHintTextColors(); assertThat(colors).isEqualTo(defaultPlaceholderColorStateList); }
@ReactProp(name = "placeholderTextColor", customType = "Color") public void setPlaceholderTextColor(ReactEditText view, @Nullable Integer color) { if (color == null) { view.setHintTextColor(DefaultStyleValuesUtil.getDefaultTextColorHint(view.getContext())); } else { view.setHintTextColor(color); } }
@ReactProp(name = "selectionColor", customType = "Color") public void setSelectionColor(ReactEditText view, @Nullable Integer color) { if (color == null) { view.setHighlightColor(DefaultStyleValuesUtil.getDefaultTextColorHighlight(view.getContext())); } else { view.setHighlightColor(color); } setCursorColor(view, color); }
@ReactProp(name = ViewProps.COLOR, customType = "Color") public void setColor(ReactEditText view, @Nullable Integer color) { if (color == null) { view.setTextColor(DefaultStyleValuesUtil.getDefaultTextColor(view.getContext())); } else { view.setTextColor(color); } }
@ReactProp(name = "selectionColor", customType = "Color") public void setSelectionColor(ReactEditText view, @Nullable Integer color) { if (color == null) { view.setHighlightColor(DefaultStyleValuesUtil.getDefaultTextColorHighlight(view.getContext())); } else { view.setHighlightColor(color); } }