{"id":31912980,"url":"https://github.com/andrerfneves/rn-utils","last_synced_at":"2025-10-13T18:25:49.130Z","repository":{"id":90031487,"uuid":"89726018","full_name":"andrerfneves/rn-utils","owner":"andrerfneves","description":"React Native Utilities","archived":false,"fork":false,"pushed_at":"2017-05-03T15:06:17.000Z","size":21,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-09-12T04:23:23.817Z","etag":null,"topics":["dimensions","orientation","react-native","utilities"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/rn-utils","language":"JavaScript","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/andrerfneves.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":"2017-04-28T16:46:42.000Z","updated_at":"2018-07-26T03:31:04.000Z","dependencies_parsed_at":"2023-03-03T20:45:32.671Z","dependency_job_id":null,"html_url":"https://github.com/andrerfneves/rn-utils","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.52,"last_synced_commit":"9ccca3cd7f81281f1b0024770c53c885cb1a3016"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/andrerfneves/rn-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerfneves%2Frn-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerfneves%2Frn-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerfneves%2Frn-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerfneves%2Frn-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrerfneves","download_url":"https://codeload.github.com/andrerfneves/rn-utils/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrerfneves%2Frn-utils/sbom","scorecard":{"id":193025,"data":{"date":"2025-08-11","repo":{"name":"github.com/andrerfneves/rn-utils","commit":"9ccca3cd7f81281f1b0024770c53c885cb1a3016"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 1/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'develop'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T21:11:14.091Z","repository_id":90031487,"created_at":"2025-08-16T21:11:14.091Z","updated_at":"2025-08-16T21:11:14.091Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011065,"owners_count":26084865,"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-10-12T02:00:06.719Z","response_time":53,"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":["dimensions","orientation","react-native","utilities"],"created_at":"2025-10-13T18:25:47.375Z","updated_at":"2025-10-13T18:25:49.125Z","avatar_url":"https://github.com/andrerfneves.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native Utils\n[![npm version](https://badge.fury.io/js/rn-utils.svg)](https://badge.fury.io/js/rn-utils)\n\nReact Native Utilities is a package born out of the incessant rewriting of utility functions while developing scalable and maintainable React Native applications. It aims to be a repository that holds trivial yet useful utility functions that are most times copied over/recreated in every new React Native project.\n\n## Installation\n```\nnpm install rn-utils --save\n```\n\n## Utilities\n\n### Dimensions\n|  Function | Usage | Utility |\n|-----------|-------|---------|\n| getDeviceHeight | `RNUtils.getDeviceHeight()` | Returns the device's current viewport height. |\n| getDeviceWidth | `RNUtils.getDeviceWidth()` | Returns the device's current viewport width. |\n\n### Orientation\n*Currently the only 3rd party package with native dependecies used by React Native Utilities is the [React Native Orientation](https://github.com/yamill/react-native-orientation) module. If you wish to use any of the Orientation functionalities of React Native Utils, remember to link its native dependencies.*\n```\nreact-native link react-native-orientation\n```\n\n|  Function | Usage | Utility |\n|-----------|-------|---------|\n| addOrientationListener | `RNUtils.addOrientationListener((orientation) =\u003e this.setState({ orientation }))` | Creates an event listener that triggers whenever the orientation of the device changes. |\n| getOrientation | `RNUtils.getOrientation()` | Function that returns the current device's orientation. It uses `getInitialOrientation` method from [React Native Orientation](https://github.com/yamill/react-native-orientation) module to allow for Async/Initial orientation checks. Orientation will either return LANDSCAPE or PORTRAIT. |\n| isLandscape | `RNUtils.isLandscape(orientation)` | Helper that returns `true` if current device orientation is Landscape. The `orientation` argument must be passed. This is usually used with the `addOrientationListener` or `getOrientation` utility functions. |\n| lockLandscape | `RNUtils.lockLandscape()` | Locks the device's viewport to the Landscape mode. Disables portrait. |\n| lockPortrait | `RNUtils.lockPortrait()` | Locks the device's viewport to the Portrait mode. Disables landscape. |\n| unlockOrientations | `RNUtils.unlockOrientations()` | Unlocks any previous locking behavior applied by `lockPortrait` or `lockLandscape`. |\n\n### Text Helpers\n\n|  Function | Usage | Utility |\n|-----------|-------|---------|\n| getFontSize | `textHelpers.getFontSize(size)` | Returns a font size based on size argument |\n| getLineHeight | `textHelpers.getLineHeight(size)` | Returns a line height based on size argument |\n| getFontStyles | `textHelpers.getFontStyles(size)` | Returns an object with a font size and line height based on size argument |\n\n**Example Usage**\n\n```\nimport TextHelpers from 'rn-utils'\n\nconst fontSizes = {small: 8, medium: 12};\nconst lineHeights = {small: 12, medium: 16};\n\nconst textHelpers = new TextHelpers(fontSizes, lineHeights);\n\nconst fontStyles = {\n  ...textHelpers.getFontStyles('small');\n}\n```\n\n## Roadmap\nThe aim for this package is to introduce an ever growing list of React Native utilities that can be used when developing real-world scalable applications. With that in mind, below is the list of items I'd like to tackle next. These could be full rewrites of utilities or extracting it from current React Native projects.\n\n- [x] Font Sizes / Line Heights\n- [ ] Legacy Operating Systems\n- [ ] Themes (?)\n- [ ] Animations (?)\n\n## Contributing \u0026 PRs\nIf you believe you have a utility that should be added to this list, please submit a Pull Request and I'll evaluate whether it should be merged. At this moment, I'd like to stay away from integrating other 3rd party libraries that have native dependencies as it creates yet another abstraction on top of those modules (harder to debug).\n\n## Issues\nIf you face issues while using this package, please open an issue on the [Issues Tab](https://github.com/andrerfneves/rn-utils/issues). I'll try to resolve them as soon as possible.\n\n----------\n\n##### MIT LICENSED\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrerfneves%2Frn-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrerfneves%2Frn-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrerfneves%2Frn-utils/lists"}