{"id":26472613,"url":"https://github.com/dawsonbooth/react-native-use-dimensions","last_synced_at":"2025-07-16T19:34:32.750Z","repository":{"id":36931643,"uuid":"231191766","full_name":"dawsonbooth/react-native-use-dimensions","owner":"dawsonbooth","description":"A collection of React hooks for using the dimensions of the screen, window, or both","archived":false,"fork":false,"pushed_at":"2023-07-18T20:28:19.000Z","size":2196,"stargazers_count":10,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T19:17:46.106Z","etag":null,"topics":["expo","react","react-hooks","react-native"],"latest_commit_sha":null,"homepage":"https://dawsonbooth.com/react-native-use-dimensions/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dawsonbooth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-01T08:23:00.000Z","updated_at":"2024-09-23T12:37:24.000Z","dependencies_parsed_at":"2024-06-19T11:29:47.247Z","dependency_job_id":null,"html_url":"https://github.com/dawsonbooth/react-native-use-dimensions","commit_stats":{"total_commits":107,"total_committers":4,"mean_commits":26.75,"dds":"0.22429906542056077","last_synced_commit":"91df7f3d5c89d7fa1df85e7d05d681be8bf4c7ae"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/dawsonbooth/react-native-use-dimensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsonbooth%2Freact-native-use-dimensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsonbooth%2Freact-native-use-dimensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsonbooth%2Freact-native-use-dimensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsonbooth%2Freact-native-use-dimensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dawsonbooth","download_url":"https://codeload.github.com/dawsonbooth/react-native-use-dimensions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsonbooth%2Freact-native-use-dimensions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265534773,"owners_count":23783885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expo","react","react-hooks","react-native"],"created_at":"2025-03-19T21:35:13.974Z","updated_at":"2025-07-16T19:34:32.734Z","avatar_url":"https://github.com/dawsonbooth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/dawsonbooth/react-native-use-dimensions/master/assets/img/logo.svg\" height=200 width=400 alt=\"react-native-use-dimensions\"\u003e\n\n[![npm version](http://img.shields.io/npm/v/react-native-use-dimensions.svg?style=flat)](https://npmjs.org/package/react-native-use-dimensions)\n[![downloads](http://img.shields.io/npm/dt/react-native-use-dimensions.svg?style=flat)](https://npmjs.org/package/react-native-use-dimensions)\n[![build status](https://github.com/dawsonbooth/react-native-use-dimensions/workflows/build/badge.svg)](https://github.com/dawsonbooth/react-native-use-dimensions/actions?workflow=build)\n[![license](https://img.shields.io/npm/l/react-native-use-dimensions.svg?style=flat)](https://github.com/dawsonbooth/react-native-use-dimensions/blob/master/LICENSE)\n\n\u003c/div\u003e\n\n## Description\n\nThis Node.js package is a collection of React hooks for using the dimensions of the screen, window, or both.\n\n## Installation\n\nWith [Node.js](https://nodejs.org/en/download/) installed, simply run the following command to add the package to your project.\n\n```bash\nnpm install react-native-use-dimensions\n```\n\n## Usage\n\nCheck out the examples below or [check out the docs](https://dawsonbooth.github.io/react-native-use-dimensions/).\n\nThe package comes with three hooks:\n\n1. **useScreenDimensions** - screen dimensions\n2. **useWindowDimensions** - window dimensions, which can be [separate from screen on Android](https://stackoverflow.com/a/44979327/11960129)\n3. **useDimensions** - screen and window dimensions\n\n```js\nimport React from \"react\";\nimport { Text } from \"react-native\";\nimport useDimensions, {\n  useScreenDimensions,\n  useWindowDimensions,\n} from \"react-native-use-dimensions\";\n\nconst ScreenDimensions = () =\u003e {\n  const { height, width } = useScreenDimensions();\n  const isLandscape = width \u003e height;\n  return (\n    \u003cText\u003e\n      {width}x{height}\n      Orientation: {isLandscape ? \"Landscape\" : \"Portrait\"}\n    \u003c/Text\u003e\n  );\n};\n\nconst WindowDimensions = () =\u003e {\n  const { height, width } = useWindowDimensions();\n  const isLandscape = width \u003e height;\n  return (\n    \u003cText\u003e\n      {width}x{height}\n      Orientation: {isLandscape ? \"Landscape\" : \"Portrait\"}\n    \u003c/Text\u003e\n  );\n};\n\nconst BothDimensions = () =\u003e {\n  const { screen, window } = useDimensions();\n  return (\n    \u003cText\u003e\n      Screen: {screen.width}x{screen.height}\n      Window: {window.width}x{window.height}\n    \u003c/Text\u003e\n  );\n};\n```\n\n## License\n\nThis software is released under the terms of [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawsonbooth%2Freact-native-use-dimensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdawsonbooth%2Freact-native-use-dimensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawsonbooth%2Freact-native-use-dimensions/lists"}