{"id":4130,"url":"https://github.com/kkjdaniel/react-native-device-display","last_synced_at":"2025-04-13T15:42:12.941Z","repository":{"id":34353244,"uuid":"38275100","full_name":"kkjdaniel/react-native-device-display","owner":"kkjdaniel","description":"📲 Create dynamic views through device, display and orientation detection (DEPRECATED)","archived":false,"fork":false,"pushed_at":"2018-09-13T23:29:06.000Z","size":42,"stargazers_count":108,"open_issues_count":1,"forks_count":24,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-29T13:49:50.072Z","etag":null,"topics":["device-detection","orientation-changes","react-native","universal-apps"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kkjdaniel.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}},"created_at":"2015-06-29T22:44:45.000Z","updated_at":"2024-04-02T17:40:43.000Z","dependencies_parsed_at":"2022-09-03T08:01:26.730Z","dependency_job_id":null,"html_url":"https://github.com/kkjdaniel/react-native-device-display","commit_stats":null,"previous_names":["kkjdaniel/react-native-display-view"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkjdaniel%2Freact-native-device-display","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkjdaniel%2Freact-native-device-display/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkjdaniel%2Freact-native-device-display/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkjdaniel%2Freact-native-device-display/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkjdaniel","download_url":"https://codeload.github.com/kkjdaniel/react-native-device-display/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248740057,"owners_count":21154248,"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":["device-detection","orientation-changes","react-native","universal-apps"],"created_at":"2024-01-05T20:17:02.019Z","updated_at":"2025-04-13T15:42:12.919Z","avatar_url":"https://github.com/kkjdaniel.png","language":"JavaScript","funding_links":[],"categories":["Components","JavaScript"],"sub_categories":["UI"],"readme":"# 📲 React Native Device Display\n### This package is now **deprecated** and I am not actively maintaining it. In the meantime you can also use [react-native-orientation](https://github.com/yamill/react-native-orientation).\n\nA simple way to create dynamic views through device, display and orientation detection, allowing the creation of adaptable and universal apps. **Currently only for React Native iOS, [Android support](https://github.com/kkjdaniel/react-native-device-display/issues/10) in progress.**\n\n[![GitHub issues](https://img.shields.io/github/issues/kkjdaniel/react-native-device-display.svg)](https://github.com/kkjdaniel/react-native-device-display/issues)\n[![Version](https://img.shields.io/npm/v/react-native-device-display.svg)](https://www.npmjs.com/package/react-native-device-display)\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://www.npmjs.com/package/react-native-device-display)\n[![Downloads](https://img.shields.io/npm/dt/react-native-device-display.svg)](https://www.npmjs.com/package/react-native-device-display)\n\n![Example GIF Demo](http://i.imgur.com/RKYZf3i.gif)\n\n## Installation (iOS)\n\nSimply install the package as shown below...\n\n```sh\n$ npm install react-native-device-display\n```\n\nNext you need to import the `DisplayDeviceUtil` classes into your project, these come bundled inside the NPM package.\n\n![Classes Installation Visual](http://i.imgur.com/vT2qGfr.png)\n\nThen require it in your project wherever you need it...\n\n```javascript\nvar Display = require('react-native-device-display');\n```\n\n## Methods\n\n```javascript\nDisplay.percentage(type, value);\n```\n\nReturns in `pixels` the percentage value of type `width` or `height`\n\n```javascript\nDisplay.isTablet();\n```\n\nReturns `true` if the the device is a tablet (e.g iPad)\n\n```javascript\nDisplay.isPhone();\n```\n\nReturns `true` if the the device is a phone (e.g iPhone)\n\n```javascript\nDisplay.isPortrait();\n```\n\nReturns `true` if the the device is in a portrait position\n\n```javascript\nDisplay.isLandscape();\n```\n\nReturns `true` if the the device is in a landscape position\n\n```javascript\nDisplay.onOrientationDidChange(handler)\n```\n\nTriggers the `handler` call-back when the orientation changes\n\n## Properties\n\n```javascript\nDisplay.width\n```\n\nWidth in `pixels` of the display\n\n```javascript\nDisplay.height\n```\n\nHeight in `pixels` of the display\n\n```javascript\nDisplay.verbose\n```\n\nDefaults to `false`, changing it to `true` enables `console.log` messages of orientation change events\n\n## Example\n\n```javascript\nvar Display = require('react-native-device-display');\nvar listener;\n\nvar testing = React.createClass({\n\n  componentDidMount: function() {\n    listener = Display.onOrientationDidChange(function() {\n      //Change States, perform Magic, etc...\n    });\n  },\n\n  componentWillUnmount: function() {\n    //Unlisten the onOrientationChange...\n    listener = null;\n  },\n  \n  render: function() {\n    if (Display.isPortrait()) {\n      //Return portrait view...\n    } else if (Display.isLandscape()) {\n      //Return landscape view...\n    } \n    //Add as many conditions and views as you see fit...\n  }\n  \n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkjdaniel%2Freact-native-device-display","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkjdaniel%2Freact-native-device-display","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkjdaniel%2Freact-native-device-display/lists"}