Categories
JavaScript Answers React Native Answers

How to style a TextInput in React Native for password input?

Spread the love

Sometimes, we want to style a TextInput in React Native for password input

In this article, we’ll look at how to style a TextInput in React Native for password input.

How to style a TextInput in React Native for password input?

To style a TextInput in React Native for password input, we can set the secureTextEntry prop to true.

For instance, we write:

import * as React from 'react';
import { TextInput, View } from 'react-native';
import Constants from 'expo-constants';

import { Card } from 'react-native-paper';

const App = () => {
  return (
    <View style={{ flex: 1 }}>
      <TextInput secureTextEntry />
    </View>
  );
};
export default App;

to add the secureTextEntry prop to the TextInput add a password input.

Conclusion

To style a TextInput in React Native for password input, we can set the secureTextEntry prop to true.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *