# react-native-responsive-fontsize

> Simple method for resposive fontSize based on screen-size of the device in React-Native

Latest version **0.5.1** (published 2021-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-responsive-fontsize
pnpm add react-native-responsive-fontsize
yarn add react-native-responsive-fontsize
bun add react-native-responsive-fontsize
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.1 |
| Published | 2021-07-17 |
| First published | 2018-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 740 |
| Author | youngsoohan |
| Maintainers | youngsoohan |
| Keywords | react-native, react-native-component, react-component, ios, android, react, font, fontSize, font-size |

## Links

- npm: https://www.npmjs.com/package/react-native-responsive-fontsize
- Repository: https://github.com/heyman333/react-native-responsive-fontsize
- Homepage: https://github.com/heyman333/react-native-responsive-fontsize/blob/master/README.md
- Issues: https://github.com/heyman333/react-native-responsive-fontsize/issues
- npm.io page: https://npm.io/package/react-native-responsive-fontsize

## Dependencies (1)

- [react-native-iphone-x-helper](https://npm.io/package/react-native-iphone-x-helper.md) ^1.3.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.5.1 (latest) — 2021-07-17
- 0.5.0 — 2020-11-14
- 0.4.3 — 2020-02-04
- 0.4.2 — 2019-11-24
- 0.4.1 — 2019-11-18
- 0.4.0 — 2019-11-16
- 0.3.0 — 2019-10-24
- 0.2.3 — 2019-09-30
- 0.2.2 — 2019-09-15
- 0.2.1 — 2019-07-07
- 0.2.0 — 2019-06-18
- 0.1.8 — 2019-01-27
- 0.1.7 — 2018-12-30
- 0.1.6 — 2018-12-07
- 0.1.5 — 2018-12-07
- … 5 more at https://npm.io/package/react-native-responsive-fontsize/versions

## README

<img src="images/main.png" alt="main image">

# react-native-responsive-fontsize

[![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/heyman333/react-native-responsive-fontSize/pulls)
[![Platform](https://img.shields.io/badge/platform-react--native-lightgrey.svg)](http://facebook.github.io/react-native/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/heyman333/react-native-responsive-fontSize/blob/master/LICENSE) [![Greenkeeper badge](https://badges.greenkeeper.io/heyman333/react-native-responsive-fontSize.svg)](https://greenkeeper.io/)
<a href="https://www.npmjs.com/package/react-native-responsive-fontsize">
<img alt="npm version" src="http://img.shields.io/npm/v/react-native-responsive-fontsize.svg?style=flat-square">
</a>
<a href="https://www.npmjs.com/package/react-native-responsive-fontsize">
<img src="http://img.shields.io/npm/dm/react-native-responsive-fontsize.svg?style=flat-square">
</a>

<strong>Use this library if you have a small problem with the font size 🎉</strong>

<hr />

#### How to install

```shell
yarn add react-native-responsive-fontsize
# or
npm install react-native-responsive-fontsize --save
```

#### How it looks on different device sizes

|                                                               iPhone SE                                                                |                                                               iPhone X                                                                |
| :------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------: |
| <img src="https://raw.githubusercontent.com/heyman333/react-native-responsive-fontSize/master/images/SE.png" width="320" height="568"> | <img src="https://raw.githubusercontent.com/heyman333/react-native-responsive-fontSize/master/images/X.png" width="385" height="812"> |

#### 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

```js
import { RFPercentage, RFValue } from "react-native-responsive-fontsize";

const styles = StyleSheet.create({
  welcome: {
    fontSize: RFValue(24, 580) // second argument is standardScreenHeight(optional),
    textAlign: "center",
    margin: 10,
  },
  instructions: {
    textAlign: "center",
    color: "#333333",
    marginBottom: 5,
    fontSize: RFPercentage(5),
  },
});
```

#### Changelog

[releases](https://github.com/heyman333/react-native-responsive-fontSize/releases)

#### Load map (I'm waiting for your help)

- [x] support landscape mode
- [x] make `test code`

---
_Source: https://npm.io/package/react-native-responsive-fontsize · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
