0.0.6 • Published 5 years ago

react-native-lightweight-responsive v0.0.6

Weekly downloads
73
License
ISC
Repository
github
Last release
5 years ago

react-native-lightweight-responsive

react-native-lightweight-responsive can change the size of your component into optimized size, based on the default UI size of design prototype.

If you have UI prototype design and the default size of prototype is 375 X 812, some devices is OK, but others have problems like below.

What's on the right is not what you want.

Simple Usage

install

npm install --save react-native-lightweight-responsive

usage

import Responsive from 'react-native-lightweight-responsive';

<View style={{
  width: Responsive.width(320),
  height: Responsive.height(400),
}}>
  <Text style={{
    fontSize: Responsive.font(16),
  }}>
    Hello. 
  </Text>
</View>

and then?

API

NameTypeParamDescription
setOptionsfunc{width: 360, height: 640, enableOnlySmallSize: false}width, height sets the default size. enableOnlySmallSize will apply Responsive's features to smaller than default size if true.
widthfuncwidth: numberThe size (width) that will be changed, based on the default size (width) that you set using setOptions.
heightfuncheight: numberThe size (height) that will be changed, based on the default size (height) that you set using setOptions.
fontfuncfont: numberThe size (font) that will be changed, based on the default size (width) that you set using setOptions.

Example

Example