Categories
JavaScript Answers React Native Answers

How to change font family for TextInput placeholder in React Native?

Spread the love

Sometimes, we want to change font family for TextInput placeholder in React Native.

In this article, we’ll look at how to change font family for TextInput placeholder in React Native.

How to change font family for TextInput placeholder in React Native?

To change font family for TextInput placeholder in React Native, we can set the fontFamily style of the TextInput.

For instance, we write:

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

export default function App() {
  const [value, setValue] = React.useState();

  return (
    <View>
      <TextInput
        style={{ fontFamily: 'courier' }}
        value={value}
        onChangeText={setValue}
      />
    </View>
  );
}

to set the fontFamily property to 'courier' to render the text inputted in the TextInput with Courier.

Conclusion

To change font family for TextInput placeholder in React Native, we can set the fontFamily style of the TextInput.

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 *