{"id":15007630,"url":"https://github.com/charlesstover/use-dimensions","last_synced_at":"2025-10-03T15:31:04.347Z","repository":{"id":46296703,"uuid":"156606950","full_name":"CharlesStover/use-dimensions","owner":"CharlesStover","description":"A React hook for the React Native Dimensions API.","archived":true,"fork":false,"pushed_at":"2022-11-28T05:03:04.000Z","size":967,"stargazers_count":32,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-15T19:36:31.275Z","etag":null,"topics":["npm","npmjs","react","react-hook","react-hooks","react-native","reactjs","reactnative","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/use-dimensions","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CharlesStover.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["CharlesStover"]}},"created_at":"2018-11-07T20:54:24.000Z","updated_at":"2024-02-26T08:24:10.000Z","dependencies_parsed_at":"2023-01-23T12:15:29.769Z","dependency_job_id":null,"html_url":"https://github.com/CharlesStover/use-dimensions","commit_stats":null,"previous_names":["quisido/use-dimensions","charlesstover/use-dimensions"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fuse-dimensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fuse-dimensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fuse-dimensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fuse-dimensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CharlesStover","download_url":"https://codeload.github.com/CharlesStover/use-dimensions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235146593,"owners_count":18943285,"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":["npm","npmjs","react","react-hook","react-hooks","react-native","reactjs","reactnative","typescript"],"created_at":"2024-09-24T19:12:47.898Z","updated_at":"2025-10-03T15:30:58.921Z","avatar_url":"https://github.com/CharlesStover.png","language":"JavaScript","readme":"# useDimensions\n\n[![version](https://img.shields.io/npm/v/use-dimensions.svg)](https://www.npmjs.com/package/use-dimensions)\n[![minzipped size](https://img.shields.io/bundlephobia/minzip/use-dimensions.svg)](https://www.npmjs.com/package/use-dimensions)\n[![downloads](https://img.shields.io/npm/dt/use-dimensions.svg)](https://www.npmjs.com/package/use-dimensions)\n\n`useDimensions` is a React hook for the React Native Dimensions API.\n\n## Install\n\n* `npm install use-dimensions --save`, or\n* `yarn add use-dimensions`\n\n## Use\n\n### Screen and Window Dimensions\n\nTo get both screen and window dimensions, use the default export.\n\n```js\nimport useDimensions from 'use-dimensions';\n\nexport default function MyComponent() {\n  const { screen, window } = useDimensions();\n  return (\n    \u003cText\u003e\n      a {screen.width}x{screen.height} screen{' '}\n      inside a{' '}\n      {window.width}x{window.height} window\n    \u003c/Text\u003e\n  );\n}\n```\n\n### Screen Dimensions Only\n\nTo get the screen dimensions only, use the `useScreenDimensions` export.\n\n```js\nimport { useScreenDimensions } from 'use-dimensions';\n\nexport default function MyComponent() {\n  const { height, width } = useScreenDimensions();\n  return \u003cText\u003e{width}x{height}\u003c/Text\u003e;\n}\n```\n\n### Window Dimensions Only\n\nTo get the window dimensions only, use the `useWindowDimensions` export.\n\n```js\nimport { useWindowDimensions } from 'use-dimensions';\n\nexport default function MyComponent() {\n  const { height, width } = useWindowDimensions();\n  return \u003cText\u003e{width}x{height}\u003c/Text\u003e;\n}\n```\n","funding_links":["https://github.com/sponsors/CharlesStover"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlesstover%2Fuse-dimensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlesstover%2Fuse-dimensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlesstover%2Fuse-dimensions/lists"}