In iOS its very easy to change the text input selection colors. Setting <TextInput selectionColor="#ffffff">
works nicely, it sets the grips on the caret this color, and the caret to this color, and when highlight is made this color is transparent version. As seen here in this screenshot:
But on Android this isn’t working well. Setting selectionColor
to white leaves the grip colors at the default Android color, and also does not make the selection a transparent white, such that you cannot see the white text, you see in screenshot here:
Another guy was also trying but didn’t get an answer - How to change the color of the caret in a textinput for Android devices
I did some research in bare react-native and accomplished it like this:
Create /android/app/src/main/res/drawable/splash_screen.xml
and set android:drawable
like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/primary"/>
</layer-list>
That color of @color/primary
is declared in another file we make android/app/src/main/res/values/colors.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#F34336</color>
</resources>
Then in android/app/src/main/AndroidManifest.xml
we set android:theme
property like this:
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/SplashTheme">
Notice the android:theme="@style/SplashTheme"
.
Is this possible in Expo?