After reading the React Native documentation I understood that selectionColor was used to change the color of the cursor instead of that primary default color of android system.
So I tried the following:
<TextInput selectionColor="#2E5BFF" {...props} autoCapitalize="none" autoCorrect={false} />
The problem is that on android devices it still gets that green default color of android, on the emulator tought its fine and is showing #2E5BFF color. My android devices both have android P.
Is there any known bug or am I doing something wrong here?
EDIT
I'm using Expo SDK 32.0.0
You can set colorControlActivated in styles.xml file.Like this
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/kio_turquoise</item>
<item name="colorPrimaryDark">@color/kio_hot_pink</item>
<!-- sets cursor color -->
<item name="colorControlActivated">@android:color/black</item>
</style>
because the backbone of the app is the native android application. For more information you can refer this article. It is very helpful.
React native on android styling the cursor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With