{"id":21524193,"url":"https://github.com/gxsshallot/react-native-safe-area-utility","last_synced_at":"2026-05-19T11:11:40.089Z","repository":{"id":57339681,"uuid":"179227994","full_name":"gxsshallot/react-native-safe-area-utility","owner":"gxsshallot","description":"A tool for getting insets of Safe Area in React Native view.","archived":false,"fork":false,"pushed_at":"2019-04-03T09:25:34.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-14T12:03:06.246Z","etag":null,"topics":["react-native","safeareainsets"],"latest_commit_sha":null,"homepage":null,"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/gxsshallot.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":"2019-04-03T06:49:23.000Z","updated_at":"2019-08-14T10:44:51.000Z","dependencies_parsed_at":"2022-09-26T16:31:33.182Z","dependency_job_id":null,"html_url":"https://github.com/gxsshallot/react-native-safe-area-utility","commit_stats":null,"previous_names":["gaoxiaosong/react-native-safe-area-utility"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxsshallot%2Freact-native-safe-area-utility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxsshallot%2Freact-native-safe-area-utility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxsshallot%2Freact-native-safe-area-utility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxsshallot%2Freact-native-safe-area-utility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gxsshallot","download_url":"https://codeload.github.com/gxsshallot/react-native-safe-area-utility/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244082587,"owners_count":20395299,"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":["react-native","safeareainsets"],"created_at":"2024-11-24T01:21:27.489Z","updated_at":"2026-05-19T11:11:35.067Z","avatar_url":"https://github.com/gxsshallot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-safe-area-utility\n\n[![npm version](https://img.shields.io/npm/v/react-native-safe-area-utility.svg?style=flat)](https://www.npmjs.com/package/react-native-safe-area-utility)\n[![Build Status](https://travis-ci.org/gaoxiaosong/react-native-safe-area-utility.svg?branch=master)](https://travis-ci.org/gaoxiaosong/react-native-safe-area-utility)\n\nA tool for getting insets of Safe Area in React Native view.\n\n## Platform\n\nIt exports three constants for three platforms.\n\nFor example:\n\n```javascript\nimport { isIos, isAndroid, isWeb } from 'react-native-safe-area-inset';\n\nif (isIos) {\n    // ...\n} else if (isAndroid) {\n    // ...\n} else if (isWeb) {\n    // ...\n}\n```\n\n## Device\n\nThere is some constants to identify special devices.\n\n* `isIPhoneX`: iPhone X serial devices.\n* `isIPad`: iPad.\n* `isNewIPadPro`: Only new iPad Pro which is full screen.\n\nFor example:\n\n```javascript\nimport { isIPhoneX, isIPad, isNewIPadPro } from 'react-native-safe-area-inset';\n\nif (isIPhoneX) {\n    // ...\n} else if (isNewIPadPro) {\n    // ...\n} else if (isIPad) {\n    // ...\n}\n```\n\n## Safe Area Inset\n\nYou can use `getSafeAreaInset` to get the insets of safe area in window. It is implemented by javascript only without native code.\n\nIt supports:\n\n* iPhone (Not X).\n* iPhone X Serial.\n* iPad.\n* New iPad Pro (Full Screen).\n* Android (Translucent or not).\n\nIt support both portrait and landscape for each device.\n\nThe method has two parameters. First one is `landscape`, which uses auto judging when is `undefined`. Second one is `translucent` for Android device only.\n\nFor example:\n\n```javascript\nimport { getSafeAreaInset } from 'react-native-safe-area-inset';\n\nconst insets = getSafeAreaInset();\n// const insets = getSafeAreaInset(undefined, true);\n// const insets = getSafeAreaInset(true);\nconst {top, bottom, left, right} = insets;\n```\n\n## Util\n\nThere are some utilities:\n\n* `isLandscape`: Get landscape status.\n\nFor example:\n\n```javascript\nimport { isLandscape } from 'react-native-safe-area-inset';\n\nif (isLandscape()) {\n    // ...\n} else {\n    // ...\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgxsshallot%2Freact-native-safe-area-utility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgxsshallot%2Freact-native-safe-area-utility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgxsshallot%2Freact-native-safe-area-utility/lists"}