0.0.3 • Published 4 years ago

@rnhooks/dimensions v0.0.3

Weekly downloads
266
License
MIT
Repository
github
Last release
4 years ago

@rnhooks/dimensions Build Status Maintainability

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

NameDefaultTypeDescription
window / screennullstringType window or screen Dimension

Output

NameTypeDefaultDescription
widthnumbernullWidth of the Screen
heightnumbernullHeight of the Screen
fontScalenumbernullFont Scale of the Screen
scalenumbernullScale of the Screen

Contribution

Questions

Feel free to contact me or create an issue