rafaelmorais
rafaelmorais

Reputation: 1383

TextInput selectionColor property no changing color on android

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

Upvotes: 3

Views: 5981

Answers (2)

Kinjal
Kinjal

Reputation: 327

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

Upvotes: 4

lovepreet singh
lovepreet singh

Reputation: 118

    <TextInput 
   selectionColor={global.COLOR.DARKBLUE}
   underlineColorAndroid={global.COLOR.ORANGE}
  autoCapitalize="none" autoCorrect={false} />

you can try this

Upvotes: -2

Related Questions