Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chilijung/react-native-stylesheet-normalize
normalize fontSize in different devices
https://github.com/chilijung/react-native-stylesheet-normalize
normalize react-native stylesheets
Last synced: 12 days ago
JSON representation
normalize fontSize in different devices
- Host: GitHub
- URL: https://github.com/chilijung/react-native-stylesheet-normalize
- Owner: chilijung
- Created: 2017-08-03T08:37:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-03T14:50:18.000Z (over 6 years ago)
- Last Synced: 2024-10-11T08:16:28.131Z (28 days ago)
- Topics: normalize, react-native, stylesheets
- Language: JavaScript
- Homepage:
- Size: 67.4 KB
- Stars: 6
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-styleSheet-normalize
[![Build Status](https://travis-ci.org/Canner/react-native-stylesheet-normalize.svg?branch=master)](https://travis-ci.org/Canner/react-native-stylesheet-normalize)
normalize fontSize in different devices
## Install
```
yarn add react-native-stylesheet-normalize
```## Why
In different devices there are different `pixelRatio`, `width` and `height`. So appearance should not be always the same, the appearance should adapt it's fontSize to match user's device. Use `normalizeText` extract from `react-native-elements` (see [here](https://github.com/react-native-training/react-native-elements/blob/master/src/helpers/normalizeText.js)).
## Usage
just replace your `StyleSheet.create` to `StyleSheetNormalize.create` and that's it!
```js
import StyleSheetNormalize from 'react-native-stylesheet-normalize';
const styles = StyleSheetNormalize.create({
// your styles here
// all `fontSize` value will wrap with `normalize()`
});
```## License
MIT