Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change React Native cursor color?

I am using React Native and I would like to change the cursor color of a text input. I actually got the default blue color.

How can I set a global color either in JavaScript or in AppDelegate ?

like image 880
Yi Wang Avatar asked Oct 13 '15 05:10

Yi Wang


2 Answers

There is actually a prop doing this for TextInput : selectionColor

<TextInput   selectionColor={'green'} /> 

Here is the documentation.

like image 153
Thomas Chafiol Avatar answered Oct 01 '22 09:10

Thomas Chafiol


Best way to accomplish this, if you want consistence trough the app is putting the bellow code in your root file (index.js)

import { TextInput } from 'react-native' TextInput.defaultProps.selectionColor = 'white'  /*class....*/ 
like image 22
João Aguiar Avatar answered Oct 01 '22 09:10

João Aguiar