Android - decouple TextInput cursorColor from selectionColor (#20276)

Summary:
Basically I want my cursor to be the same color of the text. Which means obviously that selecting the text will make it invisibible (ie, red text on red selection rectangle)

Today, setting a selection color does set a cursor color, which may be a good default in some cases, but we don't always couple these 2 colors together.

See original commit of janicduplessis https://github.com/facebook/react-native/commit/ae57b25134c4db8be8539a0f0e6e52d46c850339

I'd like to be able to set different colors for selection and cursor.
Pull Request resolved: https://github.com/facebook/react-native/pull/20276

Differential Revision: D14102952

Pulled By: cpojer

fbshipit-source-id: 652ff782044277a0c8a821dd628f0373659a7850
This commit is contained in:
Sébastien Lorber
2019-02-15 08:14:20 -08:00
committed by Facebook Github Bot
parent 3ca33320bd
commit d4adf50e1e
@@ -354,7 +354,8 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
setCursorColor(view, color);
}
private void setCursorColor(ReactEditText view, @Nullable Integer color) {
@ReactProp(name = "cursorColor", customType = "Color")
public void setCursorColor(ReactEditText view, @Nullable Integer color) {
// Evil method that uses reflection because there is no public API to changes
// the cursor color programmatically.
// Based on http://stackoverflow.com/questions/25996032/how-to-change-programatically-edittext-cursor-color-in-android.