0.1.2 • Published 6 months ago

@fka/react-native-size v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

react-native-size

A tool that can convert design draft dimensions into DP (density-independent pixels) units used in React Native.

Installation

npm install @fka/react-native-size

Usage

Import and instantiate the object

import RNSize from '@fka/react-native-size';

// 375 is the device width of the design draft
export const rnSize = new RNSize(375);

...

const styles = StyleSheet.create({
  container: {
    width: rnSize.scaleSize(200),
    height: rnSize.scaleSize(200),
    justifyContent: 'center',
    alignItems: 'center',
  },
  title: {
    fontWeight: 'bold',
    color: 'red',
    // font size use scaleFont
    fontSize: rnSize.scaleFont(20),
  }
});
0.1.2

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago