react-native-viewport-ts-units
v0.0.2
Published
A simple TypeScript-supported package to enable viewport-based units in React Native: vh, vw, vmax, vmin
Downloads
8
Maintainers
Readme
react-native-viewport-ts-units
A simple package enabling vw
, vh
, vmin
, vmax
units for measurement in React Native.
TypeScript Declarations included.
Install
$ npm install react-native-viewport-ts-units
or
$ yarn add react-native-viewport-ts-units
Usage
Simply call the functions to size your components.
import { vw, vh, vmin, vmax } from "react-native-viewport-ts-units";
<View style={{ width: vw(100), height: vh(100) }}>
...
<View>
const styles = StyleSheet.create({
Container: {
width: vmin(95),
height: vmax(70),
padding: vw(2.5),
margin: vh(5),
},
Font: {
fontSize: vw(3.75),
},
});
License
MIT © Ronit Bhatia