{"id":25862578,"url":"https://github.com/dioncodes/react-native-layout-margins","last_synced_at":"2026-05-16T11:34:20.207Z","repository":{"id":57108521,"uuid":"329115120","full_name":"dioncodes/react-native-layout-margins","owner":"dioncodes","description":"A simple react native module for applying Layout Margins according to the iOS Layout Design Guides.","archived":false,"fork":false,"pushed_at":"2021-01-19T13:34:19.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T13:37:24.739Z","etag":null,"topics":["ios","ios-layout","react-native"],"latest_commit_sha":null,"homepage":"","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/dioncodes.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":"2021-01-12T21:19:56.000Z","updated_at":"2021-01-19T13:34:26.000Z","dependencies_parsed_at":"2022-08-21T04:30:35.604Z","dependency_job_id":null,"html_url":"https://github.com/dioncodes/react-native-layout-margins","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dioncodes/react-native-layout-margins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioncodes%2Freact-native-layout-margins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioncodes%2Freact-native-layout-margins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioncodes%2Freact-native-layout-margins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioncodes%2Freact-native-layout-margins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dioncodes","download_url":"https://codeload.github.com/dioncodes/react-native-layout-margins/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioncodes%2Freact-native-layout-margins/sbom","scorecard":{"id":343973,"data":{"date":"2025-08-11","repo":{"name":"github.com/dioncodes/react-native-layout-margins","commit":"2c6b0d441ffb640af3e4eb864db2ef83ace5057b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/22 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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"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":"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":"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":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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":"Vulnerabilities","score":0,"reason":"42 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-3gx7-xhv7-5mx3","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-h726-x36v-rx45","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T06:38:19.888Z","repository_id":57108521,"created_at":"2025-08-18T06:38:19.888Z","updated_at":"2025-08-18T06:38:19.888Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272800967,"owners_count":24995185,"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-30T02:00:09.474Z","response_time":77,"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":["ios","ios-layout","react-native"],"created_at":"2025-03-01T23:55:16.357Z","updated_at":"2026-05-16T11:34:15.171Z","avatar_url":"https://github.com/dioncodes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-layout-margins\n\nA simple react native module for views that consider the iOS [layoutMargins](https://developer.apple.com/documentation/uikit/uiview/1622651-layoutmarginsguide) (including safe area insets).\nSupports two components for easy usage (`\u003cContentInsetView /\u003e` and `\u003cContentInsetFlatList /\u003e`) and a method for querying the margins of the current root view.\n\nPlease read the [iOS Layout Design Guides](https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/) for more details on the layout margins.\n\nBased on [delightfulstudio/react-native-safe-area-insets](https://github.com/DelightfulStudio/react-native-safe-area-insets).\n\n# Installation\n\n```sh\nyarn add @dioncodes/react-native-layout-margins\ncd ios \u0026\u0026 pod install\n```\n\n*Important:* If you are updating from version 1.2 or earlier and using the components, you will need to add the `LayoutMarginProvider` (see Component Usage below).\n\n# Manual linking\n1. Open your project in XCode\n1. Add `./node_modules/@dioncodes/react-native-layout-margins/ios/RNLayoutMargins.xcodeproj` to `Libraries` in your project\n1. Select root of your project\n1. Switch to `General` tab\n1. Scroll down to `Linked Frameworks and Libraries` section\n1. Click button `+`\n1. Add `libRNLayoutMargins.a` (if it's not present, build the project and try again)\n\n## Component Usage\n\nTo use the components you need to wrap your screens into a `\u003cLayoutMarginProvider\u003e`.\n\n```javascript\nimport { LayoutMarginProvider } from '@dioncodes/react-native-layout-margins';\n...\n\nconst App = () =\u003e (\n\t\u003cLayoutMarginProvider\u003e\n\t\t...\n\t\u003c/LayoutMarginProvider\u003e\n);\n```\n\n```javascript\nimport { ContentInsetView } from '@dioncodes/react-native-layout-margins';\n...\n\u003cContentInsetView\u003e\n\t\u003cText\u003eI'm aligned according to the iOS layout margins!\u003c/Text\u003e\n\u003c/ContentInsetView\u003e\n```\n\n```jsx\n\u003cContentInsetView vertical horizontal\u003e\n\t\u003cText\u003eI'm aligned according to the iOS layout margins (including safe area), vertically and horizontally.\u003c/Text\u003e\n\u003c/ContentInsetView\u003e\n```\n\n```jsx\n\u003cContentInsetView vertical\u003e\n\t\u003cText\u003eI'm vertically (but not horizontally) aligned according to the iOS layout margins (including safe area).\u003c/Text\u003e\n\u003c/ContentInsetView\u003e\n```\n\nAlso supporting a (react-native-gesture-handler) FlatList with content insets:\n\n```jsx\n\u003cContentInsetFlatList\n\tdata={...}\n\trenderItem={...}\n\tkeyExtractor={(item) =\u003e item.id}\n\tvertical\n\thorizontal\n/\u003e\n```\n\n*Props*:\n\n* `horizontal` (boolean, optional)\n* `vertical` (boolean, optional)\n* `top` (boolean, optional)\n* `left` (boolean, optional)\n* `right` (boolean, optional)\n* `bottom` (boolean, optional)\n* `style` (optional [`ViewStyle`](https://reactnative.dev/docs/view-style-props) prop that is passed to the `View` container)\n\nContentInsetFlatList also accepts all FlatList props.\n\nIf no property is set, only the horizontal padding is active.\n\n## Manual Usage With provider\n\n```javascript\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport { useGetLayoutMarginProvider } from '@dioncodes/react-native-layout-margins';\n\nexport default function ExampleScreen() {\n\tconst layoutMarginContext = useGetLayoutMarginProvider();\n\tconst insets = layoutMarginContext.currentInsets;\n\n\tconst insetStyle = {\n\t\tpaddingLeft: insets.left,\n\t\tpaddingRight: insets.right,\n\t};\n\n\treturn (\n\t\t\u003cView style={insetStyle}\u003e\n\t\t\t\u003cText\u003eI'm aligned according to the iOS layout margins!\u003c/Text\u003e\n\t\t\u003c/View\u003e\n\t);\n}\n```\n\n\n## Manual Usage Without Provider\n\n```javascript\nimport React, { useLayoutEffect, useState } from 'react';\nimport { View, Dimensions } from 'react-native';\n\nimport { currentInsets } from '@dioncodes/react-native-layout-margins';\n\nexport default function ExampleScreen() {\n\tconst [insetStyle, setInsetStyle] = useState({ paddingLeft: 0, paddingRight: 0 });\n\n\tuseLayoutEffect(() =\u003e {\n\t\tconst setInsets = () =\u003e {\n\t\t\tcurrentInsets().then((insets) =\u003e {\n\t\t\t\tsetInsetStyle({\n\t\t\t\t\tpaddingLeft: insets.left,\n\t\t\t\t\tpaddingRight: insets.right,\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\tsetInsets();\n\t\tDimensions.addEventListener('change', setInsets);\n\n\t\treturn function cleanup() {\n\t\t\tDimensions.removeEventListener('change', setInsets);\n\t\t};\n\t}, []);\n\n\n\treturn (\n\t\t\u003cView style={insetStyle}\u003e\n\t\t\t\u003cText\u003eI'm aligned according to the iOS layout margins!\u003c/Text\u003e\n\t\t\u003c/View\u003e\n\t);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdioncodes%2Freact-native-layout-margins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdioncodes%2Freact-native-layout-margins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdioncodes%2Freact-native-layout-margins/lists"}