项目作者: heyman333

项目描述 :
🔠 Responsive fontSize based on screen-size of the device in React-Native
高级语言: JavaScript
项目地址: git://github.com/heyman333/react-native-responsive-fontSize.git
创建时间: 2018-04-23T04:21:03Z
项目社区:https://github.com/heyman333/react-native-responsive-fontSize

开源协议:MIT License

下载


main image

react-native-responsive-fontsize

PRs Welcome
Platform
License Greenkeeper badge

npm version



Use this library if you have a small problem with the font size 🎉


How to install

  1. yarn add react-native-responsive-fontsize
  2. # or
  3. npm install react-native-responsive-fontsize --save

How it looks on different device sizes

iPhone SE iPhone X

Methods

arguments Description
RFPercentage percent: number The font size is calculated as a percentage of the height(width in landscape mode) of the device.
RFValue value: number, standardScreenHeight?: number The font size is calculated based on standardScreenHeight and passed value
  • when using RFValue‘s standardScreenHeight
    • default standardScreenHeight is 680
    • In landscape mode, please pass the screen width

Usage

  1. import { RFPercentage, RFValue } from "react-native-responsive-fontsize";
  2. const styles = StyleSheet.create({
  3. welcome: {
  4. fontSize: RFValue(24, 580) // second argument is standardScreenHeight(optional),
  5. textAlign: "center",
  6. margin: 10,
  7. },
  8. instructions: {
  9. textAlign: "center",
  10. color: "#333333",
  11. marginBottom: 5,
  12. fontSize: RFPercentage(5),
  13. },
  14. });

Changelog

releases

Load map (I’m waiting for your help)

  • support landscape mode
  • make test code