React Native Text Size

screenshot of React Native Text Size

React Native Text Size

Measure text accurately before laying it out and get font information from your App.


The React Native Text Size npm package offers functionality to measure text accurately and obtain font information in a React Native application for both Android and iOS platforms. The library provides two main functions, flatHeights and measure, for obtaining height information of text blocks and detailed text information, respectively.


  • flatHeights: Obtain the height of different text blocks simultaneously, optimized for components like FlatList or RecyclerListView.
  • measure: Get detailed information about a block of text including width, height, number of lines, width of the last line, and more. Text properties like fontFamily, fontSize, fontWeight, etc., can be specified.


To install the React Native Text Size npm package, follow these steps:

  1. Update 'compile' directive to 'implementation' in the android/app/build.gradle file.
  2. Ensure the following requirements are met:
    • React Native v0.57 or later
    • Android API 16 or iOS 9.0 and above
  3. For versions before React Native 0.56, use react-native-text-size v2.1.1
  4. For manual installation or troubleshooting, refer to the Wiki.


The React Native Text Size npm package provides a convenient solution for developers to accurately measure text and access font information in their React Native applications. With functions like flatHeights and measure, users can efficiently handle text block measurements and obtain detailed text metrics. The package simplifies the process of text layout and styling, enhancing the overall development experience in React Native projects.

React Native

React Native is a framework for building mobile applications using React and JavaScript. It enables developers to write once and deploy to multiple platforms, including iOS, Android, and the web, while providing a native app-like experience to users.