react-native-textfit
v0.1.1
Published
Auto size text to fit inside a box
Downloads
16
Maintainers
Readme
react-native-textfit
Auto size text to fit inside a box
Props
children
: required Text input that should be resizedwidth
: 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