[fa icon="calendar"] Publié le 06 April 2016 par Alexandre Moureaux

On React Native 0.22 and below, it is a known issue that you cannot change the input text color for password inputs on Android.

Indeed, setting the color style attribute like this:

<TextInput secureTextEntry={true} style={{color: "white"}}/>  

will not affect the input color:



A fix by @brunobar79 has been merged and should land in React Native 0.23 or later.

But if you don't want to wait for the latest version to come out or if you can't upgrade easily your React Native version, you can use react-native-text-input!

Install it with

npm install --save react-native-text-input  

I strongly recommend the use of RNPM to link native modules:

npm install -g rnpm  
rnpm link react-native-text-input  

Now you can replace:

import { TextInput } from 'react-native';  


import TextInput from 'react-native-text-input';  


And tadaaaaa!
Your input is now white :)


Liked this article? Interested in building an app with us?

Contact a React Native expert in Paris

Want to rate this article?
Submit Rating

Topics: Devops, React Native, Android