{"id":4110,"url":"https://github.com/walmartlabs/react-native-orientation-listener","last_synced_at":"2025-08-04T00:31:29.845Z","repository":{"id":57338866,"uuid":"42473064","full_name":"walmartlabs/react-native-orientation-listener","owner":"walmartlabs","description":"A react-native library for obtaining current device orientation","archived":true,"fork":false,"pushed_at":"2020-08-17T17:58:40.000Z","size":49,"stargazers_count":149,"open_issues_count":0,"forks_count":31,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-07-30T12:36:51.709Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/walmartlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-14T19:47:34.000Z","updated_at":"2025-07-02T23:32:57.000Z","dependencies_parsed_at":"2022-09-10T21:23:03.512Z","dependency_job_id":null,"html_url":"https://github.com/walmartlabs/react-native-orientation-listener","commit_stats":null,"previous_names":["walmartreact/react-native-orientation-listener"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/walmartlabs/react-native-orientation-listener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Freact-native-orientation-listener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Freact-native-orientation-listener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Freact-native-orientation-listener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Freact-native-orientation-listener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/walmartlabs","download_url":"https://codeload.github.com/walmartlabs/react-native-orientation-listener/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Freact-native-orientation-listener/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268630353,"owners_count":24281198,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-01-05T20:17:01.358Z","updated_at":"2025-08-04T00:31:29.553Z","avatar_url":"https://github.com/walmartlabs.png","language":"Java","funding_links":[],"categories":["Components"],"sub_categories":["UI"],"readme":"***\n# NOTICE:\n \n## This repository has been archived and is not supported.\n \n[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n***\n\n\n## react-native-orientation-listener\n\n\u003e A react-native library for obtaining current device orientation\n\n###Getting Started\n\n- Run `npm install --save react-native-orientation-listener`\n\n###IOS\n\n- Open your Xcode project, and select your project in the Project Navigator tab\n- Right click the `Libraries` folder and select \"Add files to [your project]\"\n- Add `RCTOrientationListener.xcodeproj` from your `node_modules` folder\n- Click your main project icon back in the Project Navigator to bring up preferences, and go to the `Build Phases` tab.\n- Click the `+` button underneath `Link Binary With Libraries` section.\n- Add `libRCTOrientationListener.a`\n\n###Android\n- Open `/android/settings.gradle`\n- Replace `include ':app'` with:\n\n```\ninclude ':com.walmartreact.ReactOrientationListener', ':app'\nproject(':com.walmartreact.ReactOrientationListener').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation-listener/android')\n```\n- Open `android/app/build.gradle`\n- Add the following under `dependencies`:\n\n```\ncompile project(':com.walmartreact.ReactOrientationListener')\n```\n- Open your `MainActivity.java` file under `android/src`\n- Import the lib using `import com.walmartreact.ReactOrientationListener.*;`\n- Add the following after `.addPackage(new MainReactPackage())`:\n\n```\n.addPackage(new ReactOrientationListener())\n```\n\n###Usage\n\nImport the library:\n\n```javascript\nvar Orientation = require('react-native-orientation-listener');\n```\n\n####getOrientation(callback)\n\nThis method will return the current orientation and device string in the form of a callback:\n\n```javascript\ncomponentDidMount(){\n  Orientation.getOrientation(\n    (orientation, device) =\u003e {\n      console.log(orientation, device);\n    }\n  );\n}\n```\n\n####addListener(callback)\n\nThis method will add a listener that will call the callback anytime the device orienatation changes:\n\n```javascript\n_setOrientation(data) {\n  this.setState({\n    orientation: evt.orientation,\n    device: evt.device\n  });\n},\ncomponentDidMount(){\n  Orientation.addListener(this._setOrientation);\n}\n```\n\n####removeListener(callback)\n\nThis method removes the listener you added in componentDidMount:\n\n```javascript\ncomponentWillUnmount() {\n  Orientation.removeListener(this._setOrientation);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalmartlabs%2Freact-native-orientation-listener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwalmartlabs%2Freact-native-orientation-listener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalmartlabs%2Freact-native-orientation-listener/lists"}