From 5819538a087f1f48d564e7b4e273fe43dfb026cc Mon Sep 17 00:00:00 2001 From: fabriziobertoglio1987 Date: Mon, 16 Aug 2021 12:02:29 -0700 Subject: [PATCH] Fix selectionColor doesn't style Android TextInput selection handles (#31007) Summary: This issue fixes https://github.com/facebook/react-native/issues/30283 selectionColor does not change the handles color. The method setCursorColor changes the cursor color of field `mCursorDrawable` using a reflection for Android Devices lower then API 28. This fix adds a reflection to change color of the left, center and right handles of a selection (mTextSelectHandleLeftRes, mTextSelectHandleRes and mTextSelectHandleRightRes). ## Changelog [Android] [Fixed] - Fix selectionColor doesn't style Android TextInput selection handles Pull Request resolved: https://github.com/facebook/react-native/pull/31007 Test Plan: This changes fix the Java API for which I can not write Java tests as explained in commit https://github.com/facebook/react-native/commit/709a441ecf54cd9465f5946af0454ee7d10d5cbe The java TextInputTest was excluded from the test suite in commit https://github.com/facebook/react-native/commit/709a441ecf54cd9465f5946af0454ee7d10d5cbe as they need the Yoga libraries to run **
CLICK TO OPEN TESTS RESULTS - API 22**

left/right handles do not change color with the cursor | **BEFORE** | |:-------------------------:| | | center Handle color does not change color | **BEFORE** | |:-------------------------:| | | The left and right handle change color with the cursor color | **AFTER** | |:-------------------------:| | | The center handle color is correctly updated | **AFTER** | |:-------------------------:| | | `setCursorColor` changes correctly the cursor color | **AFTER** | |:-------------------------:| | | Default Colors do not have issues | **AFTER** | |:-------------------------:| | | | **AFTER** | |:-------------------------:| | |

Reviewed By: ShikaSD Differential Revision: D28682935 Pulled By: sota000 fbshipit-source-id: ff037c93f36bbf20c915373b995bbfd8e8ca92d0 --- .../textinput/ReactTextInputManager.java | 69 +++++++++++-------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 2c199206d13cc9..0b6298fdd1f489 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -158,6 +158,15 @@ public class ReactTextInputManager extends BaseViewManager