0.0.3 • Published 6 years ago
@rnhooks/dimensions v0.0.3
@rnhooks/dimensions
React Native hook for Dimensions
Installation
$ yarn add @rnhooks/dimensionsUsage
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
- @pritishvaidya The main author.
Questions
Feel free to contact me or create an issue