@rnhooks/dimensions

0.0.3 • Public • Published

@rnhooks/dimensions Build Status Maintainability module formats: umd, cjs, esm

React Native hook for Dimensions

Installation

$ yarn add @rnhooks/dimensions

Usage

import useDimensions from '@rnhooks/dimensions';

function App() {
  const { fontScale, width, height, scale } = useDimensions('window');

  return (
    <View style={styles.container}>
      <Text style={styles.type}>{`Width: ${width}`}</Text>
      <Text style={styles.type}>{`Height: ${height}`}</Text>
      <Text style={styles.type}>{`Font Scale: ${fontScale}, Scale: ${scale}`}</Text>
    </View>
  );
}

Input

Name Default Type Description
window / screen null string Type window or screen Dimension

Output

Name Type Default Description
width number null Width of the Screen
height number null Height of the Screen
fontScale number null Font Scale of the Screen
scale number null Scale of the Screen

Contribution

Questions

Feel free to contact me or create an issue

Package Sidebar

Install

npm i @rnhooks/dimensions

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

18.4 kB

Total Files

11

Last publish

Collaborators

  • divyanshu013
  • pritishvaidya