react-native-textfit

0.1.1 • Public • Published

react-native-textfit version

Auto size text to fit inside a box

Props

  • children: required Text input that should be resized
  • width: Maximum width of the box. (Default: auto)
  • height: Maximum height of the box. (Default: auto)
  • Other React props

Installation

npm i -S react-native-textfit

Usage Examples

import TextFit from "react-native-textfit"
<TextFit
  height={200}
  width={150}
  style={{color: 'red'}}
  onPress={event => console.log(event)}>
  {'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'}
</TextFit>

Try example

- git clone https://github.com/stoffern/react-native-textfit.git
- cd react-native-textfit/example
- npm start

Package Sidebar

Install

npm i react-native-textfit

Weekly Downloads

2

Version

0.1.1

License

ISC

Last publish

Collaborators

  • stoffern