Skip to content

Commit d4adf50

Browse files
slorberfacebook-github-bot
authored andcommitted
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 ae57b25 I'd like to be able to set different colors for selection and cursor. Pull Request resolved: #20276 Differential Revision: D14102952 Pulled By: cpojer fbshipit-source-id: 652ff782044277a0c8a821dd628f0373659a7850
1 parent 3ca3332 commit d4adf50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ public void setSelectionColor(ReactEditText view, @Nullable Integer color) {
354354
setCursorColor(view, color);
355355
}
356356

357-
private void setCursorColor(ReactEditText view, @Nullable Integer color) {
357+
@ReactProp(name = "cursorColor", customType = "Color")
358+
public void setCursorColor(ReactEditText view, @Nullable Integer color) {
358359
// Evil method that uses reflection because there is no public API to changes
359360
// the cursor color programmatically.
360361
// Based on http://stackoverflow.com/questions/25996032/how-to-change-programatically-edittext-cursor-color-in-android.

0 commit comments

Comments
 (0)